Commit graph

192 commits

Author SHA1 Message Date
Duncan Palmer 0ad06434da multiqueue: Don't automatically enter the buffering state when use-buffering is set.
There is no reason I can see to set mq->buffering = TRUE when
use_buffering is set; the code here also calls update_buffering(), which
will set mq->buffering = TRUE if this is warranted because of low buffer
levels.

https://bugzilla.gnome.org/show_bug.cgi?id=745937
2015-04-10 10:40:00 -03:00
Sebastian Dröge 5fc2a3fd66 multiqueue: Don't grow queue infinitely if only one pad is linked
This was introduced by
https://bugzilla.gnome.org/show_bug.cgi?id=719893
https://bugzilla.gnome.org/show_bug.cgi?id=722891
but it doesn't make any sense at all and causes huge memory leaks.

https://bugzilla.gnome.org/show_bug.cgi?id=744253
2015-03-15 14:19:17 +00:00
Mark Nauwelaerts c3454a85c5 multiqueue: avoid returning downstream GST_FLOW_EOS from previous segment to current upstream segment 2015-02-23 20:08:20 +01:00
Thiago Santos 5a759011a0 multiqueue: percentage is an absolute value
multiqueue's queues stored percent value is the percentage from 0
to 100 (max-size-*) and should be compared with the requested limit
(high_percentage) set by the user and not with 100% to check if
buffering should stop. Otherwise we are only stopping buffering when the
queue gets completely full.
2014-11-23 05:51:12 -03:00
Andrei Sarakeev ee93c807e1 multiqueue: Wake up any waiting streams if the current one goes EOS
Otherwise we might have unlinked streams waiting.

https://bugzilla.gnome.org/show_bug.cgi?id=738198
2014-10-20 12:31:42 +02:00
Aleix Conchillo Flaqué 41fa9ad9f2 multiqueue: don't lock multiqueue when pushing serialized queries
If we are pushing a serialized query into a queue and the queue is
filled, we will end in a deadlock. We need to release the lock before
pushing and acquire it again afterward.

https://bugzilla.gnome.org/show_bug.cgi?id=737794
2014-10-09 11:49:49 +03:00
Matej Knopp b5bf41a771 multiqueue: update segment position on GAP events to calculate levels properly
https://bugzilla.gnome.org/show_bug.cgi?id=737498
2014-10-02 10:56:03 +03:00
Thiago Santos 3f83ca9c43 multiqueue: do not post messages holding the lock
It might cause deadlocks to post messages while holding the multiqueue
lock. To avoid this a new boolean flag is set whenever a new buffering percent
is found. The message is posted after the lock can be released.

To make sure the buffering messages are posted in the right order, messages
are posted holding another lock. This prevents 2 threads trying to post
messages at the same time.

https://bugzilla.gnome.org/show_bug.cgi?id=736295
2014-09-16 16:56:53 -03:00
Tim-Philipp Müller 49c6f923de coreelements: mark properties with MUTABLE_PLAYING 2014-09-14 16:08:07 +01:00
Thibault Saunier 78e2264544 multiqueue: Not post BUFFERING message if one of the singlequeue doesn't need it
Imagine the following 'pipeline'

                --------------
            p1/| 'fullqueue'  |--- 'laggy' downstream
  ---------  / |              |
-| demuxer |   | multiqueue   |
  ---------  \ |              |
            p2\| 'emptyqueue' |--- 'fast' downstream
                --------------

In the case downstream of one single queue (fullqueue) has (a lot of) latency
(for example for reverse playback with video), we can end up having the other
SingleQueue (emptyqueue) emptied, before that fullqueue gets
unblocked. In the meantime, the demuxer tries to push on fullqueue, and
is blocking there.

