Commit graph

319 commits

Author SHA1 Message Date
Sebastian Dröge 22a138b716 decodebin: Initialize local variables for every retry 2014-08-25 21:01:16 +03:00
Sebastian Dröge 21e9f84486 decodebin: Remove error case that resulted in two error messages
We already send one in gst_decode_bin_expose() for this case. Only
if we're unable to typefind the caps another error message is needed.
2014-08-25 21:01:16 +03:00
Thiago Santos 14d79a3a47 decodebin: handle group switching for deadend group
Gracefully handle switching groups that all pads are deadend.

This can happen when quickly switching programs on mpegts as the
output is unaligned it can happen that not enough data was accumulated at
parsers to generate any buffers, causing the stream to receive EOS before
any data can be decoded.

To handle this scenario, the _expose function now also gets if there is
any next group to be exposed along with the list of endpads. If there are
no endpads and there is another group to expose it will switch to this next
group and then retry exposing the streams.

Also, the requirement to only switch from the chain that has the endpad had
to be modified to care for when the drainpad is NULL

https://bugzilla.gnome.org/show_bug.cgi?id=733169
2014-08-13 18:51:37 +03:00
Thiago Santos 9c09c8ae17 decodebin: consider all deadend pads as drained
Otherwise when switching out a group with a deadend pad it will block
as it would be waiting for EOS on a deadend that already got one

https://bugzilla.gnome.org/show_bug.cgi?id=733169
2014-08-13 18:51:37 +03:00
Sebastian Dröge 59fb749ef6 decodebin: Remove buffering special casing for adaptive streaming demuxers
They output smaller buffers now and we should be able to handle the buffering
limits like in every other situation now.
2014-08-11 10:57:43 +02:00
Thiago Santos cf50b45ff6 decodebin: add missing 'time' word to debug message
It prints the buffers, bytes and time limits, but 'time' was missing
from the string.
2014-07-29 15:55:27 -03:00
Sebastian Dröge f173fa15b1 decodebin: Don't unref caps for which we don't own a reference... get one first
https://bugzilla.gnome.org/show_bug.cgi?id=733615
2014-07-23 19:51:36 +02:00
Sebastian Dröge b15a47aa19 decodebin: Link Parser/Converter directly and already connect to pad-added and other signals before setting elements to PAUSED
otherwise we're going to
a) start Parser/Converter before they are linked to their capsfilter,
   breaking their negotiation of a proper stream format
b) start demuxers without having connected to their pad-added signals. We
   miss pads and in the worst case don't link any pads at all
2014-07-21 09:35:36 +02:00
Sebastian Dröge 57999c28fd decodebin: Send sticky events to the new element after setting it to PAUSED
... and if this fails for whatever reason we skip the element and instead
try with the next element. This allows us to handle elements that fail
when setting caps on them by just skipping to the next alternative element.
2014-07-21 09:35:36 +02:00
Sebastian Dröge 994680b04e decodebin: Only link elements further after setting them to PAUSED
They might fail to go to PAUSED, and when connecting them further
we might already expose their srcpads on decodebin if we're unlucky.
This prevents us to handle failures going to PAUSED gracefully.
2014-07-21 09:35:36 +02:00
Sebastian Dröge 83d508a552 decodebin: Remove ERROR message filter after we set the element to PAUSED
This allows us to catch more errors gracefully and switch to an alternative
element instead.
2014-07-21 09:35:05 +02:00
Sebastian Dröge f66555668a decodebin: Only continue autoplugging once the pad has final caps
If the caps query returned us fixed caps this doesn't mean yet
that these caps are actually complete (fields might be missing).

It allows to do us some decisions, but the selection of the next
element should be delayed as only complete caps allow proper selection
of the next element.
2014-07-21 09:35:05 +02:00
Sebastian Dröge 424ff91394 decodebin: Consider the caps after the capsfilter after parsers for autoplugging
Otherwise we might try to continue autoplugging e.g. for a specific
stream-format although the parser could convert to something else, thus giving
us potentially less options for decoders.
2014-07-21 09:35:05 +02:00
Sebastian Dröge 393f090197 decodebin: Do async-done on expose errors too 2014-06-04 17:00:43 +02:00
Thiago Santos 783195ccef decodebin: aggregate buffering messages
Aggregate buffering messages to only post the lower value
to avoid setting pipeline to playing while any multiqueue
is still buffering.

There are 3 scenarios where the entries should be removed from
the list:

1) When decodebin is set to READY
2) When an element posts a 100% buffering (already implemented)
3) When a multiqueue is removed from decodebin.

For item 3 we don't need to handle it because this should only
happen when either 1 is hapenning or when it is playing a
chained file, for which number 2 should have happened for the
previous stream to finish

