Commit graph

4052 commits

Author SHA1 Message Date
Vincent Penquerc'h
a2ca6459a6 playbin: forward template and ring buffer settings to existing decodebins
https://bugzilla.gnome.org/show_bug.cgi?id=744844
2015-02-24 10:02:19 +00:00
Luis de Bethencourt
8703d93bbf decodebin: move null check
Check if dbin->decode_chain is NULL before running drain_and_switch_chains()
because if it is, we shouldn't run that function or it will segfault.

CID #1271074
2015-02-23 17:24:56 +00:00
Sebastian Dröge
1dcd1a7479 decodebin: Only consider non-parser factories for generating the post-parser capsfilter caps
Otherwise if there are multiple parsers we would most likely break negotiation
of the stream-format/alignment wanted by the decoders as parsers generally
support all possible stream-formats and alignments.
2015-02-20 12:35:19 +02:00
Vincent Penquerc'h
a2ee84fa80 decodebin: fix deadlock between downward state change and pad addition
If caps on a newly added pad are NULL, analyze_new_pad will try to
acquire the chain lock to add a probe to the pad so the chain can
be built later. This comes from the streaming thread, in response
to headers or other buffers causing this pad to be added, so the
stream lock is taken.

Meanwhile, another thread might be destroying the chain from a
downward state change. This will cause the chain to be freed with
the chain lock taken, and some elements are set to NULL here, which
can include the parser. This causes pad deactivation, which tries
to take the element's pad's stream lock, deadlocking.

Fix this by keeping track of which elements need setting to NULL,
and only do this after the chain lock is released. Only the chain
manipulation needs to be locked, not the elements' state changes.

https://bugzilla.gnome.org/show_bug.cgi?id=741355
2015-02-19 13:38:35 +00:00
Vincent Penquerc'h
a848ac7abe decodebin: guard against the decode chain going while a pad is added
https://bugzilla.gnome.org/show_bug.cgi?id=741355
2015-02-19 13:38:35 +00:00
Vincent Penquerc'h
9036dc8594 decodebin: possible fix for deadlock when spamming "next song"
There was a deadlock between a thread changing decodebin/demuxer
state from PAUSED to READY, and another thread pushing data
when starting.

From the stack trace at
https://bug741355.bugzilla-attachments.gnome.org/attachment.cgi?id=292471,
I deduce the following is happening, though I did not reproduce the
problem so I'm not sure this patch fixes it.

The streaming thread (thread 2 in that stack trace) takes the demuxer's
sink pad's stream lock in gst_ogg_demux_perform_seek_pull and will
activate a new chain. This ends up causing the expose lock being taken
in _pad_added_cb in decodebin.

Meanwhile, a state changed is triggered on thread 1, which takes the
expose lock in decodebin in gst_decode_bin_change_state, then frees
the previous chain, which ends up calling gst_pad_stop_task on the
demuxer's task, which in turn takes the demuxer's sink pad's stream
lock, deadlocking as both threads are now waiting for each other.

https://bugzilla.gnome.org/show_bug.cgi?id=741355
2015-02-19 13:38:29 +00:00
Sebastian Dröge
2813e08210 uridecodebin: Reset the default query return value when the iterator has to resync 2015-02-19 01:30:05 +02:00
Sebastian Dröge
5da04ca3c7 uridecodebin: Let the latency query fail if one of the source queries fails 2015-02-19 01:22:26 +02:00
Olivier Crête
0487e1548d uridecodebin: Pass object, not GValue to debug print 2015-02-17 18:39:03 -05:00
Song Bing
fb9ca25f7f streamsynchronizer: Use the same waiting function for EOS and stream switches
Also improve the waiting condition for stream switches, which was assuming
before that the condition variable will only stop waiting once when it is
signaled. But the documentation says that there might be spurious wakeups.

https://bugzilla.gnome.org/show_bug.cgi?id=736655
2015-02-16 14:34:35 +02:00
Song Bing
2614f80309 streamsynchronizer: Send GAP events from the pads' streaming threads
Change the GAP events that are currently sent from the chain function of
the current pad to all other EOS pads. They should instead be sent from
their own streaming threads.