In that case the current code will post a BUFFERING message on the bus when
emptyqueue gets emptied, that leads to the application setting the pipeline state to
PAUSED. So now we end up in a situation where 'laggy downstream' is
prerolled and will not unblock anymore because the pipeline is set to
PAUSED, the fullequeue does not have a chance to be emptied and
the emptyqueue can not get filled anymore so no more BUFERRING message
will be posted and the pipeline is stucked in PAUSED for the eternity.

Making sure that we do not try to "buffer" if one of the single queue
does not need buffering, prevents this situtation from happening though it lets the
oportunity for buffering in all other cases.

That implements a new logic where we need all singlequeue to need
buffering for the multiqueue to actually state buffering is needed,
taking the maximum buffering of the single queue as the reference point.

https://bugzilla.gnome.org/show_bug.cgi?id=734412
2014-08-13 18:25:12 +03:00
Sebastian Dröge 3032a369a7 multiqueue: Only handle flow returns < EOS as errors, not e.g. flushing 2014-08-13 13:01:23 +03:00
Sebastian Dröge afcc93254b multiqueue: Post errors ourselves if they are received after EOS
After EOS there will be no further buffer which could propagate the
error upstream, so nothing is going to post an error message and
the pipeline just idles around.
2014-08-13 12:10:39 +03:00
Thiago Santos 463ccd96eb multiqueue: avoid using infinite buffers limit if finite is requested
If the current max-buffers limit it infinite and a finite value is
requested, switch to the MAX (requested, current-value) to set some
limit but not below what we know that we've needed so far.

https://bugzilla.gnome.org/show_bug.cgi?id=733637

https://bugzilla.gnome.org/show_bug.cgi?id=733837
2014-07-29 15:26:51 -03:00
Thiago Santos 01c9ae2630 multiqueue: post buffering message when queues flush
The buffering status goes back to 0, so inform the application about it

https://bugzilla.gnome.org/show_bug.cgi?id=726423
2014-05-29 16:51:41 -03:00
Wim Taymans 35a1822d7a pads: update docs for request pads
We would like to encourage the use of gst_element_request_pad()
2014-05-08 09:13:04 +02:00
Thiago Santos 0a3bc6be1f multiqueue: avoid signaling overrun on the first segment
When the first segment has position != 0 and position > max-size-time
it will immediatelly cause the multiqueue to signal overrun.

This can happen easily with adaptive streams when switching bitrates
and starting a new group. The segment for this new group will have
a position that is much greater than 0 and will lead to this issue.
This is particularly harmful when the adaptive stream uses mpegts
that doesn't emit no-more-pads and it might happen that only one
of the stream pads was added when the multiqueue overruns and gets
the group ready for exposing. So the user will only get audio or
video.

The solution is to fallback to the sink segment while the source pad
has no segment.

https://bugzilla.gnome.org/show_bug.cgi?id=729124
2014-04-28 17:08:57 -03:00
Tim-Philipp Müller 6eb6d9ec38 docs: remove outdated and pointless 'Last reviewed' lines from docs
They are very confusing for people, and more often than not
also just not very accurate. Seeing 'last reviewed: 2005' in
your docs is not very confidence-inspiring. Let's just remove
those comments.
2014-04-26 21:21:51 +01:00
Sebastian Dröge eba6f7d972 multiqueue: Wake up the queues if limits are changing in a way that would unblock the queue 2014-04-09 15:57:35 +02:00
Sebastian Dröge f53f4ddca4 multiqueue: Update buffering status and maybe post buffering message right when enabling buffering 2014-03-19 09:48:45 +01:00
Tim-Philipp Müller a6cd61b86a docs: fix multiqueue docs for new template names foo_%d -> foo_%u
https://bugzilla.gnome.org/show_bug.cgi?id=726358
2014-03-14 18:40:31 +00:00
Thiago Santos 0e2f63654b multiqueue: if buffering is disabled while buffering, post 100% message
Avoids stall waiting for buffering to reach 100%
2014-03-10 09:49:05 -03:00
Thiago Santos b6470a7b3f multiqueue: do not reset last push result when pushing events
Use the last result as a default when pushing a item from a single queue,
otherwise the status gets reset to _OK when pushing events.

