Commit 81d04f93 authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

winegstreamer: Leave the wm_reader stream_cs when calling the callbacks.

They may block and we need to enter the stream_cs to stop the reader. Signed-off-by: 's avatarRémi Bernon <rbernon@codeweavers.com>
parent fdb0f101
......@@ -99,7 +99,12 @@ static DWORD WINAPI stream_thread(void *arg)
QWORD user_time = reader->user_time;
if (pts > user_time && reader->reader.callback_advanced)
{
LeaveCriticalSection(&reader->stream_cs);
IWMReaderCallbackAdvanced_OnTime(reader->reader.callback_advanced, user_time, reader->context);
EnterCriticalSection(&reader->stream_cs);
}
while (pts > reader->user_time && reader->running)
SleepConditionVariableCS(&reader->stream_cv, &reader->stream_cs, INFINITE);
}
......@@ -119,18 +124,23 @@ static DWORD WINAPI stream_thread(void *arg)
if (reader->running)
{
LeaveCriticalSection(&reader->stream_cs);
if (stream->read_compressed)
hr = IWMReaderCallbackAdvanced_OnStreamSample(reader->reader.callback_advanced,
stream_number, pts, duration, flags, sample, reader->context);
else
hr = IWMReaderCallback_OnSample(callback, stream_number - 1, pts, duration,
flags, sample, reader->context);
EnterCriticalSection(&reader->stream_cs);
TRACE("Callback returned %#lx.\n", hr);
}
INSSBuffer_Release(sample);
}
LeaveCriticalSection(&reader->stream_cs);
if (hr == NS_E_NO_MORE_SAMPLES)
{
IWMReaderCallback_OnStatus(callback, WMT_END_OF_STREAMING, S_OK,
......@@ -154,8 +164,6 @@ static DWORD WINAPI stream_thread(void *arg)
ERR("Failed to get sample, hr %#lx.\n", hr);
}
LeaveCriticalSection(&reader->stream_cs);
TRACE("Reader is stopping; exiting.\n");
return 0;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment