amstream: Release filter critical section before calling upstream seeking methods.

Otherwise a seek might deadlock when the stream calls the filter methods (e.g. WaitUntil) from streaming thread.

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 2020-10-29 11:40:58 +07:00 committed by Alexandre Julliard
parent f2cfd63cda
commit 8492657ab8

View file

@ -795,15 +795,16 @@ static HRESULT WINAPI filter_seeking_GetDuration(IMediaSeeking *iface, LONGLONG
EnterCriticalSection(&filter->cs);
if (!(seeking = get_seeking(filter->seekable_stream)))
{
LeaveCriticalSection(&filter->cs);
seeking = get_seeking(filter->seekable_stream);
LeaveCriticalSection(&filter->cs);
if (!seeking)
return E_NOTIMPL;
}
hr = IMediaSeeking_GetDuration(seeking, duration);
IMediaSeeking_Release(seeking);
LeaveCriticalSection(&filter->cs);
return hr;
}
@ -817,15 +818,16 @@ static HRESULT WINAPI filter_seeking_GetStopPosition(IMediaSeeking *iface, LONGL
EnterCriticalSection(&filter->cs);
if (!(seeking = get_seeking(filter->seekable_stream)))
{
LeaveCriticalSection(&filter->cs);
seeking = get_seeking(filter->seekable_stream);
LeaveCriticalSection(&filter->cs);
if (!seeking)
return E_NOTIMPL;
}
hr = IMediaSeeking_GetStopPosition(seeking, stop);
IMediaSeeking_Release(seeking);
LeaveCriticalSection(&filter->cs);
return hr;
}
@ -860,18 +862,15 @@ static HRESULT WINAPI filter_seeking_SetPositions(IMediaSeeking *iface, LONGLONG
seeking = get_seeking(filter->seekable_stream);
LeaveCriticalSection(&filter->cs);
if (!seeking)
{
LeaveCriticalSection(&filter->cs);
return E_NOTIMPL;
}
hr = IMediaSeeking_SetPositions(seeking, current_ptr, current_flags, stop_ptr, stop_flags);
IMediaSeeking_Release(seeking);
LeaveCriticalSection(&filter->cs);
return hr;
}