This causes problems when mistakenly activating a not-linked stream
that is being ignored upstream as it is not being used (adaptive
scenarios), it will make the multiqueue post a buffering message
on a pad that won't receive buffers

https://bugzilla.gnome.org/show_bug.cgi?id=725917
2014-03-10 09:48:58 -03:00
Sebastian Dröge 5737f4f367 multiqueue: If we only have a single pad, don't consider all pads not linked and grow the queue indefinitely 2014-02-20 15:35:11 +01:00
Arnaud Vrac a93615aea1 multiqueue: do not reduce single queue below current level
When the single queue size was just bumped by 1 to allow more buffers to
be added, the buffers limit could be reduced to the current level when
setting the max-size-buffers property. This would result in a stall
since the queue would not grow anymore at this point.

Prevent this by not reducing a single queue size below the current
number of buffers + 1.

https://bugzilla.gnome.org/show_bug.cgi?id=712597
2014-01-27 19:57:35 +01:00
Sebastian Dröge 454ee04a22 multiqueue: Break the loop immediately if we found an empty queue
No need to continue looking at all the others
2014-01-24 09:28:05 +01:00
Per x Johansson 4f928547a8 multiqueue: Allow growing a queue if all other queues are not linked
In the case where one singlequeue is full and all other are not linked, the
growing of the full queue does not work correctly. The result depends on if
the full queue is last in the queue list or not.

https://bugzilla.gnome.org/show_bug.cgi?id=722891
2014-01-24 09:27:28 +01:00
Thiago Santos 139c96c129 multiqueue: prevent buffering forever with playbin
When prerolling/buffering, multiqueue has its buffers limit set
to 0, this means it can take an infinite amount of buffers.

When prerolling/buffering finishes, its limit is set back to 5, but
only if the current level is lower than 5. It should (almost) never be
and this will cause prerolling/buffering to need to wait to reach the
hard bytes and time limits, which are much higher.

This can lead to a very long startup time. This patch fixes this
by setting the single queues to the max(current, new_value) instead
of simply ignoring the new value and letting it as infinite(0)

https://bugzilla.gnome.org/show_bug.cgi?id=712597
2014-01-15 09:51:35 -03:00
Sebastian Dröge c343ebd454 multiqueue: Allow growing a queue if all other queues are not linked
See https://bugzilla.gnome.org/show_bug.cgi?id=719893
2014-01-08 09:54:01 +01:00
YanpingZhang 1de533735b multiqueue: Fix hanging if shut down while handling a serialized query
https://bugzilla.gnome.org/show_bug.cgi?id=721253
2014-01-03 11:15:33 +01:00
Thiago Santos 1f71f191be multiqueue: post 100% buffering if single queue is not linked
This makes buffering stop in case a stream switch happens. This is
important for adaptive streams that can disable not-linked streams
to avoid consuming the network bandwidth.

https://bugzilla.gnome.org/show_bug.cgi?id=719575
2013-12-20 01:10:47 -03:00
Sebastian Rasmussen 53ae1b2c9c docs: Fix typos in function/object descriptions
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=720029
2013-12-07 17:11:12 +00:00
Olivier Crête a90ce304c8 multiqueue: Wake up on reconfigure event
After patch bda406c4, the state of the singlequeue was set to OK, but nothing
would then wake up the thread, as the other wakeup functions only look at
singlequeues that are marked as having received as not-linked.

https://bugzilla.gnome.org/show_bug.cgi?id=708200
2013-12-03 12:40:11 -05:00
Matej Knopp 7f657358a8 multiqueue: Don't reduce single queue visible size below its current level
If the multiqueue has automatically grown chances are good that
we will cause the pipeline to starve if the maximum level is reduced
below that automatically grown size.

