[PATCH 4/4] amstream: Call IMediaStreamFilter::Flush in IPin::BeginFlush.

Anton Baskanov baskanov at gmail.com
Wed Apr 14 02:18:48 CDT 2021


Signed-off-by: Anton Baskanov <baskanov at gmail.com>
---
 dlls/amstream/audiostream.c    |  5 +++++
 dlls/amstream/ddrawstream.c    |  5 +++++
 dlls/amstream/tests/amstream.c | 16 ++++++++--------
 3 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/dlls/amstream/audiostream.c b/dlls/amstream/audiostream.c
index a07e62a4672..a46c8707e65 100644
--- a/dlls/amstream/audiostream.c
+++ b/dlls/amstream/audiostream.c
@@ -1168,15 +1168,20 @@ static HRESULT WINAPI audio_sink_EndOfStream(IPin *iface)
 static HRESULT WINAPI audio_sink_BeginFlush(IPin *iface)
 {
     struct audio_stream *stream = impl_from_IPin(iface);
+    BOOL cancel_eos;
 
     TRACE("stream %p.\n", stream);
 
     EnterCriticalSection(&stream->cs);
 
+    cancel_eos = stream->eos;
+
     stream->flushing = TRUE;
     stream->eos = FALSE;
     flush_receive_queue(stream);
 
+    IMediaStreamFilter_Flush(stream->filter, cancel_eos);
+
     LeaveCriticalSection(&stream->cs);
 
     return S_OK;
diff --git a/dlls/amstream/ddrawstream.c b/dlls/amstream/ddrawstream.c
index e04e3a1c56f..94270b83e38 100644
--- a/dlls/amstream/ddrawstream.c
+++ b/dlls/amstream/ddrawstream.c
@@ -1188,15 +1188,20 @@ static HRESULT WINAPI ddraw_sink_EndOfStream(IPin *iface)
 static HRESULT WINAPI ddraw_sink_BeginFlush(IPin *iface)
 {
     struct ddraw_stream *stream = impl_from_IPin(iface);
+    BOOL cancel_eos;
 
     TRACE("stream %p.\n", stream);
 
     EnterCriticalSection(&stream->cs);
 
+    cancel_eos = stream->eos;
+
     stream->flushing = TRUE;
     stream->eos = FALSE;
     WakeConditionVariable(&stream->update_queued_cv);
 
+    IMediaStreamFilter_Flush(stream->filter, cancel_eos);
+
     LeaveCriticalSection(&stream->cs);
 
     return S_OK;
diff --git a/dlls/amstream/tests/amstream.c b/dlls/amstream/tests/amstream.c
index df3cac48754..b7d4d89d8fd 100644
--- a/dlls/amstream/tests/amstream.c
+++ b/dlls/amstream/tests/amstream.c
@@ -4393,7 +4393,7 @@ static void test_audiostream_begin_flush_end_flush(void)
 
     hr = IPin_BeginFlush(pin);
     ok(hr == S_OK, "Got hr %#x.\n", hr);
-    todo_wine ok(filter.got_flush == 1, "Got %d calls to IMediaStreamFilter::EndOfStream().\n", filter.got_flush);
+    ok(filter.got_flush == 1, "Got %d calls to IMediaStreamFilter::EndOfStream().\n", filter.got_flush);
     ok(!filter.flush_cancel_eos, "Got cancel_eos %d.\n", filter.flush_cancel_eos);
 
     hr = IPin_EndFlush(pin);
@@ -4404,15 +4404,15 @@ static void test_audiostream_begin_flush_end_flush(void)
 
     hr = IPin_BeginFlush(pin);
     ok(hr == S_OK, "Got hr %#x.\n", hr);
-    todo_wine ok(filter.got_flush == 2, "Got %d calls to IMediaStreamFilter::EndOfStream().\n", filter.got_flush);
-    todo_wine ok(filter.flush_cancel_eos, "Got cancel_eos %d.\n", filter.flush_cancel_eos);
+    ok(filter.got_flush == 2, "Got %d calls to IMediaStreamFilter::EndOfStream().\n", filter.got_flush);
+    ok(filter.flush_cancel_eos, "Got cancel_eos %d.\n", filter.flush_cancel_eos);
 
     hr = IPin_EndFlush(pin);
     ok(hr == S_OK, "Got hr %#x.\n", hr);
 
     hr = IPin_BeginFlush(pin);
     ok(hr == S_OK, "Got hr %#x.\n", hr);
-    todo_wine ok(filter.got_flush == 3, "Got %d calls to IMediaStreamFilter::EndOfStream().\n", filter.got_flush);
+    ok(filter.got_flush == 3, "Got %d calls to IMediaStreamFilter::EndOfStream().\n", filter.got_flush);
     ok(!filter.flush_cancel_eos, "Got cancel_eos %d.\n", filter.flush_cancel_eos);
 
     hr = IPin_EndFlush(pin);
@@ -5926,7 +5926,7 @@ static void test_ddrawstream_begin_flush_end_flush(void)
 
     hr = IPin_BeginFlush(pin);
     ok(hr == S_OK, "Got hr %#x.\n", hr);
-    todo_wine ok(filter.got_flush == 1, "Got %d calls to IMediaStreamFilter::EndOfStream().\n", filter.got_flush);
+    ok(filter.got_flush == 1, "Got %d calls to IMediaStreamFilter::EndOfStream().\n", filter.got_flush);
     ok(!filter.flush_cancel_eos, "Got cancel_eos %d.\n", filter.flush_cancel_eos);
 
     hr = IPin_EndFlush(pin);
@@ -5937,15 +5937,15 @@ static void test_ddrawstream_begin_flush_end_flush(void)
 
     hr = IPin_BeginFlush(pin);
     ok(hr == S_OK, "Got hr %#x.\n", hr);
-    todo_wine ok(filter.got_flush == 2, "Got %d calls to IMediaStreamFilter::EndOfStream().\n", filter.got_flush);
-    todo_wine ok(filter.flush_cancel_eos, "Got cancel_eos %d.\n", filter.flush_cancel_eos);
+    ok(filter.got_flush == 2, "Got %d calls to IMediaStreamFilter::EndOfStream().\n", filter.got_flush);
+    ok(filter.flush_cancel_eos, "Got cancel_eos %d.\n", filter.flush_cancel_eos);
 
     hr = IPin_EndFlush(pin);
     ok(hr == S_OK, "Got hr %#x.\n", hr);
 
     hr = IPin_BeginFlush(pin);
     ok(hr == S_OK, "Got hr %#x.\n", hr);
-    todo_wine ok(filter.got_flush == 3, "Got %d calls to IMediaStreamFilter::EndOfStream().\n", filter.got_flush);
+    ok(filter.got_flush == 3, "Got %d calls to IMediaStreamFilter::EndOfStream().\n", filter.got_flush);
     ok(!filter.flush_cancel_eos, "Got cancel_eos %d.\n", filter.flush_cancel_eos);
 
     hr = IPin_EndFlush(pin);
-- 
2.25.1




More information about the wine-devel mailing list