https://bugzilla.gnome.org/show_bug.cgi?id=726423
2014-05-29 18:59:30 -03:00
Vincent Penquerc'h 9e99a1ca41 decodebin: consider "no demuxer" case to not have dynamic pads
This fixes a possible NULL dereference.

Coverity 1195146
2014-04-10 13:51:18 +01:00
Sebastian Dröge 2c2e286c38 decodebin: In adaptive streaming mode, only have a fixed buffer limit for the non-buffering multiqueue 2014-04-09 16:06:06 +02:00
Sebastian Dröge 5e364c1d7b decodebin: Buffer up to 5 seconds in multiqueue buffering mode
2 seconds might be too small for some container formats, e.g.
MPEGTS with some video codec and AAC/ADTS audio with 700ms
long buffers. The video branch of multiqueue can run full while
the audio branch is completely empty, especially because there
are usually more queues downstream on the audio branch.
2014-03-07 17:09:24 +01:00
Sebastian Dröge 539eaf73e5 decodebin: Keep the number of buffers after an adaptive streaming demuxer lower
Usually these buffers are multiple seconds large, and having a maximum
of 5 buffers in the multiqueue there can use a lot of memory. Lower
this to 2 for adaptive streaming demuxers.
2014-03-06 22:45:30 +01:00
Sebastian Dröge 274b4eb870 decodebin: Simplify adaptive streaming demuxer code a bit 2014-03-06 22:45:30 +01:00
Sebastian Dröge 2df1e56bb7 decodebin: If we have a demuxer without dynamic srcpads, just assume no-more-pads
Otherwise we will wait until the multiqueue after the demuxer will
overrun, which is clearly not needed then.
2014-02-23 00:10:01 +01:00
Sebastian Dröge f149c27a61 decodebin: Also make sure to not duplicate an element factory after a group
If we are using an adaptive stream demuxer, which outputs a non-container
stream, we are putting another multiqueue after the *parser* following
the adaptive stream demuxer. We do not want to add another instance of
the same parser right after this multiqueue.
2014-02-23 00:10:01 +01:00
Sebastian Dröge 41117606dd decodebin: During pre-rolling always use the auto-preroll limits on multiqueues
Even if we're buffering in the multiqueues.
2014-02-23 00:10:01 +01:00
Sebastian Dröge 2d2aa02b77 decodebin: Pass through the seekability information when setting multiqueue limits 2014-02-23 00:10:01 +01:00
Sebastian Dröge db771185ed decodebin: During exposing of pads don't set the multiqueue limits multiple times to different values
Instead just set them once in the very end to the correct values.
2014-02-23 00:10:01 +01:00
Sebastian Dröge c4caeb73ce decodebin: Only enable multiqueue buffering once we're pre-rolled
Otherwise we will emit buffering messages not just from the last
multiqueue but also from previous multiqueues... confusing the
application with different percentages during pre-rolling.
2014-02-23 00:10:01 +01:00
Sebastian Dröge 4f32010916 decodebin: Make sure that we always have a second multiqueue for adaptive streaming demuxers
For adaptive streaming demuxer we insert a multiqueue after
this demuxer. This multiqueue will get one fragment per buffer.
Now for the case where we have a container stream inside these
buffers, another demuxer will be plugged and after this second
demuxer there will be a second multiqueue. This second multiqueue
will get smaller buffers and will be the one emitting buffering
messages.
If we don't have a container stream inside the fragment buffers,
we'll insert a multiqueue below right after the next element after
the adaptive streaming demuxer. This is going to be a parser or
decoder, and will output smaller buffers.
2014-02-23 00:10:00 +01:00
Alessandro Decina 6a699b6c40 decodebin: make it possible to register multiple handlers for autoplug-select
Change the way autoplug-select is accumulated so that it's possible to have
multiple handlers. The handlers keep getting called as long as they keep
returning GST_AUTOPLUG_SELECT_TRY.

One practical example of when this is needed is when hooking into playbin's
uridecodebin, which is perhaps not very elegant but the only way to influence
which streams playbin autoplugs/exposes.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=723096
2014-01-28 13:45:07 +11:00
Wim Taymans a7151d0b3e decodebin2: copy sticky events 2013-11-29 17:26:13 +01:00
Wim Taymans 65e492a403 decodebin2: activate ghost pad before targetting
Activate the decodebin2 pad before setting the target. This makes sure
that the events are copied.
2013-11-28 11:27:23 +01:00
Tim-Philipp Müller b1ff48c1a1 docs: remove old 0.10 Since markers
They're just confusing.
2013-11-16 16:10:07 +00:00
Sebastian Dröge c49531f1b7 decodebin: Let serialize queries before caps events through
Otherwise we're going to deadlock forever because no autoplugging
happens without having caps, but caps can never be send because
we're blocking.

