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.
This commit is contained in:
Philippe Normand 2013-03-28 14:21:41 +01:00 committed by Sebastian Dröge
parent dbbcdf901c
commit 26fb72cf65

View file

@ -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);