Commit cc116548 authored by Giovanni Mascellani's avatar Giovanni Mascellani Committed by Alexandre Julliard

winegstreamer: Wait on error conditions when initializing GStreamer.

GStreamer doesn't necessarily signal all error when setting the PLAYING or PAUSED state. If Wine just waits on no-more-pads, it risks a deadlock if an error is signaled after gst_element_get_state was called. Signed-off-by: 's avatarGiovanni Mascellani <gmascellani@codeweavers.com> Signed-off-by: 's avatarZebediah Figura <z.figura12@gmail.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent e0238b6c
......@@ -1648,6 +1648,7 @@ static BOOL decodebin_parser_init_gst(struct parser *filter)
{
GstElement *element = gst_element_factory_make("decodebin", NULL);
unsigned int i;
HANDLE events[2];
int ret;
if (!element)
......@@ -1681,15 +1682,19 @@ static BOOL decodebin_parser_init_gst(struct parser *filter)
return FALSE;
}
WaitForSingleObject(filter->no_more_pads_event, INFINITE);
events[0] = filter->no_more_pads_event;
events[1] = filter->error_event;
if (WaitForMultipleObjects(2, events, FALSE, INFINITE))
return FALSE;
for (i = 0; i < filter->source_count; ++i)
{
struct parser_source *pin = filter->sources[i];
const HANDLE events[2] = {pin->caps_event, filter->error_event};
pin->seek.llDuration = pin->seek.llStop = query_duration(pin->their_src);
pin->seek.llCurrent = 0;
events[0] = pin->caps_event;
events[1] = filter->error_event;
if (WaitForMultipleObjects(2, events, FALSE, INFINITE))
return FALSE;
}
......@@ -2470,6 +2475,7 @@ static BOOL avi_splitter_init_gst(struct parser *filter)
{
GstElement *element = gst_element_factory_make("avidemux", NULL);
unsigned int i;
HANDLE events[2];
int ret;
if (!element)
......@@ -2502,15 +2508,19 @@ static BOOL avi_splitter_init_gst(struct parser *filter)
return FALSE;
}
WaitForSingleObject(filter->no_more_pads_event, INFINITE);
events[0] = filter->no_more_pads_event;
events[1] = filter->error_event;
if (WaitForMultipleObjects(2, events, FALSE, INFINITE))
return FALSE;
for (i = 0; i < filter->source_count; ++i)
{
struct parser_source *pin = filter->sources[i];
const HANDLE events[2] = {pin->caps_event, filter->error_event};
pin->seek.llDuration = pin->seek.llStop = query_duration(pin->their_src);
pin->seek.llCurrent = 0;
events[0] = pin->caps_event;
events[1] = filter->error_event;
if (WaitForMultipleObjects(2, events, FALSE, INFINITE))
return FALSE;
}
......
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