Commit graph

1780 commits

Author SHA1 Message Date
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
Seungha Yang
abe1183c17 parsebin: Ensure StreamType and Caps of GstStream object before exposing it
The final StreamType and Caps might not be set yet on GstStream at exposing the pads.

https://bugzilla.gnome.org/show_bug.cgi?id=785120
2017-07-19 17:13:20 +02:00
Seungha Yang
7a236e2302 playbin3: Delay linking text output until video stream is shown
We are not sure that which stream's collection arrives first
when there are multiple parsebins such as adaptive streaming.

https://bugzilla.gnome.org/show_bug.cgi?id=785120
2017-07-19 17:13:20 +02:00
Edward Hervey
6ccba23752 playbin3: We only care about source pads going away 2017-07-18 13:05:06 +02:00
Edward Hervey
651a0fe312 decodebin3: use lock macro where applicable 2017-07-18 13:05:06 +02:00
Thibault Saunier
4b3798fedc decodebin3: Protect fields related to streams handling with the SELECTION_LOCK
Fields related to stream handling (input_streams,
output_streams, slots, guint slot_id) where used totally unprotected
until know.

This lead to several races, especially playing back RTSP streams.

To protect those fields, the OBJECT_LOCK can not be used as we sometimes
need to be able to post message on the bus while holding it.

decodebin3 already has a lock to manage stream selection, and in the end
it makes sense to protect all the stream management fields with the same
lock which is why we reuse the SELECTION_LOCK here.

https://bugzilla.gnome.org/show_bug.cgi?id=784012
2017-07-18 13:05:06 +02:00
Edward Hervey
1188345886 decodebin3: Protect dbin->collection usage
Use the selection lock to protect dbin->collection access

https://bugzilla.gnome.org/show_bug.cgi?id=784012
2017-07-18 11:25:53 +02:00
Seungha Yang
60cae68c4e decodebin3: Push EOS to output stream if they are all drained
decodebin3 checks input streams and pushes EOS if all input streams
are EOSed. If not, fake EOS is pushed to the corresponding slot.

When adaptivedemux is used with multi-track configuration,
adaptivedemux never ever push EOS to non-selected track
because streaming thread for the slot stops with not-linked flow return.
So, decodebin3 should generate EOS itself to finish playback.

https://bugzilla.gnome.org/show_bug.cgi?id=777735
2017-07-13 07:32:42 +02:00
Seungha Yang
fc67a689af urisourcebin: Push EOS if slot is still eos state
linked input of slot can be old input, so urisourcebin should check
eos state to figure out whether it's new one or not.
If not, urisourcebin never ever forwards EOS to downstream at the end
of presentation, because the old input is still there without removal

https://bugzilla.gnome.org/show_bug.cgi?id=777735
2017-07-13 07:32:42 +02:00
Seungha Yang
06cf7440ce decodebin3: Don't send duplicated stream-start event
group-id in stream-start event might be updated in
parse_chain_output_probe (). This cause duplicated stream-start
twice with identical stream-id and seq-num, but only group-id is
different. Although there is no change, stream-start event will
be followed by the first buffer.

https://bugzilla.gnome.org/show_bug.cgi?id=771088
2017-07-12 15:55:26 +02:00
Mathieu Duponchelle
bfba213437 uridecodebin: aggregate topology messages
This makes it possible for GstDiscoverer to work with sources that
have multiple source pads and hence will trigger the creation of multiple
decodebin instances such as rtspsrc.

Based on the work of Vineeth TM <vineeth.tm@samsung.com>

https://bugzilla.gnome.org/show_bug.cgi?id=754178
2017-07-03 20:08:55 -04:00
Thibault Saunier
7e94d2824f urisourcebin: Call do_async_done when source state change returns NO_PREROLL
Otherwise for RTSP streams for example, the pipeline will never go to
PLAYING as it will be missing an ASYNC_DONE message.

https://bugzilla.gnome.org/show_bug.cgi?id=780099
2017-06-15 14:35:06 -04:00
Sebastian Dröge
66929f8970 urisourcebin: Use downloadbuffer element
And only set low-percent/high-percent if not using downloadbuffer, just
like in old uridecodebin. using the watermark based buffering causes
playback to hang never finish buffering with downloadbuffer.
2017-06-12 10:24:43 +03:00
Sebastian Dröge
d5069d27ef Revert "decodebin2: Set a time limit on "upstream" multiqueues"
This reverts commit 07dc9ba071. It causes
timeouts in validate because queues run full before prerolling.
2017-05-31 12:30:40 +03:00
Edward Hervey
07dc9ba071 decodebin2: Set a time limit on "upstream" multiqueues
Those multiqueue are the ones dealing with adaptive demuxers. They should
have a time limit set so that they don't end up buffering too much data.

