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 2f7854606f4..e42651bb97c 100644 --- a/dlls/amstream/tests/amstream.c +++ b/dlls/amstream/tests/amstream.c @@ -6340,11 +6340,11 @@ 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(filter.got_end_of_stream == 1, "Got %d calls to IMediaStreamFilter::EndOfStream().\n", filter.got_end_of_stream); + ok(filter.got_end_of_stream == 1, "Got %d calls to IMediaStreamFilter::EndOfStream().\n", filter.got_end_of_stream);
hr = IPin_EndOfStream(pin); ok(hr == E_FAIL, "Got hr %#x.\n", hr); - todo_wine ok(filter.got_end_of_stream == 1, "Got %d calls to IMediaStreamFilter::EndOfStream().\n", filter.got_end_of_stream); + ok(filter.got_end_of_stream == 1, "Got %d calls to IMediaStreamFilter::EndOfStream().\n", filter.got_end_of_stream);
IPin_Release(pin); ref = IAMMediaStream_Release(am_stream);