Commit graph

1811 commits

Author SHA1 Message Date
Nicolas Dufresne
a8ee76bd30 doc: Remove obsolete Since 0.10.X marks 2018-02-14 14:39:32 -05:00
Philippe Normand
22a6287b8e playbin3: fix source-setup signal emission
Previous code would pass 0 as source element.
2018-02-14 10:23:03 +00:00
Edward Hervey
eacb7a77d2 playbin3: Re-enable buffering message handling
Buffering messages are only sent for the active group (in case there
is more than one).

If the inactive group posts buffering messages we keep the last one
around and will post it once it becomes the playing one.
2018-02-10 15:43:54 +01:00
François Laignel
ec7d81f67c decodebin3: high cpu usage after eos
After eos, decodebin3 enters a loop sending eos events which causes high cpu usage.

https://bugzilla.gnome.org/show_bug.cgi?id=792693
2018-02-10 13:37:27 +01:00
Edward Hervey
1f792ab89d decodebin3: Handle dual-output of STREAM_START/EOS
In order to flush out multiqueue, we send again a STREAM_START and
then a EOS event.

The problem was that was that we might end up pushing out on the
output of multiqueue (and therefore decodebin3) a series of:
* EOS / STREAM_START / EOS

Apart from the uglyness of such output, If decodebin3 is used with
elements such as concat on their output, they might potentially
block on that second STREAM_START.

In order to make sure we don't end up in that situation we send
a custom STREAM_START event when refreshing multiqueue (which we
drop on the output) and we don't special case EOS events on streams
on which we already got EOS.

At worst we now end up sending at most two EOS on the output of
multiqueue (and decodebin3).
2018-02-10 12:24:10 +01:00
Edward Hervey
c1e902a084 playbin3: Implement gapless playback
Similar in vein to the playbin2 architecture except that uridecodebin3
are prerolled much earlier and all streams of the same type are
fed through a 'concat' element.

This keeps the philosphy of having all elements connected as soon
as possible.

The 'about-to-finish' signal is emitted whenever one of the uridecodebin
is about to finish, allowing the users to set the next uri/suburi.

The notion of a group being active has changed. It now means that the
uridecodebin3 has been activated, but doesn't mean it is the one
currently being outputted by the sinks (i.e. curr_group and next_group).
This is done via detecting GST_MESSAGE_STREAM_START emission by playsink
and figuring out which group is really playing.

When the current group changes, a new thread is started to deactivate
the previous one and optionnaly fire 'about-to-finish'.
2018-02-10 12:24:10 +01:00
Edward Hervey
b9e73d0575 playbin3: Use uridecodebin3 and link/reconfigure immediately
Apologies for the big commit, but it wasn't really possible to split it
in anything smaller.

* Switch to uridecodebin3 instead of managing urisourcebin and decodebin3
ourselves. No major architectural change with this.

* Reconfigure sinks/outputs when needed. This is possible thanks to the
various streams-related API. Instead of blocking new pads and waiting
for a (fake) no-more-pads to decide what to connect, we instead reconfigure
playsink and the combiners to whatever types are currently selected. All of
this is done in reconfigure_output().
  New pads are immediately connected to (combiners and) sinks, allowing
immediate negotiation and usage.

* Since elements are always connected, the "cached-duration" feature is gone
and queries can reach the target elements.

* The auto-plugging related code is currently disabled entirely until
we get the new proper API.

* Store collections at the GstSourceGroup level and not globally

* And more comments a bit everywhere

NOTE: gapless is still not functional, but this opens the way to be able
to handle it in a streams-aware fashion (where several uridecodebin3 can
be active at the same time).
2018-02-10 12:24:09 +01:00
Edward Hervey
ebf138e29e urisourcebin: Add 'about-to-finish' signal
With push-based sources, urisourcebin will emit this signal when
the stream has been fully consumed.

