Signed-off-by: Anton Baskanov baskanov@gmail.com --- dlls/amstream/audiostream.c | 5 +++++ dlls/amstream/ddrawstream.c | 5 +++++ dlls/amstream/tests/amstream.c | 4 ++-- 3 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/dlls/amstream/audiostream.c b/dlls/amstream/audiostream.c index dc6c810d19a..a07e62a4672 100644 --- a/dlls/amstream/audiostream.c +++ b/dlls/amstream/audiostream.c @@ -1157,6 +1157,11 @@ static HRESULT WINAPI audio_sink_EndOfStream(IPin *iface)
LeaveCriticalSection(&stream->cs);
+ /* Calling IMediaStreamFilter::EndOfStream() inside the critical section + * would invert the locking order, so we must leave it first to avoid + * the streaming thread deadlocking on the filter's critical section. */ + IMediaStreamFilter_EndOfStream(stream->filter); + return S_OK; }
diff --git a/dlls/amstream/ddrawstream.c b/dlls/amstream/ddrawstream.c index d6f07e1b10a..e04e3a1c56f 100644 --- a/dlls/amstream/ddrawstream.c +++ b/dlls/amstream/ddrawstream.c @@ -1177,6 +1177,11 @@ static HRESULT WINAPI ddraw_sink_EndOfStream(IPin *iface)
LeaveCriticalSection(&stream->cs);
+ /* Calling IMediaStreamFilter::EndOfStream() inside the critical section + * would invert the locking order, so we must leave it first to avoid + * the streaming thread deadlocking on the filter's critical section. */ + IMediaStreamFilter_EndOfStream(stream->filter); + return S_OK; }
diff --git a/dlls/amstream/tests/amstream.c b/dlls/amstream/tests/amstream.c index e7fd731dd72..a6ec84fbdea 100644 --- a/dlls/amstream/tests/amstream.c +++ b/dlls/amstream/tests/amstream.c @@ -6127,8 +6127,8 @@ static void check_ammediastream_end_of_stream(const CLSID *clsid, const MSPID *i hr = IPin_EndOfStream(pin); 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);