[PATCH 1/5] mf/tests: Check the number of input samples to get a H264 stream change.

Rémi Bernon rbernon at codeweavers.com
Fri Mar 4 06:09:34 CST 2022


This is not completely exact, and depending on how often ProcessInput
and ProcessOutput are called the numbers may vary a bit, but this
version seems to be consistent enough. We could very well ignore the
checks too as GStreamer output doesn't seem to match.

We check that we can at least push two input samples at a time, which
matches what Call of Duty Black Ops 3 is doing, as it is not checking
ProcessInput result most of the time.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=45988
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47084
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49715
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52183
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
 dlls/mf/tests/mf.c | 39 ++++++++++++++++++++++++++++-----------
 1 file changed, 28 insertions(+), 11 deletions(-)

diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c
index 6462594dae2..69ad4c2e5fc 100644
--- a/dlls/mf/tests/mf.c
+++ b/dlls/mf/tests/mf.c
@@ -6615,6 +6615,7 @@ static void test_h264_decoder(void)
     MFT_OUTPUT_DATA_BUFFER output;
     const BYTE *h264_encoded_data;
     ULONG h264_encoded_data_len;
+    IMFAttributes *attributes;
     IMFMediaType *media_type;
     IMFTransform *transform;
     ULONG i, ret, flags;
@@ -6632,6 +6633,14 @@ static void test_h264_decoder(void)
             &transform, &class_id))
         goto failed;
 
+    hr = IMFTransform_GetAttributes(transform, &attributes);
+    todo_wine
+    ok(hr == S_OK, "GetAttributes returned %#x\n", hr);
+    if (hr != S_OK) MFCreateAttributes(&attributes, 0);
+    hr = IMFAttributes_SetUINT32(attributes, &MF_LOW_LATENCY, 1);
+    ok(hr == S_OK, "SetUINT32 returned %#x\n", hr);
+    IMFAttributes_Release(attributes);
+
     /* no output type is available before an input type is set */
 
     hr = IMFTransform_GetOutputAvailableType(transform, 0, 0, &media_type);
@@ -6826,6 +6835,7 @@ static void test_h264_decoder(void)
     ok(!output.pEvents, "got pEvents %p\n", output.pEvents);
     ok(status == 0, "got status %#x\n", status);
 
+    i = 0;
     sample = next_h264_sample(&h264_encoded_data, &h264_encoded_data_len);
     while (1)
     {
@@ -6844,19 +6854,26 @@ static void test_h264_decoder(void)
         ret = IMFSample_Release(output.pSample);
         ok(ret == 0, "Release returned %u\n", ret);
 
-        while (h264_encoded_data_len > 4)
-        {
-            hr = IMFTransform_ProcessInput(transform, 0, sample, 0);
-            if (FAILED(hr)) break;
-            ok(hr == S_OK, "ProcessInput returned %#x\n", hr);
-            ret = IMFSample_Release(sample);
-            ok(ret <= 1, "Release returned %u\n", ret);
-            sample = next_h264_sample(&h264_encoded_data, &h264_encoded_data_len);
-        }
-        ok(hr == MF_E_NOTACCEPTING, "ProcessInput returned %#x\n", hr);
-        EXPECT_REF(sample, 1);
+        hr = IMFTransform_ProcessInput(transform, 0, sample, 0);
+        todo_wine
+        ok(hr == S_OK, "ProcessInput returned %#x\n", hr);
+        ret = IMFSample_Release(sample);
+        ok(ret <= 1, "Release returned %u\n", ret);
+        sample = next_h264_sample(&h264_encoded_data, &h264_encoded_data_len);
+
+        hr = IMFTransform_ProcessInput(transform, 0, sample, 0);
+        todo_wine
+        ok(hr == S_OK, "ProcessInput returned %#x\n", hr);
+        ret = IMFSample_Release(sample);
+        ok(ret <= 1, "Release returned %u\n", ret);
+        sample = next_h264_sample(&h264_encoded_data, &h264_encoded_data_len);
+        i++;
     }
     todo_wine
+    ok(i == 3, "got %u iterations\n", i);
+    todo_wine
+    ok(h264_encoded_data_len == 43479, "got h264_encoded_data_len %u\n", h264_encoded_data_len);
+    todo_wine
     ok(hr == MF_E_TRANSFORM_STREAM_CHANGE, "ProcessOutput returned %#x\n", hr);
     ok(output.dwStreamID == 0, "got dwStreamID %u\n", output.dwStreamID);
     ok(!!output.pSample, "got pSample %p\n", output.pSample);
-- 
2.34.1




More information about the wine-devel mailing list