[PATCH v2 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 07:21:04 CST 2022


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>
---

v2: * Call MFT_MESSAGE_COMMAND_DRAIN. It seems to be synchronizing the
    transform and makes the number of input sample consistent. The
    MF_LOW_LATENCY attribute may not be necessary anymore but some
    games are actually setting the attribute so I'm keeping the test.

    * Allocate a fixed size sample in PATCH 2, output_info.cbSize is not
    initialized on Wine yet.

 dlls/mf/tests/mf.c | 43 ++++++++++++++++++++++++++++++++-----------
 1 file changed, 32 insertions(+), 11 deletions(-)

diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c
index 6462594dae2..d08f0c82807 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,30 @@ 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++;
+
+        hr = IMFTransform_ProcessMessage(transform, MFT_MESSAGE_COMMAND_DRAIN, 0);
+        todo_wine
+        ok(hr == S_OK, "ProcessMessage returned %#x\n", hr);
     }
     todo_wine
+    ok(i == 2, "got %u iterations\n", i);
+    todo_wine
+    ok(h264_encoded_data_len == 44959, "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