On 10/22/20 2:06 PM, Anton Baskanov wrote:
Signed-off-by: Anton Baskanov baskanov@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?