This signal can be used to know when the source is done providing
data.
2018-02-10 12:24:09 +01:00
Edward Hervey
08044ab7e6 playback: New uridecodebin3 element
In the same vein as old uridecodebin except that it also
accepts a suburi and uses urisourcebin and decodebin3 internally
2018-02-10 12:24:09 +01:00
Edward Hervey
2858400608 playbin3: Remove wrong 'notify'
Those properties doesn't exist on playbin3, don't emit a notify for that
2018-02-10 12:17:39 +01:00
Edward Hervey
8386ea706f playbin3: Remove setting 'subtitle-encoding' on decodebin
That property doesn't exist
2018-02-10 12:17:39 +01:00
Edward Hervey
7b8cfb9e53 playbin3: Clarify documentation of combiner properties 2018-02-10 12:17:39 +01:00
Edward Hervey
4ed0708f78 playbin3: Remove unused define 2018-02-10 12:17:39 +01:00
Edward Hervey
9e7401bedf decodebin3: Use GST_GROUP_ID_INVALID 2018-02-10 12:17:39 +01:00
Edward Hervey
dd7a1407a4 decodebin3: Don't forward already-handling SELECT_STREAMS
Upstream might respond negatively to the event, whereas we actually
handled it.
2018-02-10 12:17:38 +01:00
Edward Hervey
401cadfd74 decodebin3: Add new about-to-finish signal 2018-02-10 12:17:38 +01:00
Edward Hervey
c136acf27a decodebin3: Remove unused definition 2018-02-10 12:17:38 +01:00
Edward Hervey
fa710a59aa decodebin3: Don't take the lock when creating a new input
We only need to take the input lock when adding/removing
inputs from the list.
2018-02-10 12:17:38 +01:00
Edward Hervey
fa9adbe986 playbin3: Remove unused variable
The lock is never used
2018-02-10 12:17:38 +01:00
Edward Hervey
1717e33da5 urisourcebin: Remove auto-plugging signals
They were never used and we need a better system
2018-02-10 12:17:36 +01:00
Edward Hervey
e5157ca400 urisourcebin: Remove ASYNC behaviour
It is not needed in the new streams-aware world
2018-02-10 12:16:09 +01:00
Edward Hervey
f4035e430a urisourcebin: Remove 'unknown-type' signal
It was never used and makes no sense in the new streams-based world
2018-02-10 12:16:09 +01:00
Edward Hervey
0f51dde728 playbin3: Disable autoplug-related code
The signals were never emitted from decodebin3. This needs
switching to a new signalling system
2018-02-10 12:16:09 +01:00
Edward Hervey
29f57e23c7 playbin3: fix "no-more-pads" handling
That signal is never emitted by decodebin3 and is handled differently
2018-02-10 12:14:47 +01:00
Edward Hervey
9f1063e4a3 playbin3: Remove duration caching
This is now handled directly via sinks and queries through pads
2018-02-10 12:14:47 +01:00
Edward Hervey
fc93302087 parsebin: Remove async behaviour
There's no reason to do async changing
2018-02-10 12:14:17 +01:00
Ashish Kumar
b927d60371 playback-utils: Fix caps leak on failure
https://bugzilla.gnome.org/show_bug.cgi?id=789358
2018-01-17 12:18:41 +00:00
Dongil Park
a8a5905ec6 playbin3: Fix accessing invalid index in GstStream when received select-stream event
If select-stream event was send to playbin3 as missing any GstStream of ES type
(V or A or TEX) of collection then, playbin will access to invalid address of
GstStream due to invalid index limit. This caused SIGSEGV.

https://bugzilla.gnome.org/show_bug.cgi?id=791638
2017-12-15 09:03:12 +01:00
Jun Xie
f88b20397f decodebin: Fix typo in docs
https://bugzilla.gnome.org/show_bug.cgi?id=791058
2017-12-01 10:03:40 +02:00
Edward Hervey
f2f87d220f urisourcebin: Don't leak mutexes 2017-11-25 12:45:03 +01:00
Edward Hervey
38c835ec1e decodebin2: Don't spawn threads on shutdown
If we are shutting down, don't spawn a cleanup thread to cleanup old
groups and instead queue them to be cleaned up in the state change
thread.

This avoids (hopefully for good) having a race between the state change
thread and other threads trying to deactivate elements/pads.
2017-11-16 18:22:20 +01:00
Edward Hervey
e72aa501b0 decodebin2: Avoid deactivation races
Deactivating pads from two threads isn't 100% MT-safe. There is a
slim chance that the GstPadActivateFunc might be called twice with
the same values (in this case from the cleanup thread *and* from
the GstElement change_state function when going from PAUSED to READY).

In order to avoid that, call any existing cleanup function *before*
calling the parent change_state implementation on downwards state
changes.
2017-11-16 06:44:10 +01:00
Edward Hervey
ce8f51e30e decodebin2: Don't try to add pads when shutting down
Be even more agressive than before and just hold the DYN lock when/if
adding pads and return if we are shutting down.
2017-11-14 13:40:50 +01:00
Edward Hervey
77e5a71a15 decodebin2: Don't take locks when deactivating pads
When deactivating pads, we need to ensure that the streaming threads
going through the pads we wish to deactivate can cleanly return.
Failure to do that would result in the streaming locks of those
pads never being released. The end result would be a deadlock
when stopping decodebin2.

In order to avoid that situation, release the "dyn" lock around
the deactivation code. And refactor the code to cope with the
list of blocked pads having potentially changed when re-acquiring
the lock.
2017-11-14 13:40:48 +01:00
Edward Hervey
6280547be7 playbin3: Remove unneeded blacklisting
Blacklisted mimetypes have been empty in almost 10 years ...
2017-11-10 17:22:36 +01:00
Edward Hervey
cd508aff97 playbin3: Remove context caching
This is now handled by the GstBin baseclass
2017-11-10 17:22:22 +01:00
Edward Hervey
3dd0888d1e playbin3: Remove source property
And instead use the "setup-source" signal. This opens the way to deal
with more than one 'source' for a given playlist entry
2017-11-10 17:06:46 +01:00
Edward Hervey
35a8d42724 parsebin: Don't let thread run after unref
We have a dedicated one-shot thread to handle cleanup of old groups.

