Otherwise the push_data() thread will run and try to use resources we never allocated.
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/winegstreamer/gstdemux.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/dlls/winegstreamer/gstdemux.c b/dlls/winegstreamer/gstdemux.c index a19c64f..ea61ed5 100644 --- a/dlls/winegstreamer/gstdemux.c +++ b/dlls/winegstreamer/gstdemux.c @@ -1103,7 +1103,6 @@ static void unknown_type(GstElement *bin, GstPad *pad, GstCaps *caps, gpointer u static HRESULT GST_Connect(GSTInPin *pPin, IPin *pConnectPin, ALLOCATOR_PROPERTIES *props) { GSTImpl *This = (GSTImpl*)pPin->pin.pinInfo.pFilter; - HRESULT hr; int ret, i; LONGLONG avail, duration; GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE( @@ -1165,7 +1164,7 @@ static HRESULT GST_Connect(GSTInPin *pPin, IPin *pConnectPin, ALLOCATOR_PROPERTI
if (!This->cStreams) { FIXME("GStreamer could not find any streams\n"); - hr = E_FAIL; + return E_FAIL; } else { gst_pad_query_duration(This->ppPins[0]->their_src, GST_FORMAT_TIME, &duration); for (i = 0; i < This->cStreams; ++i) { @@ -1175,7 +1174,6 @@ static HRESULT GST_Connect(GSTInPin *pPin, IPin *pConnectPin, ALLOCATOR_PROPERTI This->ppPins[i]->seek.dwCapabilities = 0; WaitForSingleObject(This->ppPins[i]->caps_event, -1); } - hr = S_OK; } *props = This->props;
@@ -1191,7 +1189,7 @@ static HRESULT GST_Connect(GSTInPin *pPin, IPin *pConnectPin, ALLOCATOR_PROPERTI gst_pad_set_active(This->my_src, 1);
This->nextofs = This->nextpullofs = 0; - return hr; + return S_OK; }
static inline GSTOutPin *impl_from_IMediaSeeking( IMediaSeeking *iface )
Especially since pads might be exposed before failure is reported.
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/winegstreamer/gstdemux.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/winegstreamer/gstdemux.c b/dlls/winegstreamer/gstdemux.c index ea61ed5..0fee556 100644 --- a/dlls/winegstreamer/gstdemux.c +++ b/dlls/winegstreamer/gstdemux.c @@ -1160,10 +1160,10 @@ static HRESULT GST_Connect(GSTInPin *pPin, IPin *pConnectPin, ALLOCATOR_PROPERTI ResetEvent(This->event); gst_element_set_state(This->container, GST_STATE_PLAYING); WaitForSingleObject(This->event, -1); - gst_element_get_state(This->container, NULL, NULL, -1); + ret = gst_element_get_state(This->container, NULL, NULL, -1);
- if (!This->cStreams) { - FIXME("GStreamer could not find any streams\n"); + if (ret == GST_STATE_CHANGE_FAILURE) { + ERR("GStreamer failed to play stream\n"); return E_FAIL; } else { gst_pad_query_duration(This->ppPins[0]->their_src, GST_FORMAT_TIME, &duration);
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/winegstreamer/gstdemux.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/winegstreamer/gstdemux.c b/dlls/winegstreamer/gstdemux.c index 0fee556..ebc9918 100644 --- a/dlls/winegstreamer/gstdemux.c +++ b/dlls/winegstreamer/gstdemux.c @@ -1081,7 +1081,6 @@ static GstBusSyncReply watch_bus(GstBus *bus, GstMessage *msg, gpointer data) gst_message_parse_error(msg, &err, &dbg_info); FIXME("%s: %s\n", GST_OBJECT_NAME(msg->src), err->message); WARN("%s\n", dbg_info); - SetEvent(This->event); } else if (GST_MESSAGE_TYPE(msg) & GST_MESSAGE_WARNING) { gst_message_parse_warning(msg, &err, &dbg_info); WARN("%s: %s\n", GST_OBJECT_NAME(msg->src), err->message); @@ -1159,13 +1158,14 @@ static HRESULT GST_Connect(GSTInPin *pPin, IPin *pConnectPin, ALLOCATOR_PROPERTI This->initial = This->discont = TRUE; ResetEvent(This->event); gst_element_set_state(This->container, GST_STATE_PLAYING); - WaitForSingleObject(This->event, -1); ret = gst_element_get_state(This->container, NULL, NULL, -1);
if (ret == GST_STATE_CHANGE_FAILURE) { ERR("GStreamer failed to play stream\n"); return E_FAIL; } else { + WaitForSingleObject(This->event, INFINITE); + gst_pad_query_duration(This->ppPins[0]->their_src, GST_FORMAT_TIME, &duration); for (i = 0; i < This->cStreams; ++i) { This->ppPins[i]->seek.llDuration = This->ppPins[i]->seek.llStop = duration / 100;
Source pads can be created asynchronously, so they might not be created until during the call to gst_element_set_state(). Therefore don't copy This->ppPins into a local variable.
This condition can be triggered by failing to demux a stream.
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/winegstreamer/gstdemux.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/dlls/winegstreamer/gstdemux.c b/dlls/winegstreamer/gstdemux.c index ebc9918..8e3783e 100644 --- a/dlls/winegstreamer/gstdemux.c +++ b/dlls/winegstreamer/gstdemux.c @@ -1911,7 +1911,6 @@ static HRESULT GST_RemoveOutputPins(GSTImpl *This) { HRESULT hr; ULONG i; - GSTOutPin **ppOldPins = This->ppPins;
TRACE("(%p)\n", This); mark_wine_thread(); @@ -1925,17 +1924,17 @@ static HRESULT GST_RemoveOutputPins(GSTImpl *This) This->my_src = This->their_sink = NULL;
for (i = 0; i < This->cStreams; i++) { - hr = BaseOutputPinImpl_BreakConnect(&ppOldPins[i]->pin); + hr = BaseOutputPinImpl_BreakConnect(&This->ppPins[i]->pin); TRACE("Disconnect: %08x\n", hr); - IPin_Release(&ppOldPins[i]->pin.pin.IPin_iface); + IPin_Release(&This->ppPins[i]->pin.pin.IPin_iface); } This->cStreams = 0; + CoTaskMemFree(This->ppPins); This->ppPins = NULL; gst_element_set_bus(This->container, NULL); gst_object_unref(This->container); This->container = NULL; BaseFilterImpl_IncrementPinVersion(&This->filter); - CoTaskMemFree(ppOldPins); return S_OK; }
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/winegstreamer/gstdemux.c | 8 ++++---- dlls/winegstreamer/gsttffilter.c | 4 ++-- dlls/winegstreamer/main.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/dlls/winegstreamer/gstdemux.c b/dlls/winegstreamer/gstdemux.c index 8e3783e..8a05bd7 100644 --- a/dlls/winegstreamer/gstdemux.c +++ b/dlls/winegstreamer/gstdemux.c @@ -1079,8 +1079,8 @@ static GstBusSyncReply watch_bus(GstBus *bus, GstMessage *msg, gpointer data)
if (GST_MESSAGE_TYPE(msg) & GST_MESSAGE_ERROR) { gst_message_parse_error(msg, &err, &dbg_info); - FIXME("%s: %s\n", GST_OBJECT_NAME(msg->src), err->message); - WARN("%s\n", dbg_info); + ERR("%s: %s\n", GST_OBJECT_NAME(msg->src), err->message); + ERR("%s\n", dbg_info); } else if (GST_MESSAGE_TYPE(msg) & GST_MESSAGE_WARNING) { gst_message_parse_warning(msg, &err, &dbg_info); WARN("%s: %s\n", GST_OBJECT_NAME(msg->src), err->message); @@ -1095,7 +1095,7 @@ static GstBusSyncReply watch_bus(GstBus *bus, GstMessage *msg, gpointer data) static void unknown_type(GstElement *bin, GstPad *pad, GstCaps *caps, gpointer user) { gchar *strcaps = gst_caps_to_string(caps); - FIXME("Could not find a filter for caps: %s\n", strcaps); + ERR("Could not find a filter for caps: %s\n", strcaps); g_free(strcaps); }
@@ -1126,7 +1126,7 @@ static HRESULT GST_Connect(GSTInPin *pPin, IPin *pConnectPin, ALLOCATOR_PROPERTI
gstfilter = gst_element_factory_make("decodebin", NULL); if (!gstfilter) { - FIXME("Could not make source filter, are gstreamer-plugins-* installed for %u bits?\n", + ERR("Could not make source filter, are gstreamer-plugins-* installed for %u bits?\n", 8 * (int)sizeof(void*)); return E_FAIL; } diff --git a/dlls/winegstreamer/gsttffilter.c b/dlls/winegstreamer/gsttffilter.c index 401a92f..29e679b 100644 --- a/dlls/winegstreamer/gsttffilter.c +++ b/dlls/winegstreamer/gsttffilter.c @@ -111,7 +111,7 @@ static const char *Gstreamer_FindMatch(const char *strcaps) g_list_free(copy);
if (!bestfactory) { - FIXME("Could not find plugin for %s\n", strcaps); + ERR("Could not find plugin for %s\n", strcaps); return NULL; } return gst_plugin_feature_get_name(GST_PLUGIN_FEATURE(bestfactory)); @@ -312,7 +312,7 @@ static HRESULT Gstreamer_transform_ConnectInput(GstTfImpl *This, const AM_MEDIA_
This->filter = gst_element_factory_make(This->gstreamer_name, NULL); if (!This->filter) { - FIXME("Could not make %s filter\n", This->gstreamer_name); + ERR("Could not make %s filter\n", This->gstreamer_name); return E_FAIL; } This->my_src = gst_pad_new("yuvsrc", GST_PAD_SRC); diff --git a/dlls/winegstreamer/main.c b/dlls/winegstreamer/main.c index 2bb69f4..dc988cf 100644 --- a/dlls/winegstreamer/main.c +++ b/dlls/winegstreamer/main.c @@ -276,7 +276,7 @@ DWORD Gstreamer_init(void) inited = gst_init_check(&argc, &argv, &err); HeapFree(GetProcessHeap(), 0, argv); if (err) { - FIXME("Failed to initialize gstreamer: %s\n", err->message); + ERR("Failed to initialize gstreamer: %s\n", err->message); g_error_free(err); } if (inited) {
On Tue, Feb 20, 2018 at 08:12:58PM -0600, Zebediah Figura wrote:
diff --git a/dlls/winegstreamer/gstdemux.c b/dlls/winegstreamer/gstdemux.c index a19c64f..ea61ed5 100644 --- a/dlls/winegstreamer/gstdemux.c +++ b/dlls/winegstreamer/gstdemux.c @@ -1165,7 +1164,7 @@ static HRESULT GST_Connect(GSTInPin *pPin, IPin *pConnectPin, ALLOCATOR_PROPERTI
if (!This->cStreams) { FIXME("GStreamer could not find any streams\n");
hr = E_FAIL;
} else { gst_pad_query_duration(This->ppPins[0]->their_src, GST_FORMAT_TIME, &duration); for (i = 0; i < This->cStreams; ++i) {return E_FAIL;
Would you mind removing the now-redundant else here? All of the other patches look good to me.
Thanks, Andrew
On 22/02/18 08:18, Andrew Eikum wrote:
On Tue, Feb 20, 2018 at 08:12:58PM -0600, Zebediah Figura wrote:
diff --git a/dlls/winegstreamer/gstdemux.c b/dlls/winegstreamer/gstdemux.c index a19c64f..ea61ed5 100644 --- a/dlls/winegstreamer/gstdemux.c +++ b/dlls/winegstreamer/gstdemux.c @@ -1165,7 +1164,7 @@ static HRESULT GST_Connect(GSTInPin *pPin, IPin *pConnectPin, ALLOCATOR_PROPERTI
if (!This->cStreams) { FIXME("GStreamer could not find any streams\n");
hr = E_FAIL;
} else { gst_pad_query_duration(This->ppPins[0]->their_src, GST_FORMAT_TIME, &duration); for (i = 0; i < This->cStreams; ++i) {return E_FAIL;
Would you mind removing the now-redundant else here? All of the other patches look good to me.
Thanks, Andrew
Thanks, resent.