The test will still segfault if it fails, but at least there will be an indication as to why.
Signed-off-by: Alex Henrie alexhenrie24@gmail.com --- dlls/mfplat/tests/mfplat.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index 21eab6d1172..d9f30867f7f 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -686,6 +686,7 @@ static void test_source_resolver(void) GUID guid; float rate; UINT32 rotation; + BOOL ret;
if (!pMFCreateSourceResolver) { @@ -889,12 +890,10 @@ todo_wine hr = IMFMediaSource_Start(mediasource, descriptor, &GUID_NULL, &var); ok(hr == S_OK, "Failed to start media source, hr %#x.\n", hr);
- video_stream = NULL; - if (get_event((IMFMediaEventGenerator *)mediasource, MENewStream, &var)) - { - ok(var.vt == VT_UNKNOWN, "Unexpected value type.\n"); - video_stream = (IMFMediaStream *)var.punkVal; - } + ret = get_event((IMFMediaEventGenerator *)mediasource, MENewStream, &var); + ok(ret, "Failed to get event.\n"); + ok(var.vt == VT_UNKNOWN, "Unexpected value type.\n"); + video_stream = (IMFMediaStream *)var.punkVal;
sample_count = 10;
@@ -912,7 +911,6 @@ todo_wine LONGLONG duration, time; DWORD buffer_count; IMFSample *sample; - BOOL ret;
ret = get_event((IMFMediaEventGenerator *)video_stream, MEMediaSample, &var); ok(ret, "Sample %u not received.\n", i + 1);
On 12/27/21 02:11, Alex Henrie wrote:
- video_stream = NULL;
- if (get_event((IMFMediaEventGenerator *)mediasource, MENewStream, &var))
- {
ok(var.vt == VT_UNKNOWN, "Unexpected value type.\n");
video_stream = (IMFMediaStream *)var.punkVal;
- }
- ret = get_event((IMFMediaEventGenerator *)mediasource, MENewStream, &var);
- ok(ret, "Failed to get event.\n");
- ok(var.vt == VT_UNKNOWN, "Unexpected value type.\n");
- video_stream = (IMFMediaStream *)var.punkVal;
The point is that if it's not MENewStream, you won't necessarily have IMFMediaStream in event data.
On Sun, Dec 26, 2021 at 11:45 PM Nikolay Sivov nsivov@codeweavers.com wrote:
On 12/27/21 02:11, Alex Henrie wrote:
- video_stream = NULL;
- if (get_event((IMFMediaEventGenerator *)mediasource, MENewStream, &var))
- {
ok(var.vt == VT_UNKNOWN, "Unexpected value type.\n");
video_stream = (IMFMediaStream *)var.punkVal;
- }
- ret = get_event((IMFMediaEventGenerator *)mediasource, MENewStream, &var);
- ok(ret, "Failed to get event.\n");
- ok(var.vt == VT_UNKNOWN, "Unexpected value type.\n");
- video_stream = (IMFMediaStream *)var.punkVal;
The point is that if it's not MENewStream, you won't necessarily have IMFMediaStream in event data.
If that ever happened, the next test would crash because video_stream would be null (hence the Coverity warning). So, as they are currently written, the tests assume that the first call to get_event will succeed. Is there any version of Windows that we care about where the first call to get_event fails?
-Alex