Commit 275b2226 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

winegstreamer: Use the "flushing" field to unblock the streaming thread when stopping.

parent 90107bba
...@@ -1013,14 +1013,14 @@ static DWORD CALLBACK stream_thread(void *arg) ...@@ -1013,14 +1013,14 @@ static DWORD CALLBACK stream_thread(void *arg)
TRACE("Starting streaming thread for pin %p.\n", pin); TRACE("Starting streaming thread for pin %p.\n", pin);
for (;;) while (filter->streaming)
{ {
struct parser_event event; struct parser_event event;
EnterCriticalSection(&pin->flushing_cs); EnterCriticalSection(&pin->flushing_cs);
EnterCriticalSection(&filter->cs); EnterCriticalSection(&filter->cs);
while (filter->streaming && !filter->flushing && pin->event.type == PARSER_EVENT_NONE) while (!filter->flushing && pin->event.type == PARSER_EVENT_NONE)
SleepConditionVariableCS(&pin->event_cv, &filter->cs, INFINITE); SleepConditionVariableCS(&pin->event_cv, &filter->cs, INFINITE);
if (filter->flushing) if (filter->flushing)
...@@ -1031,13 +1031,6 @@ static DWORD CALLBACK stream_thread(void *arg) ...@@ -1031,13 +1031,6 @@ static DWORD CALLBACK stream_thread(void *arg)
continue; continue;
} }
if (!filter->streaming)
{
LeaveCriticalSection(&filter->cs);
LeaveCriticalSection(&pin->flushing_cs);
break;
}
if (!pin->event.type) if (!pin->event.type)
{ {
LeaveCriticalSection(&filter->cs); LeaveCriticalSection(&filter->cs);
...@@ -1585,8 +1578,9 @@ static HRESULT parser_init_stream(struct strmbase_filter *iface) ...@@ -1585,8 +1578,9 @@ static HRESULT parser_init_stream(struct strmbase_filter *iface)
if (!filter->container) if (!filter->container)
return S_OK; return S_OK;
EnterCriticalSection(&filter->cs);
filter->streaming = true; filter->streaming = true;
EnterCriticalSection(&filter->cs);
filter->flushing = false;
LeaveCriticalSection(&filter->cs); LeaveCriticalSection(&filter->cs);
/* DirectShow retains the old seek positions, but resets to them every time /* DirectShow retains the old seek positions, but resets to them every time
...@@ -1624,8 +1618,9 @@ static HRESULT parser_cleanup_stream(struct strmbase_filter *iface) ...@@ -1624,8 +1618,9 @@ static HRESULT parser_cleanup_stream(struct strmbase_filter *iface)
if (!filter->container) if (!filter->container)
return S_OK; return S_OK;
EnterCriticalSection(&filter->cs);
filter->streaming = false; filter->streaming = false;
EnterCriticalSection(&filter->cs);
filter->flushing = true;
LeaveCriticalSection(&filter->cs); LeaveCriticalSection(&filter->cs);
for (i = 0; i < filter->source_count; ++i) for (i = 0; i < filter->source_count; ++i)
...@@ -1869,6 +1864,7 @@ static void parser_init_common(struct parser *object) ...@@ -1869,6 +1864,7 @@ static void parser_init_common(struct parser *object)
object->error_event = CreateEventW(NULL, TRUE, FALSE, NULL); object->error_event = CreateEventW(NULL, TRUE, FALSE, NULL);
InitializeCriticalSection(&object->cs); InitializeCriticalSection(&object->cs);
object->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": parser.cs"); object->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": parser.cs");
object->flushing = true;
} }
HRESULT decodebin_parser_create(IUnknown *outer, IUnknown **out) HRESULT decodebin_parser_create(IUnknown *outer, IUnknown **out)
......
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