They would previously be set with no limits at all, which would cause them
to grow indefinitely until downstream blocks.
2017-05-31 10:27:19 +03:00
Sebastian Dröge
efbda07cfa urisourcebin: Unref query with gst_query_unref()
Not gst_object_unref().
2017-05-18 11:03:07 +03:00
Nicolas Dufresne
8e6c6266d7 Remove plugin specific static build option
Static and dynamic plugins now have the same interface. The standard
--enable-static/--enable-shared toggle are sufficient.
2017-05-16 13:42:07 -04:00
Vincent Penquerc'h
b97cbe678f decodebin2: fix use after free from demuxer flush pad probe
In some cases, we could get a flush-stop event after the chain structure
containing the demuxer was freed.

https://bugzilla.gnome.org/show_bug.cgi?id=782095
2017-05-03 17:37:12 +01:00
Tim-Philipp Müller
6a3640f367 playbin: minor docs fix
The "frame" property is no more, it's "sample" these days.
2017-04-28 15:54:04 +01:00
Jan Schmidt
546a99026b urisourcebin: Set removed flag when removing buffering msg
Forgot to set the flag, resulting in a missed check for
sending 100% in some cases. Spotted by Coverity.

CID: 1403263
2017-03-27 23:00:34 +11:00
Haihua Hu
6749e81ce2 streamsynchronizer: every stream need keep their own send_gap_event flag
When a clip has video audio and subtitle, if need send gap event
to audio and subtitle, we should make sure all has been sent, so
need every stream keep one send_gap_event.

https://bugzilla.gnome.org/show_bug.cgi?id=780429
2017-03-23 12:55:57 +02:00
Jan Schmidt
a0f870a215 urisourcebin: Mention which queue is being linked in debug output 2017-03-23 00:21:44 +11:00
Seungha Yang
587c417d89 urisourcebin: Fix typefind list leak
https://bugzilla.gnome.org/show_bug.cgi?id=780257
2017-03-20 11:57:11 +02:00
Jan Schmidt
0b6a933e01 decodebin: Close a small race posting 100% buffering
When posting 100% buffering due to removing the last
buffering element, we still need to hold the posting
lock as well, to avoid any race with other elements
that might post a buffering message at that exact
moment
2017-03-18 02:03:47 +11:00
Jan Schmidt
94da76d301 urisourcebin: Fix buffering message aggregation.
Add locking, and handle EOS properly now that urisourcebin
uses custom events in place of real EOS events, so we
need to manually remove buffering messages and potentially
post 100% in that situation
2017-03-18 02:03:47 +11:00
Jan Schmidt
8cb57a4fe8 urisourcebin: Store slot info on the queue object too
The buffering message handling tries to look up the
slot info on the queue itself.
2017-03-18 02:03:47 +11:00
Thibault Saunier
099ac9faf2 docs: Convert gtkdoc comments to markdown
Modernizing the documentation, making it simpler to read an
modify and allowing us to possibly switch to hotdoc in the
future.
2017-03-10 18:19:17 -03:00
Jan Schmidt
4e911760d2 urisourcebin: Shrink queue2 max-size-time buffering
The expanded 4 second buffering was making radio streams that are
being delivered at real-time speeds too slow. We might need
a better plan for matching the queue2 size to incoming bitrate
in the absence of tag information or timestamping.

In uridecodebin, it used tags on the output of decodebin to
adjust the queue2 buffering, but urisourcebin doesn't have that
view - decodebin is downstream from us.
2017-03-09 01:42:14 +11:00
Sebastian Dröge
903a8863ce playbin3/urisourcebin: Enable buffering by default
This only has effect on network streams in these elements, and by
enabling it by default we get the same behaviour as in playbin2.
2017-03-07 14:59:36 +02:00
Sebastian Dröge
033057cf74 decodebin3: Fix potential NULL pointer dereference on slot deactivation
CID 1363331
2017-02-28 15:17:24 +02:00
Sebastian Dröge
bd9fd89d61 urisourcebin: Fix inverted check for an existing slot
CID 1363330
2017-02-28 15:15:31 +02:00
Sebastian Dröge
f41198db9d decodebin3: Handle stream-start events without group id correctly
CID 1363327
2017-02-28 15:13:49 +02:00