From 0f32d68e16b15424daec94d9b57be50445c6ea92 Mon Sep 17 00:00:00 2001 From: Alex Andres Date: Wed, 28 Oct 2026 17:16:21 +0100 Subject: [PATCH] fix: skip the VP9 interpolation filter test where no hardware decodes VP9 --- .../HardwareVideoDecoderIntegrationTest.java | 31 ++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/webrtc/src/test/java/dev/onvoid/webrtc/HardwareVideoDecoderIntegrationTest.java b/webrtc/src/test/java/dev/onvoid/webrtc/HardwareVideoDecoderIntegrationTest.java index 6a01da77e..b92cf1218 100644 --- a/webrtc/src/test/java/dev/onvoid/webrtc/HardwareVideoDecoderIntegrationTest.java +++ b/webrtc/src/test/java/dev/onvoid/webrtc/HardwareVideoDecoderIntegrationTest.java @@ -20,6 +20,7 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.junit.jupiter.api.Assertions.fail; import static org.junit.jupiter.api.Assumptions.assumeTrue; import dev.onvoid.webrtc.media.video.I420Buffer; @@ -523,6 +524,10 @@ else if (width == 320 && frame.buffer.getHeight() == 240) { @Test void hardwareDecodesVp9FixedInterpolationFilter() throws Exception { assumeVp9Platform(); + // Without a VP9 hardware decoder, both calls would decode with libvpx, + // compare nothing and be skipped only at the end, after a call that + // needs every frame of the stream to reach the sink. + assumeVp9HardwareDecoder(); List stream = readIvf("vp9-fixed-filter.ivf"); @@ -582,7 +587,14 @@ private byte[] lastVp9Frame(VideoDecoderFactory decoders, List strea call.awaitConnected(); call.startMedia(); - assertTrue(received.await(TIMEOUT_SECONDS, TimeUnit.SECONDS), "too few frames received"); + if (!received.await(TIMEOUT_SECONDS, TimeUnit.SECONDS)) { + // Tells whether the frames were lost before or after decoding. + Map inbound = call.getInboundVideoStats(); + + fail("too few frames received: " + (stream.size() - received.getCount()) + " of " + stream.size() + + (inbound == null ? "" : ", decoded " + inbound.get("framesDecoded") + ", dropped " + + inbound.get("framesDropped") + ", key frames asked for " + inbound.get("pliCount"))); + } implementation = decoderImplementationOf(call); @@ -903,6 +915,23 @@ private static boolean isHardware(String implementation) { || implementation.contains("NVDEC") || implementation.contains("VA-API"); } + /** + * Where a hardware decoder is required, the test fails without one for + * VP9; elsewhere it is skipped before it starts a call. + */ + private static void assumeVp9HardwareDecoder() { + boolean required = OS.contains("mac") ? HARDWARE_REQUIRED : HARDWARE_VP9_REQUIRED; + boolean available = new HardwareVideoDecoderFactory().getHardwareCodecs().stream() + .anyMatch(codec -> "VP9".equalsIgnoreCase(codec.getName())); + + if (required) { + assertTrue(available, "no hardware VP9 decoder"); + } + else { + assumeTrue(available, "no hardware VP9 decoder"); + } + } + /** * Where a hardware decoder is required, the test fails without one; * elsewhere it is skipped.