summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorEdward Hervey <edward@centricular.com>2017-08-07 12:24:37 +0200
committerEdward Hervey <bilboed@bilboed.com>2017-08-07 15:20:55 +0200
commit4312119d167405f726c39ec5517d7124e1e99444 (patch)
tree5a4ad3e9ebb7aeb2ecef80257894503a6b3ca151 /plugins
parent3af87f437eac21660744033999866553473d7906 (diff)
queue2: Handle buffering levels on NOT_LINKED
When downstream returns NOT_LINKED, we return the buffering level as being 100%. Since the queue is no longer being consumed/used downstream, we want applications to essentially "ignore" this queue for buffering purposes. If other streams are still being used, those stream buffering levels will be used. If none are used, upstream will post an error message on the bus indicating no streams are used. https://bugzilla.gnome.org/show_bug.cgi?id=785799
Diffstat (limited to 'plugins')
-rw-r--r--plugins/elements/gstqueue2.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/plugins/elements/gstqueue2.c b/plugins/elements/gstqueue2.c
index 8d9283870..fab140246 100644
--- a/plugins/elements/gstqueue2.c
+++ b/plugins/elements/gstqueue2.c
@@ -958,11 +958,11 @@ get_buffering_level (GstQueue2 * queue, gboolean * is_buffering,
#define GET_BUFFER_LEVEL_FOR_QUANTITY(format,alt_max) \
normalize_to_buffering_level (queue->cur_level.format,queue->max_level.format,(alt_max))
- if (queue->is_eos) {
- /* on EOS we are always 100% full, we set the var here so that it we can
- * reuse the logic below to stop buffering */
+ if (queue->is_eos || queue->srcresult == GST_FLOW_NOT_LINKED) {
+ /* on EOS and NOT_LINKED we are always 100% full, we set the var
+ * here so that we can reuse the logic below to stop buffering */
buflevel = MAX_BUFFERING_LEVEL;
- GST_LOG_OBJECT (queue, "we are EOS");
+ GST_LOG_OBJECT (queue, "we are %s", queue->is_eos ? "EOS" : "NOT_LINKED");
} else {
GST_LOG_OBJECT (queue,
"Cur level bytes/time/buffers %u/%" GST_TIME_FORMAT "/%u",
@@ -3064,6 +3064,12 @@ out_flushing:
GST_QUEUE2_MUTEX_UNLOCK (queue);
GST_CAT_LOG_OBJECT (queue_dataflow, queue,
"pause task, reason: %s", gst_flow_get_name (queue->srcresult));
+ /* Recalculate buffering levels before stopping since the source flow
+ * might cause a different buffering level (like NOT_LINKED making
+ * the queue appear as full) */
+ if (queue->use_buffering)
+ update_buffering (queue);
+ gst_queue2_post_buffering (queue);
/* let app know about us giving up if upstream is not expected to do so */
/* EOS is already taken care of elsewhere */
if (eos && (ret == GST_FLOW_NOT_LINKED || ret < GST_FLOW_EOS)) {