[PATCH 3/5] amstream: Release filter critical section before calling upstream seeking methods.
Zebediah Figura
zfigura at codeweavers.com
Fri Oct 23 11:27:11 CDT 2020
On 10/22/20 2:06 PM, Anton Baskanov wrote:
> Signed-off-by: Anton Baskanov <baskanov at gmail.com>
> ---
> dlls/amstream/filter.c | 29 ++++++++++++++---------------
> 1 file changed, 14 insertions(+), 15 deletions(-)
>
> diff --git a/dlls/amstream/filter.c b/dlls/amstream/filter.c
> index b63a0301d64..daeb1fafe71 100644
> --- a/dlls/amstream/filter.c
> +++ b/dlls/amstream/filter.c
> @@ -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;
> }
>
>
I think this is safe, but the motivation isn't clear to me. Can you
please provide a brief explanation?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20201023/b53e0780/attachment.sig>
More information about the wine-devel
mailing list