Commit graph

1765 commits

Author SHA1 Message Date
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
Seungha Yang
6b5617c2a7 decodebin3: Fix crash caused by slot double freeing
Probe for MultiQueue source pad might receive EOS twice,
the first is fake-eos and the other is actual EOS.
And the slot can be freed with fake-eos/EOS if the slot has no input.

Since slot freeing is async, double free can be possible.
So, decodebin3 needs to remove the probe also with slot freeing.

https://bugzilla.gnome.org/show_bug.cgi?id=777530
2017-01-31 17:16:16 +01:00
Seungha Yang
e6ee68a34f decodebin3: Fix list leak on handle_stream_switch()
Free no more used list variables

https://bugzilla.gnome.org/show_bug.cgi?id=775553
2017-01-31 16:48:04 +01:00
Seungha Yang
44bc10219c decodebin3: Change requested_selection to have its own memory for stream-id
"requested_selection" list might be generated by select-streams event.
And memory of stream-id(s) in select-streams is independent from that of stream-collection.

https://bugzilla.gnome.org/show_bug.cgi?id=775553
2017-01-31 16:48:04 +01:00
Seungha Yang
30fe123fdb decodebin3: Change return types of stream_in_{list,collection}
Change return types of functions to get memory address of stream-id.

https://bugzilla.gnome.org/show_bug.cgi?id=775553
2017-01-31 16:48:04 +01:00
Seungha Yang
10fe0497b2 playback: Fix leak on select_streams
Since gst_event_parse_select_streams() returns newly allocated
memory for stream-id(s), it should be freed explicitly.

https://bugzilla.gnome.org/show_bug.cgi?id=775553
2017-01-31 16:48:04 +01:00
Jan Schmidt
54bf104274 decodebin: Don't leak blocked pad references on errors
When the decodebin state change fails because of an error
message, we might not go through PAUSED->READY. Don't leak
a ref to decodebin pads due to pad blocking in that case.

This is because we return ASYNC going to PAUSED, and if
we fail before reaching PAUSED the only transition we'll
see is READY->NULL.

https://bugzilla.gnome.org/show_bug.cgi?id=775893
2017-01-18 13:09:06 +02:00
Jan Schmidt
5076520502 urisourcebin: Preserve seqnum on EOS events
When converting EOS to/from our custom fake EOS event,
preserve any seqnum on the original event.
2017-01-12 22:28:50 +11:00
Edward Hervey
90e86b8638 urisourcebin: Avoid races when setting up typefind
The state of urisourcebin (and all elements contained within) can
change at any point in time, including when setting up the typefind
element.

In order to avoid ending up with typefind starting without being fully
connected, lock the state and connect to the 'have-type' signal.
2017-01-12 10:51:34 +01:00
Jan Schmidt
ef8f0cdd9d urisourcebin: Drop fake EOS if the pad got relinked
If our pad got relinked in since the fake-EOS was sent to the
pad, then drop the fake-EOS event.

CID: 1398546
2017-01-11 23:18:47 +11:00
Arun Raghavan
a2c2b22176 urisourcebin: Drop some dead code
The ret == GST_STATE_CHANGE_FAILURE is handled in the previous for loop
already.

CID: 1398544
2017-01-11 17:14:46 +05:30
Seungha Yang
1eedb4ea91 urisourcebin: Clear pad from pending list if it was linked
If not, the other slots might try to link the pad again.
This can happen when the demuxer has multiple src pads
and their caps are identical

https://bugzilla.gnome.org/show_bug.cgi?id=777121
2017-01-11 20:19:45 +11:00
Seungha Yang
7bd7b2209a urisourcebin: Configure typefind element for non-streaming uri
To ensure configuring adaptivedemux if needed,
setup typefind element even if uri is not matched to streaming protocol.

https://bugzilla.gnome.org/show_bug.cgi?id=776458
2017-01-11 00:26:27 +11:00
Seungha Yang
5d0628ff52 urisourcebin: Use GList for typefind elements
We need typefind elements per source element's srcpad

https://bugzilla.gnome.org/show_bug.cgi?id=776458
2017-01-11 00:26:27 +11:00
Seungha Yang
46c6e92abd urisourcebin: Remove unused signal handler variable
Remove never used handler id

https://bugzilla.gnome.org/show_bug.cgi?id=776458
2017-01-11 00:26:27 +11:00
Seungha Yang
87f21a925c urisourcebin: Clear EOS state with stream-start/flush-stop event
The EOS state marker should cleared on stream-start or flush-stop

https://bugzilla.gnome.org/show_bug.cgi?id=777009
2017-01-09 22:38:14 +11:00