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

winegstreamer: Simplify wm_asyncreader stream loop exit code path.

parent c64775fd
...@@ -102,15 +102,10 @@ static DWORD WINAPI stream_thread(void *arg) ...@@ -102,15 +102,10 @@ static DWORD WINAPI stream_thread(void *arg)
IWMReaderCallbackAdvanced_OnTime(reader->reader.callback_advanced, user_time, reader->context); IWMReaderCallbackAdvanced_OnTime(reader->reader.callback_advanced, user_time, reader->context);
while (pts > reader->user_time && reader->running) while (pts > reader->user_time && reader->running)
SleepConditionVariableCS(&reader->stream_cv, &reader->stream_cs, INFINITE); SleepConditionVariableCS(&reader->stream_cv, &reader->stream_cs, INFINITE);
if (!reader->running)
{
INSSBuffer_Release(sample);
goto out;
}
} }
else else
{ {
for (;;) while (reader->running)
{ {
REFERENCE_TIME current_time = get_current_time(reader); REFERENCE_TIME current_time = get_current_time(reader);
...@@ -119,22 +114,20 @@ static DWORD WINAPI stream_thread(void *arg) ...@@ -119,22 +114,20 @@ static DWORD WINAPI stream_thread(void *arg)
SleepConditionVariableCS(&reader->stream_cv, &reader->stream_cs, SleepConditionVariableCS(&reader->stream_cv, &reader->stream_cs,
(pts - (current_time - start_time)) / 10000); (pts - (current_time - start_time)) / 10000);
if (!reader->running)
{
INSSBuffer_Release(sample);
goto out;
}
} }
} }
if (stream->read_compressed) if (reader->running)
hr = IWMReaderCallbackAdvanced_OnStreamSample(reader->reader.callback_advanced, {
stream_number, pts, duration, flags, sample, reader->context); if (stream->read_compressed)
else hr = IWMReaderCallbackAdvanced_OnStreamSample(reader->reader.callback_advanced,
hr = IWMReaderCallback_OnSample(callback, stream_number - 1, pts, duration, stream_number, pts, duration, flags, sample, reader->context);
flags, sample, reader->context); else
TRACE("Callback returned %#lx.\n", hr); hr = IWMReaderCallback_OnSample(callback, stream_number - 1, pts, duration,
flags, sample, reader->context);
TRACE("Callback returned %#lx.\n", hr);
}
INSSBuffer_Release(sample); INSSBuffer_Release(sample);
} }
...@@ -161,7 +154,6 @@ static DWORD WINAPI stream_thread(void *arg) ...@@ -161,7 +154,6 @@ static DWORD WINAPI stream_thread(void *arg)
ERR("Failed to get sample, hr %#lx.\n", hr); ERR("Failed to get sample, hr %#lx.\n", hr);
} }
out:
LeaveCriticalSection(&reader->stream_cs); LeaveCriticalSection(&reader->stream_cs);
TRACE("Reader is stopping; exiting.\n"); TRACE("Reader is stopping; exiting.\n");
......
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