amstream: Call IMediaStreamFilter::Flush in IPin::BeginFlush.

Signed-off-by: Anton Baskanov <baskanov@gmail.com>
Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Anton Baskanov 2021-04-20 00:22:55 +07:00 committed by Alexandre Julliard
parent 35fc7319e2
commit 1917fe0e07
3 changed files with 22 additions and 6 deletions

View file

@ -1168,17 +1168,25 @@ 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);
LeaveCriticalSection(&stream->cs);
/* Calling IMediaStreamFilter::Flush() inside the critical section would
* invert the locking order, so we must leave it first to avoid the
* application thread deadlocking on the filter's critical section. */
IMediaStreamFilter_Flush(stream->filter, cancel_eos);
return S_OK;
}

View file

@ -1188,17 +1188,25 @@ 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);
LeaveCriticalSection(&stream->cs);
/* Calling IMediaStreamFilter::Flush() inside the critical section would
* invert the locking order, so we must leave it first to avoid the
* application thread deadlocking on the filter's critical section. */
IMediaStreamFilter_Flush(stream->filter, cancel_eos);
return S_OK;
}

View file

@ -4214,7 +4214,7 @@ static void test_audiostream_begin_flush_end_flush(void)
hr = IPin_EndOfStream(pin2);
ok(hr == S_OK, "Got hr %#x.\n", hr);
todo_wine ok(graph.got_notify == 0, "Got %d calls to IMediaEventSink::Notify().\n", graph.got_notify);
ok(graph.got_notify == 0, "Got %d calls to IMediaEventSink::Notify().\n", graph.got_notify);
hr = IPin_EndOfStream(pin);
ok(hr == S_OK, "Got hr %#x.\n", hr);
@ -4248,8 +4248,8 @@ static void test_audiostream_begin_flush_end_flush(void)
hr = IPin_EndOfStream(pin2);
ok(hr == S_OK, "Got hr %#x.\n", hr);
todo_wine ok(graph.got_notify == 1, "Got %d calls to IMediaEventSink::Notify().\n", graph.got_notify);
todo_wine ok(graph.event_code == EC_COMPLETE, "Got event code %d.\n", graph.event_code);
ok(graph.got_notify == 1, "Got %d calls to IMediaEventSink::Notify().\n", graph.got_notify);
ok(graph.event_code == EC_COMPLETE, "Got event code %d.\n", graph.event_code);
hr = IAMMultiMediaStream_SetState(mmstream, STREAMSTATE_STOP);
ok(hr == S_OK, "Got hr %#x.\n", hr);
@ -5808,7 +5808,7 @@ static void test_ddrawstream_begin_flush_end_flush(void)
hr = IPin_EndOfStream(pin2);
ok(hr == S_OK, "Got hr %#x.\n", hr);
todo_wine ok(graph.got_notify == 0, "Got %d calls to IMediaEventSink::Notify().\n", graph.got_notify);
ok(graph.got_notify == 0, "Got %d calls to IMediaEventSink::Notify().\n", graph.got_notify);
hr = IPin_EndOfStream(pin);
ok(hr == S_OK, "Got hr %#x.\n", hr);
@ -5842,8 +5842,8 @@ static void test_ddrawstream_begin_flush_end_flush(void)
hr = IPin_EndOfStream(pin2);
ok(hr == S_OK, "Got hr %#x.\n", hr);
todo_wine ok(graph.got_notify == 1, "Got %d calls to IMediaEventSink::Notify().\n", graph.got_notify);
todo_wine ok(graph.event_code == EC_COMPLETE, "Got event code %d.\n", graph.event_code);
ok(graph.got_notify == 1, "Got %d calls to IMediaEventSink::Notify().\n", graph.got_notify);
ok(graph.event_code == EC_COMPLETE, "Got event code %d.\n", graph.event_code);
hr = IAMMultiMediaStream_SetState(mmstream, STREAMSTATE_STOP);
ok(hr == S_OK, "Got hr %#x.\n", hr);