winegstreamer: Acquire all of the flushing locks in GST_Seeking_SetPositions().

The current code unintentionally repeatedly acquires the lock for the stream
currently being seeked.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50906
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2021-12-13 18:06:04 -06:00 committed by Alexandre Julliard
parent 8138159f20
commit fa3fa0e3d5
1 changed files with 12 additions and 6 deletions

View File

@ -1327,8 +1327,10 @@ static HRESULT WINAPI GST_Seeking_SetPositions(IMediaSeeking *iface,
* ensures the seek is serialized between flushes. */
for (i = 0; i < filter->source_count; ++i)
{
if (filter->sources[i]->pin.pin.peer)
EnterCriticalSection(&pin->flushing_cs);
struct parser_source *flush_pin = filter->sources[i];
if (flush_pin->pin.pin.peer)
EnterCriticalSection(&flush_pin->flushing_cs);
}
SourceSeekingImpl_SetPositions(iface, current, current_flags, stop, stop_flags);
@ -1342,8 +1344,10 @@ static HRESULT WINAPI GST_Seeking_SetPositions(IMediaSeeking *iface,
for (i = 0; i < filter->source_count; ++i)
{
if (filter->sources[i]->pin.pin.peer)
IPin_EndFlush(filter->sources[i]->pin.pin.peer);
struct parser_source *flush_pin = filter->sources[i];
if (flush_pin->pin.pin.peer)
IPin_EndFlush(flush_pin->pin.pin.peer);
}
if (filter->reader)
@ -1353,8 +1357,10 @@ static HRESULT WINAPI GST_Seeking_SetPositions(IMediaSeeking *iface,
/* Release the flushing locks. */
for (i = filter->source_count - 1; i >= 0; --i)
{
if (filter->sources[i]->pin.pin.peer)
LeaveCriticalSection(&pin->flushing_cs);
struct parser_source *flush_pin = filter->sources[i];
if (flush_pin->pin.pin.peer)
LeaveCriticalSection(&flush_pin->flushing_cs);
}
return S_OK;