Serialized queries before caps should never be sent unless really
necessary.
2013-06-06 15:57:49 +02:00
Sebastian Dröge 14192c031a decodebin: Don't call autoplug-query on shutdown
And remove leftover debug code
2013-05-28 13:32:23 +02:00
Sebastian Dröge e5064ee723 playbin: Refactor autoplug-query handling
We now only check sinks and factories of the corresponding media
type. It doesn't make sense to pass audio/subtitle caps to a video
decoder.
2013-05-28 13:08:00 +02:00
Sebastian Dröge d366613401 decodebin: Block on serialized queries too
Otherwise we will only block after the serialized, non-sticky event
after the CAPS event or the first buffer. If we're waiting for another
pad to finish autoplugging after we got final caps on this pad, it
will mean that we will let the ALLOCATION query pass although the
pad is not exposed yet.
2013-05-28 13:06:15 +02:00
Sebastian Dröge 9513b770f4 decodebin: Pass the element in the autoplug-query signal too 2013-05-28 12:10:33 +02:00
Sebastian Dröge 730e633d58 decodebin: Need to lock the chain mutex in autoplug_query 2013-05-28 11:40:51 +02:00
Sebastian Dröge fa7ad8743c decodebin: Lock the state of child elements as long as we manage their states
https://bugzilla.gnome.org/show_bug.cgi?id=690420
2013-05-24 13:41:46 +02:00
Sebastian Dröge be4dba23ea Revert "decodebin2: use NO_RESYNC flag"
This reverts commit 0feecef275.
2013-05-24 11:47:13 +02:00
Sebastian Dröge ca1279e4a3 decodebin: Use signal handler IDs instead of disconnecting by function
This is cleaner and faster.
2013-05-22 17:29:17 +02:00
Sebastian Dröge 504e57ccc5 decodebin: Connect and disconnect the have-type signal of typefind before starting/shutting down 2013-05-22 13:49:18 +02:00
Sebastian Dröge d802c7395a playback: Only do a subset filtering for the factories if we have fixed caps
Otherwise we're plugging a parser/converter currently and have unfixed caps.
2013-05-15 17:15:18 +02:00
Sebastian Dröge 062246fc6e decodebin: Return immediately from checking if a chain is complete if we're shutting down 2013-05-15 14:51:16 +02:00
Sebastian Dröge 83f2476976 decodebin: Hold the expose lock when freeing a chain
https://bugzilla.gnome.org/show_bug.cgi?id=700342
2013-05-15 14:47:53 +02:00
Sebastian Dröge 450a47c0a5 playback: Use subset checks instead of intersection
https://bugzilla.gnome.org/show_bug.cgi?id=700272
2013-05-14 10:07:44 +02:00
Sebastian Dröge b719dd9f89 decodebin: Expose pads when they receive EOS before any buffers
Stops decodebin from waiting forever to expose a pad if there
is never data on it.

https://bugzilla.gnome.org/show_bug.cgi?id=691072
2013-05-06 15:49:00 +02:00
Wim Taymans c5840ebbd9 decodebin2: also remove the bytes limit
Remove the byte limit for adaptive http streaming. Because some fragments might
be very big, we might need a lot of buffering. I also suspect another problem
where data is actually missing and things go out of sync somehow.
2013-04-23 11:20:28 -03:00
Wim Taymans 26c5bc1ce4 decodebin2: update buffer size in multiqueue
When we disable buffering in the more upstream multiqueue elements,
we need to also update the queue limits. In particular, the max_size_time should
be set to 0 or else we might simply deadlock.
2013-04-23 11:20:28 -03:00
Thiago Santos 5cd07bd2af decodebin2: only allow 'lower' multiqueues to emit buffering messages
When we have a scenario of demuxers linked to demuxers, decodebin2
will create multiqueue at different levels of the pipeline. The problem
is that only the lowest multiqueue's should do the buffering messaging,
as they will handle with the raw streams data.

When all multiqueues are doing buffering, the upper ones can handle
large buffers that easily fill them, moving from 0% to 100% from
buffer to buffer, causing too much buffering messages to be posted.
This hangs the pipeline unnecessarily and might lead to deadlocks.
2013-04-23 11:20:28 -03:00
Thiago Santos 6382d4c0ad decodebin2: do not handle the next-groups list as if it was a single item
Decodebin2's chains store a next_groups list that was being handled as
it could only have a single element. This is true for most of the
chaining streams scenarios where streams change not very often.

In more stressfull changing scenarios, like adaptive streams, those
changes can happen very often, and in short time intervals. This could
confuse decodebin2 as this list was always being used as a single
element list.

This patches makes it handle as a real list, using iteration instead
of picking the first element as the correct one always.
2013-04-23 10:32:19 -03:00