https://bugzilla.gnome.org/show_bug.cgi?id=736655
2015-02-16 14:12:28 +02:00
Song Bing
9f81931716 streamsynchronizer: Send GAP event to finish preroll when change state from PLAYING to PAUSED
Wait in the event function when EOS is received until all pads are EOS
and then forward the EOS event from each pads own event function.

Also send a new GAP event for EOS pads from the event function whenever
going from PLAYING->PAUSED by shortly waking up the GCond. This is needed
to allow sinks to pre-roll again, as they did not receive EOS yet because
we blocked that, but also will never get data again.

https://bugzilla.gnome.org/show_bug.cgi?id=736655
2015-02-16 14:09:43 +02:00
Stefan Sauer
c51bf98af4 playbin: improve debug log
Log the human readable pad_link_return desc as well.
2015-02-11 22:16:53 -08:00
Sebastian Dröge
8547594727 Improve and fix LATENCY query handling
This now follows the design docs everywhere, especially the maximum latency
handling.

https://bugzilla.gnome.org/show_bug.cgi?id=744106
2015-02-11 17:53:49 +02:00
Luis de Bethencourt
f85212ed4b videoscale: fix memory leak
In gst_video_scale_fixate_caps () it can goto done without freeing the memory
of the tmp GstStructure. This makes it go out of scope and leak.

CID #1265766
2015-02-04 12:09:45 +00:00
Wim Taymans
47bd6a138c videoscale: don't do dithering 2015-01-28 17:30:53 +01:00
Luis de Bethencourt
783204824d orc: update orc files 2015-01-27 13:39:14 +00:00
Wim Taymans
3db8879f25 videoscale: disable chroma and matrix operations
Ignore chroma subsampling and color matrix transformations like the
old videoscale used to do. This is to make the performance like it was
before.

See https://bugzilla.gnome.org/show_bug.cgi?id=741987
2015-01-27 10:52:29 +01:00
Sebastian Dröge
2bd4ea6e8e Constify some static arrays everywhere 2015-01-21 09:49:47 +01:00
Vincent Penquerc'h
661588b150 dcodebin2: fix lock/unlock mismatch on multiqueue overrun 2015-01-20 15:09:13 +00:00
Jan Alexander Steffens (heftig)
a636c39638 audioresample: Try to prevent endless looping
Speex may decide not to consume any samples because it can't write any. I've
seen a hang during draining caused by the resample loop never terminating.
In that case, resampling happened as normal until olen was 0 but ilen was
still 1. _process_native then reduced ichunk to 0, so ilen never decreased
below 1 and the loop never terminated.