While this is a good idea. It's an even better idea to make sure
that thread is *completed* before the parsebin element to which
it is related isn't freed/gone.

* There can only be one cleanup thread happening at any point in time.
  If there is already one, we wait for the previous one to finish.
* When shutting down (NULL=>READY) make sure the thread is finished

https://bugzilla.gnome.org/show_bug.cgi?id=790007
2017-11-10 17:06:45 +01:00
Edward Hervey
43b9bcbddb decodebin2: Don't let thread run after unref
We have a dedicated one-shot thread to handle cleanup of old groups.

While this is a good idea. It's an even better idea to make sure
that thread is *completed* before the decodebin2 element to which
it is related isn't freed/gone.

* There can only be one cleanup thread happening at any point in time.
  If there is already one, we wait for the previous one to finish.
* When shutting down (NULL=>READY) make sure the thread is finished

https://bugzilla.gnome.org/show_bug.cgi?id=790007
2017-11-10 17:06:10 +01:00
Edward Hervey
d53ccfd8e5 parsebin: Check for shutdown before exposing pads
We already checked previously, but we need to do it before adding
pads.
2017-11-10 17:06:10 +01:00
Edward Hervey
92e8876844 parsebin: Emit 'drained' only for the top-level chain
Instead of emitting 'drained' whenever every single chain is drained
(which would result in plenty of signal emission, and would also
occur when switching groups), only emit it when the top-level chain
is drained.

Furthermore, mark unknown (and therefore unexposed) pads as drained
since we'll never get EOS on them.

https://bugzilla.gnome.org/show_bug.cgi?id=787367
2017-11-10 10:05:26 +01:00
shakin chou
2ec51ef998 playbin: Don't ref_sink() the sinks twice
Since we're already sunk floating reference, we shouldn't call ref_sink
again, which increases the ref_count and cause leaks.

https://bugzilla.gnome.org/show_bug.cgi?id=789547
2017-11-07 10:32:34 +02:00
Edward Hervey
f448cecceb decodebin2: Recheck shutdown behaviour in error case
If we can expose the main chain, recheck whether we are shutting
down or not.

decodebin2 might have been set to READY/NULL during the attempt
to expose, which would cause it to fail ... but it is not a fatal
issue.
2017-11-02 07:55:16 +01:00
Seungha Yang
466cbef6ab decodebin3: Allow configure output stream without reassign slot
By select-streams event, current implementation of decodebin3
supports deactivate output stream (i.e., decoder element)
in reassign slot(), but cannot activate any slot without track change.

https://bugzilla.gnome.org/show_bug.cgi?id=778015
2017-10-27 09:55:59 +02:00
Seungha Yang
969ab3f48c playbin3: Use STREAMS_SELECTED message to update selected stream types
Application might choose only specific type among all available types
using select-streams event. In this case, it is desired that reconfigure
of playsink to clear unused stream path.

https://bugzilla.gnome.org/show_bug.cgi?id=778015
2017-10-27 09:55:59 +02:00
Reynaldo H. Verdejo Pinochet
e81c334ca9 Use proper GtkDoc notation for NULL/FALSE/TRUE 2017-10-03 14:31:18 -07:00
Mark Nauwelaerts
2372894c63 playbin: ref_sink() sink rather than pointer to sink 2017-08-20 12:25:29 +02:00
Edward Hervey
ce65017d03 decodebin3/urisourcebin: Switch to actual EOS events internally
Use the intended sequence for re-using elements:
* EOS
* STREAM_START if element is to be re-used

This avoids having elements (such as queue/multiqueue/queue2) not
properly resetting themselves.

When delaying EOS propagation (because we want to wait until all
streams of a group are done for example), we re-trigger them by
first sending the cached STREAM_START and then EOS (which will
cause elements to re-set themselves if needed and accept new
buffers/events).

https://bugzilla.gnome.org/show_bug.cgi?id=785951
2017-08-11 11:23:29 +03:00
Sebastian Dröge
b4899a5a65 playbin: Make sure to ref_sink() any sinks before calling activate_sink()
It is forwarding messages to the playbin bus, thus forwarding messages
that contain a floating reference to the application. This generally
makes bindings unhappy, we must not leak floating references to them.
2017-08-07 15:27:45 +03:00
Seungha Yang
bf32c0b3b0 decodebin3: Remove FIXME and do remove_input_stream() only for the corresponding parsebin
Do not remove other parsebin's input streams. It will cause unexpected
removal of any input streams in multi-parsebin use case.

Basically, the purpose of blocking buffers is similar to checking
no-more-pads of chain/group. That is, it gives hint to know the timing
to remove old (EOSed) streams of the parsebin and to add/reuse slots
for new input streams. But, that doesn't mean that we need to remove
other parsebin's EOSed stream. Each parsebin has most likely its
own streaming thread and therefore EOSed time can be much different.
(i.e., much early EOS of subtitle only parsebin)

https://bugzilla.gnome.org/show_bug.cgi?id=785120
2017-07-19 17:13:20 +02:00