From 26fb72cf6577494fed4c00ecba2ad4d746d0caf5 Mon Sep 17 00:00:00 2001 From: Philippe Normand Date: Thu, 28 Mar 2013 14:21:41 +0100 Subject: [PATCH] uridecodebin: query bandwidth capability to source element Use a scheduling query to check if the source element has some bandwidth limitations. If this is the case on-disk buffering might be used. If the source element doesn't handle the scheduling query then fallback to checking the URI protocol against the hardcoded list of protocols known to handle buffering already. Fixes bug 693484. --- gst/playback/gsturidecodebin.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/gst/playback/gsturidecodebin.c b/gst/playback/gsturidecodebin.c index b039db646d..34468dc165 100644 --- a/gst/playback/gsturidecodebin.c +++ b/gst/playback/gsturidecodebin.c @@ -1253,6 +1253,8 @@ gen_source_element (GstURIDecodeBin * decoder) GObjectClass *source_class; GstElement *source; GParamSpec *pspec; + GstQuery *query; + GstSchedulingFlags flags; if (!decoder->uri) goto no_uri; @@ -1272,7 +1274,14 @@ gen_source_element (GstURIDecodeBin * decoder) GST_LOG_OBJECT (decoder, "found source type %s", G_OBJECT_TYPE_NAME (source)); - decoder->is_stream = IS_STREAM_URI (decoder->uri); + query = gst_query_new_scheduling (); + if (gst_element_query (source, query)) { + gst_query_parse_scheduling (query, &flags, NULL, NULL, NULL); + decoder->is_stream = flags & GST_SCHEDULING_FLAG_BANDWIDTH_LIMITED; + } else + decoder->is_stream = IS_STREAM_URI (decoder->uri); + gst_query_unref (query); + GST_LOG_OBJECT (decoder, "source is stream: %d", decoder->is_stream); decoder->need_queue = IS_QUEUE_URI (decoder->uri);