Instead of reverting 684cf44 ({audioresample: don't skip input samples),
break only if all output samples have been produced and speex refuses
to consume any more input samples.

https://bugzilla.gnome.org/show_bug.cgi?id=732908
2015-01-19 19:36:13 +01:00
Sebastian Dröge
63afbce6be videorate: Add $(GST_PLUGINS_BASE_CFLAGS) to be able to find gst/video/video.h 2015-01-19 11:17:18 +01:00
Nicolas Dufresne
e60158c98f videorate: Implement allocation query
The videorate element keeps 1 buffer internally. This buffer need
to be requested during allocation query otherwise the pipeline may
stall.

https://bugzilla.gnome.org/show_bug.cgi?id=738302
2015-01-18 14:58:36 -05:00
Nicolas Dufresne
2e264103e1 Revert "videorate: Implement allocation query"
This reverts commit 3c04db4a30.
2015-01-18 14:17:07 -05:00
Nicolas Dufresne
3c04db4a30 videorate: Implement allocation query
VideRate keeps 1 buffer in order to duplicate base on closest buffer
relative to targeted time. This extra buffer need to be request
otherwise the pipeline may stall when fixed size buffer pool is used.

https://bugzilla.gnome.org/show_bug.cgi?id=738302
2015-01-18 11:02:00 -05:00
Sebastian Dröge
2228d9f22b decodebin: Fix compilation 2015-01-17 14:51:48 +01:00
Branislav Katreniak
d16df7f70d decodebin: do call set_queue_size in no_more_pads_cb
Consider pipeline: gst-launch-1.0 playbin uri=http://example.com/a.ogg
Consider 128kbit audio stream.

As soon as uridecodebin detects the bitrate, it configures its input
queue2 max-size to 32000 bytes.
The 2MB buffer in multiqueue is nearly 2 orders of magnitude bigger.
This non-deterministically drives queue2 buffer anywhere from
100% to 0% until multiqueue is filled.

This patch sets multiqueue size to 5 buffers early in no_more_pads_cb.

Partly reverts commit db771185ed.

https://bugzilla.gnome.org/show_bug.cgi?id=740689
2015-01-16 20:58:40 +01:00
Vincent Penquerc'h
6ab711f3f1 decodebin: free old groups when switching groups
Old groups are freed with one switch's delay when switching groups.
They're freed in a scratch thread to avoid delaying the switch.
2015-01-16 15:55:10 +00:00
Thiago Santos
a5ed7afb4c decodebin: disable pad link checks as it has already been done
Decodebin has already added the element to the bin and should only
select caps compatible pads. It should disable the pad link checks
to avoid doing those again.

https://bugzilla.gnome.org/show_bug.cgi?id=742885
2015-01-14 10:33:52 -03:00
Sebastian Dröge
8abfdd127f videotestsrc: Report our latency properly in live mode
While we have no latency at all in theory, any other live source has the
duration of one buffer as minimum latency. Do the same in videotestsrc.

https://bugzilla.gnome.org/show_bug.cgi?id=741879
2014-12-24 12:59:37 +01:00
Sebastian Dröge
631d356845 audiotestsrc: Report our latency properly in live mode
While we have no latency at all in theory, any other live source has the
duration of one buffer as minimum latency. Do the same in audiotestsrc.

https://bugzilla.gnome.org/show_bug.cgi?id=741879
2014-12-24 12:59:37 +01:00
Sebastian Dröge
6521870077 Revert "decodebin: Only emit the drain signal for the main decode chain, not any subchains"
This reverts commit a391dfe17f.

It breaks gapless playback: https://bugzilla.gnome.org/show_bug.cgi?id=740045
2014-12-15 09:46:13 +01:00
Matej Knopp
4713694082 audiorate: Fill gap events
https://bugzilla.gnome.org/show_bug.cgi?id=741281
2014-12-14 12:09:12 +01:00
Thibault Saunier
b9cbfcdeb4 playbin: Do not mix up stream type when getting stream combiner element
We were always returning the video stream combiner whatever stream type
combiner was wanted.
2014-12-11 13:47:58 +01:00
Thiago Santos
7e801a5f26 playbin2: always unref the combiner sinkpad when removing the srcpad
Create a function to do the pad cleanup of the GstSourceCombine struct
and use it to not forget to also cleanup the sink pad and fix a memory
leak.

https://bugzilla.gnome.org/show_bug.cgi?id=741198
2014-12-10 13:36:37 -03:00
Edward Hervey
6a2f017bfa playbin: Only check sinks which are in >= GST_STATE_READY
Otherwise we endup with bogus caps intersection (from the pad template
caps and not from what the actual hardware/device supports)

https://bugzilla.gnome.org/show_bug.cgi?id=738131
2014-12-05 07:58:44 +01:00
Chad
e397b03f35 audiorate: Use gst_util_uint64_scale_int_round()
Using gst_util_uint64_scale_int() causes slight drift
which accumulates over time.

https://bugzilla.gnome.org/show_bug.cgi?id=741045
2014-12-02 16:07:05 -05:00
Wim Taymans
991a81bd5d videoconvert: add dither-bits option
Fix the dither option.
Add a new option to set the quantizer
2014-12-02 15:23:00 +01:00
Sebastian Dröge
90eb93c2ef Don't compare booleans for equality to TRUE and FALSE
TRUE is 1, but every other non-zero value is also considered true. Comparing
for equality with TRUE would only consider 1 but not the others.
2014-12-01 09:51:12 +01:00
Thibault Saunier
72c05d1cbb encodebin: Add a way to disable caps renegotiation for output stream format
In some cases, the user might want the stream outputted by encodebin to
be in the exact same format during all the stream. We should let the
user specify when this is the case. This commit add some API in the
GstEncodingProfile to determine whether the format can be renegotiated
after the encoding started or not.

API:
    gst_encoding_profile_set_allow_dynamic_output
    gst_encoding_profile_get_allow_dynamic_output

https://bugzilla.gnome.org/show_bug.cgi?id=740214
2014-11-28 16:56:32 +01:00
Wim Taymans
9efbba8c1c videoscale: use old property name
Unbreak ABI by changing to the old property name again.

https://bugzilla.gnome.org/show_bug.cgi?id=740798
2014-11-27 09:47:41 +01:00
Thibault Saunier
35f6259b24 decodebin: Analyze source pad before setting to PAUSED for 'simple demuxers'
Before we were setting them to PAUSED and (much) later connecting to
their source pad caps notify signal.

There was a race where that demuxer was pushing a caps and later a buffer
on its source pad when we were not even connected to its source pad caps notify
signal leading to decodebin missing the information and not keeping on
building the pipeline on CAPS event thus the demuxer was posting an ERROR
(not linked) message on the bus. This need to be done for 'simple
demuxers' because those have one ALWAYS source pad, not like usual demuxers
that have several dynamic source pads.

A "simple demuxer" is a demuxer that has one and only one ALWAYS source
pad.

https://bugzilla.gnome.org/show_bug.cgi?id=740693
2014-11-26 19:38:48 +01:00
Mathieu Duponchelle
68edf0ebd6 decodebin2: Take STREAM_LOCK before sending sticky events.
There was a race where:

1) we would put the element to PAUSED
2) It would get data sent to it from upstream
3) It would thus send caps
3) caps_notify_cb would continue autoplugging
4) caps would flow downstream, the last pad would get exposed
5) we were still not done sending the sticky events