https://bugzilla.gnome.org/show_bug.cgi?id=707156
2013-09-04 10:52:13 +02:00
Sebastian Dröge b40599f6db multiqueue: Clean up after the streaming thread has stopped
https://bugzilla.gnome.org/show_bug.cgi?id=705835
2013-08-19 16:38:50 +02:00
Sebastian Dröge 0dc232e114 multiqueue: only block serialized query when it's safe
We must be certain that we don't cause a deadlock when blocking the serialized
queries. One such deadlock can happen when we are buffering and downstream is
blocked in preroll and a serialized query arrives. Downstream will not unblock
(and allow our query to execute) until we complete buffering and buffering will
not complete until we can answer the query..

https://bugzilla.gnome.org/show_bug.cgi?id=702840
2013-07-16 11:36:50 +02:00
Sebastian Dröge ab6a1085ee (multi)queue: Don't access query items during flushing 2013-05-27 16:38:18 +02:00
Sebastian Dröge e472d9d261 multiqueue: Don't do serialized queries when we're flushing
Just immediately fail the query, otherwise we would wait forever
for the query to be answered.
2013-05-27 16:22:00 +02:00
Sebastian Dröge b6fac17502 queue/queue2/multiqueue: When flushing, make sure to not lose any sticky events
https://bugzilla.gnome.org/show_bug.cgi?id=688824
2013-05-27 13:01:43 +02:00
Sebastian Dröge a79d3a0220 multiqueue: Initialize all GstMultiQueueItem fields in both code paths 2013-05-24 18:42:55 +02:00
Sebastian Dröge 1c6341e6a4 multiqueue: Don't access the query after signalling the waiting thread
It might've free'd the query already.
2013-05-24 18:38:40 +02:00
Sebastian Dröge 3b44a44a01 multiqueue: Make sure to always signal any possible pending serialized queries
And don't unref them when flushing the queue, they're owned by the caller!

https://bugzilla.gnome.org/show_bug.cgi?id=700342
2013-05-24 18:30:44 +02:00
Wim Taymans fa371dad6d multiqueue: ignore empty not-linked queues
We need to ignore the not-linked queues in the underrun and overrun callbacks
because they are expected to be empty.
2013-04-05 10:15:37 +02:00
Wim Taymans bda406c42f multiqueue: start pushing again on RECONFIGURE
When we got NOT_LINKED before and we receive a RECONFIGURE event, start pushing
again on the source pad.

See https://bugzilla.gnome.org/show_bug.cgi?id=676304
2013-04-04 19:16:23 +02:00
Branko Subasic 17bff49262 multiqueue: correct overrun handling
The control of wheteher a SingleQueue is full is not correct.
Rewrote single_queue_overrun_cb() so it checks the correct variables
when checking if the queue has reached the hard limits, and to
increase the max buffer limit once for each call.

https://bugzilla.gnome.org/show_bug.cgi?id=690557
2012-12-20 15:34:01 +01:00
Tim-Philipp Müller 666c8c11c6 Fix FSF address
https://bugzilla.gnome.org/show_bug.cgi?id=687520
2012-11-03 20:44:48 +00:00
Jan Schmidt 698324d48b multiqueue: Add EOS status to debug output about filled/unfilled 2012-10-30 10:04:14 +11:00
Sebastian Dröge 09982c3c13 dataqueue/queuearray: Make public API again
These are actually used outside of coreelements nowadays.
Also hide lots of internals and add padding and documentation.
2012-10-25 14:03:01 +02:00
Josep Torra Valles 111fcc6e31 Make intel compiler happier
https://bugzilla.gnome.org/show_bug.cgi?id=552657
2012-09-25 00:56:26 +01:00
Edward Hervey d3ffa82639 Remove 0.10-related documentation and "Since" markers 2012-07-10 12:03:27 +02:00
Wim Taymans 76e8b2ecda task: add GDestroyNotify to _new
Add a GDestroyNotify to the user_data we pass to gst_task_new()
Change gst_pad_start_task() to also take the notify
2012-06-20 10:31:49 +02:00