From: Brendan McGrath <bmcgrath@codeweavers.com> This fixes two potential race conditions: 1. That we can process the sample_event and check the sinks collection count prior to the sink adding the new sample to its collection; and 2. That the source stream can add multiple samples to its collection within the time it takes for us to process a single event. --- dlls/mf/tests/mf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dlls/mf/tests/mf.c b/dlls/mf/tests/mf.c index fcca37f8897..df1362381b2 100644 --- a/dlls/mf/tests/mf.c +++ b/dlls/mf/tests/mf.c @@ -1359,9 +1359,9 @@ static HRESULT WINAPI test_stream_sink_ProcessSample(IMFStreamSink *iface, IMFSa struct test_stream_sink *impl = impl_from_IMFStreamSink(iface); HRESULT hr; - SetEvent(impl->sample_event); hr = IMFCollection_AddElement(impl->samples, (IUnknown*)sample); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + SetEvent(impl->sample_event); if (expect_test_stream_sink_ProcessSample) hr = S_OK; @@ -10835,7 +10835,7 @@ static void test_media_session_sample_request(void) ok(hr == WAIT_OBJECT_0, "Unexpected hr %#lx.\n", hr); hr = IMFCollection_GetElementCount(stream->delayed_samples, &samples_count); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - ok(samples_count == 1, "Unexpected delayed samples count %ld.\n", samples_count); + ok(samples_count >= 1, "Unexpected delayed samples count %ld.\n", samples_count); /* Mimic end of stream */ SET_EXPECT(test_stream_sink_PlaceMarker); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10125