Taking the stream lock on the new element's sinkpad and only
releasing it when sticky events have all been sent prevents
the caps from reaching the source pad of the element before
we're all set.

https://bugzilla.gnome.org/show_bug.cgi?id=740694
2014-11-26 19:38:48 +01:00
Tim-Philipp Müller
76199fddb6 typefindfunctions: detect mp4 common file format variant
Used e.g. by UltraViolet.
2014-11-26 16:54:39 +00:00
Wim Taymans
43f44d41dc videoscale: add property to do scaling after gamma-decode 2014-11-25 11:54:51 +01:00
Wim Taymans
724b83c5f5 videoscale: add more scaling filters
Adjust the filter parameters so that they use the same number of taps
and method as the old ones.
Add some new filters
2014-11-25 11:28:42 +01:00
Andrei Sarakeev
e5c6f59140 playsink: Reset mute property of the sink to playsink's value when setting up the audio chain
Otherwise the following can happen:
1. set mute=true
2. play media1 (Ok)
3. play media without audio (audiochain removed)
4. play media2 (audiochain created, mute=*false*)

https://bugzilla.gnome.org/show_bug.cgi?id=740675
2014-11-25 10:23:50 +01:00
Tim-Philipp Müller
ef23ac5f52 typefind: improve 'audible' audio typefinder a little
Don't return NEARLY_CERTAIN just based on 4 bytes.
Also change media type to audio/x-audible.

https://bugzilla.gnome.org/show_bug.cgi?id=715050
2014-11-25 09:04:37 +00:00
Jonathan Matthew
ddda5866c5 typefindfunctions: add audio/audible typefinder
https://bugzilla.gnome.org/show_bug.cgi?id=715050
2014-11-25 00:55:50 +00:00
Sebastian Dröge
cefc518494 videorate: Operate in a zero-latency mode if drop-only is set to TRUE
There's no reason why we would have to wait for the next buffer to decide
whether to output the current one or not. We just have to check if the
current one is earlier than our expected next time, which is the previous
frame timestamp plus the expected frame duration.

https://bugzilla.gnome.org/show_bug.cgi?id=740018
2014-11-19 15:10:48 +01:00