summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArun Raghavan <arun@centricular.com>2015-02-26 13:08:48 +0530
committerArun Raghavan <git@arunraghavan.net>2015-02-26 15:57:26 +0530
commitbe36d34aee09cc821b32c8f190841967aa23f15c (patch)
tree3f34fc3434462b69b764a73811806eafb106e9ad
parentc1d2254b23c1ca631c28ebe14dea2f0e1c9bc1a2 (diff)
pad: Don't fail latency query on unlinked pads
A single unlinked pad can make the latency query fail across the pipeline, which is probably not desirable. Instead, we return a default anything goes value. Perhaps we should also be emitting a gst_message_new_latency() when a PLAYING element has one of its pads linked. https://bugzilla.gnome.org/show_bug.cgi?id=745197
-rw-r--r--gst/gstpad.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/gst/gstpad.c b/gst/gstpad.c
index 0d284841c..12a083382 100644
--- a/gst/gstpad.c
+++ b/gst/gstpad.c
@@ -3061,13 +3061,19 @@ static gboolean
query_latency_default_fold (const GValue * item, GValue * ret,
gpointer user_data)
{
- GstPad *pad = g_value_get_object (item);
+ GstPad *pad = g_value_get_object (item), *peer;
LatencyFoldData *fold_data = user_data;
GstQuery *query;
- gboolean res;
+ gboolean res = FALSE;
query = gst_query_new_latency ();
- res = gst_pad_peer_query (pad, query);
+
+ peer = gst_pad_get_peer (pad);
+ if (peer) {
+ res = gst_pad_peer_query (pad, query);
+ } else {
+ GST_LOG_OBJECT (pad, "No peer pad found, ignoring this pad");
+ }
if (res) {
gboolean live;
@@ -3089,11 +3095,14 @@ query_latency_default_fold (const GValue * item, GValue * ret,
fold_data->live = TRUE;
}
- } else {
+ } else if (peer) {
GST_DEBUG_OBJECT (pad, "latency query failed");
g_value_set_boolean (ret, FALSE);
}
+
gst_query_unref (query);
+ if (peer)
+ gst_object_unref (peer);
return TRUE;
}