Commit graph

2211 commits

Author SHA1 Message Date
Stian Selnes
d03bd54780 queue: Fix race when calculating cur_level.time
On the first buffer, it's possible that sink_segment is set but
src_segment has not been set yet. If this is the case, we should not
calculate cur_level.time since sink_segment.position may be large and
src_segment.position default is 0, with the resulting diff being larger
than max-size-time, causing the queue to start leaking (if
leaky=downstream).

One potential consequence of this is that the segment event may be
stored on the srcpad before the caps event is pushed downstream, causing
a g_warning ("Sticky event misordering, got 'segment' before 'caps'").

https://bugzilla.gnome.org/show_bug.cgi?id=773096
2016-10-20 14:14:20 +03:00
Edward Hervey
ace418d226 queue2: Implement gst_event_full_func handling
Same as we do for queue
2016-10-08 13:56:18 +02:00
Carlos Rafael Giani
7413064f06 queue2: Update buffering if its enabled and low/high watermarks are changed
https://bugzilla.gnome.org/show_bug.cgi?id=771210
2016-09-17 09:54:29 +01:00
Carlos Rafael Giani
5988095f90 multiqueue: Add higher-resolution low/high-watermark properties
low/high-watermark are of type double, and given in range 0.0-1.0. This
makes it possible to set low/high watermarks with greater resolution,
which is useful with large multiqueue max sizes and watermarks like 0.5%.

Also adding a test to check the fill and watermark level behavior.

https://bugzilla.gnome.org/show_bug.cgi?id=770628
2016-08-31 12:56:19 +03:00
Carlos Rafael Giani
67874ea86d multiqueue: Distinguish between buffering percentage and buffering level
To make the code clearer, and to facilitate future improvements, introduce
a distinction between the buffering level and the buffering percentage.

Buffering level: the queue's current fill level. The low/high watermarks
are in this range.

Buffering percentage: percentage relative to the low/high watermarks
(0% = low watermark, 100% = high watermark).

To that end, get_percentage() is renamed to get_buffering_level(). Also,
low/high_percent are renamed to low/high_watermark to avoid confusion.
mq->buffering_percent values are now normalized in the 0..100 range for
buffering messages inside update_buffering(), and not just before sending
the buffering message. Finally the buffering level range is parameterized
by adding a new constant called MAX_BUFFERING_LEVEL.

https://bugzilla.gnome.org/show_bug.cgi?id=770628
2016-08-31 12:56:19 +03:00
Carlos Rafael Giani
e83412b4fd multiqueue: Rename percent/percent_changed to buffering_percent(_changed)
This is a prerequisite for subsequent commits, and makes queue2 and
multiqueue code a little more consistent.

https://bugzilla.gnome.org/show_bug.cgi?id=770628
2016-08-31 12:56:19 +03:00
Edward Hervey
3117525cb6 multiqueue: Fix high_time wakeup logic
When calculating the high_time, cache the group value in each singlequeue.

This fixes the issue by which wake_up_next_non_linked() would use the global
high-time to decide whether to wake-up a waiting thread, instead of the group
one, resulting in those threads constantly spinning.

Tidy up a bit the waiting logic while we're at it.

With this patch, we go from 212% playing a 8 audio / 8 video file down to less
than 10% (most of it being the video decoding).

https://bugzilla.gnome.org/show_bug.cgi?id=770225
2016-08-30 12:28:40 +03:00
Thibault Saunier
4714ef2f8e Make use of the new GST_ELEMENT_FLOW_ERROR API all around.
https://bugzilla.gnome.org/show_bug.cgi?id=770158
2016-08-27 09:33:20 -03:00
Carlos Rafael Giani
db66cb51b3 queue2: Add higher-resolution low/high-watermark properties
low/high-watermark are of type double, and given in range 0.0-1.0. This
makes it possible to set low/high watermarks with greater resolution,
which is useful with large queue2 max sizes and watermarks like 0.5%.

Also adding a test to check the fill and watermark level behavior.

https://bugzilla.gnome.org/show_bug.cgi?id=769449
2016-08-25 11:54:33 +03:00
Carlos Rafael Giani
e0f1a9e618 queue2: Distinguish between buffering percentage and buffering level
To make the code clearer, and to facilitate future improvements, introduce
a distinction between the buffering level and the buffering percentage.

Buffering level: the queue's current fill level. The low/high watermarks
are in this range.

Buffering percentage: percentage relative to the low/high watermarks
(0% = low watermark, 100% = high watermark).

To that end, get_buffering_percent() is renamed to get_buffering_level(),
and the code at the end that transforms to the buffering percentage is
factored out into a new convert_to_buffering_percent() function. Also,
the buffering level range is parameterized by adding a new constant called
MAX_BUFFERING_LEVEL.

https://bugzilla.gnome.org/show_bug.cgi?id=769449
2016-08-25 11:54:33 +03:00
Nirbheek Chauhan
b2f9808722 Add support for Meson as alternative/parallel build system
https://github.com/mesonbuild/meson

With contributions from:

Tim-Philipp Müller <tim@centricular.com>
Mathieu Duponchelle <mathieu.duponchelle@opencreed.com>
Jussi Pakkanen <jpakkane@gmail.com> (original port)

Highlights of the features provided are:
* Faster builds on Linux (~40-50% faster)
* The ability to build with MSVC on Windows
* Generate Visual Studio project files
* Generate XCode project files
* Much faster builds on Windows (on-par with Linux)
* Seriously fast configure and building on embedded

... and many more. For more details see:

http://blog.nirbheek.in/2016/05/gstreamer-and-meson-new-hope.html
http://blog.nirbheek.in/2016/07/building-and-developing-gstreamer-using.html

Building with Meson should work on both Linux and Windows, but may
need a few more tweaks on other operating systems.
2016-08-19 21:26:14 +01:00
Edward Hervey
5154dcfbdc queue2: Post buffering messages earlier in ringbuffer mode
In ringbuffer mode we need to make sure we post buffering messages *before*
blocking to wait for data to be drained.

Without this, we would end up in situations like this:
* pipeline is pre-rolling
* Downstream demuxer/decoder has pushed data to all sinks, and demuxer thread
  is blocking downstream (i.e. not pulling from upstream/queue2).
* Therefore pipeline has pre-rolled ...
* ... but queue2 hasn't filled up yet, therefore the application waits for
  the buffering 100% messages before setting the pipeline to PLAYING
* But queue2 can't post that message, since the 100% message will be posted
  *after* there is room available for that last buffer.

https://bugzilla.gnome.org/show_bug.cgi?id=769802
2016-08-12 16:26:40 +02:00
Josep Torra
5f021759b3 multiqueue: removed redundant call to g_thread_self
Remove an unneeded call to g_thread_self and minor coding style fix.
2016-08-08 16:42:06 +02:00
Jan Schmidt
b50a12b8ac inputselector: Handle stream-group-done
Handle the new stream-group-done message to unblock pads which
are waiting for the running time to advance on that group.

https://bugzilla.gnome.org/show_bug.cgi?id=768995
2016-07-25 20:22:20 +10:00
Jan Schmidt
4981e09bc7 inputselector: Wake other pads when selected goes EOS
Other pads that are waiting for the stream on the selected
pad to advance before they finish waiting themselves
should be given the chance to do so when the selected pad
goes EOS. Fixes problems where input streams can end up
waiting forever if the active stream goes EOS earlier than
their own end time.
2016-07-25 19:34:52 +10:00
Edward Hervey
1ff80fbf52 queue2: Fix average input rate calculation on small input range
When dealing with small-ish input data coming into queue2, such as
adaptivedemux fragments, we would never take into account the last
<200ms of data coming in.

The problem is that usually on TCP connection the download rate
gradually increases (i.e. the rate is lower at the beginning of a
download than it is later on). Combined with small download time (less
than a second) we would end up with a computed average input rate
which was sometimes up to 30-50% off from the *actual* average input
rate for that fragment.

In order to fix this, force the average input rate calculation when
we receive an EOS so that we take into account that final window
of data.

https://bugzilla.gnome.org/show_bug.cgi?id=768649
2016-07-11 10:08:44 +02:00
Sebastian Dröge
528fbfe7c1 funnel: Only forward sticky events on GAP events if needed
That is, if the active pad changed and if forwarding of sticky events is
requested at all. We otherwise forward events too often.
2016-07-07 13:32:39 +03:00
Edward Hervey
530001661d multiqueue: Fix behaviour with not-linked and eos pads
This is an update on c9b6848885
multiqueue: Fix not-linked pad handling at EOS

While that commit did fix the behaviour if upstream sent a GST_EVENT_EOS,
it would break the same issue when *downstream* returns GST_FLOW_EOS
(which can happen for example when downstream decoders receive data
from after the segment stop).

GST_PAD_IS_EOS() is only TRUE when a GST_EVENT_EOS has flown through it
and not when a GST_EVENT_EOS has gone through it.

In order to handle both cases, also take into account the last flow
return.

https://bugzilla.gnome.org/show_bug.cgi?id=763770
2016-07-01 09:47:31 +02:00
Tim-Philipp Müller
715939cce7 multiqueue: add gtk-doc blurb for new pad property 2016-06-30 14:37:17 +01:00
Edward Hervey
f4ba43b15d multiqueue: Add a pad property to "group" streams
When syncing by running time, multiqueue will throttle unlinked streams
based on a global "high-time" and the pending "next_time" of a stream.

The idea is that we don't want unlinked streams to be "behind" the global
running time of linked streams, so that if/when they get linked (like when
switching tracks) decoding/playback can resume from the same position as
the other streams.

The problem is that it assumes elements downstream will have a more or less
equal buffering/latency ... which isn't the case for streams of different
type. Video decoders tend to have higher latency (and therefore consume more
from upstream to output a given decoded frame) compared to audio ones, resulting
in the computed "high_time" being at the position of the video stream,
much further than the audio streams.

This means the unlinked audio streams end up being quite a bit after the linked
audio streams, resulting in gaps when switching streams.

In order to mitigate this issue, this patch adds a new "group-id" pad property
which allows users to "group" streams together. Calculating the high-time will
now be done not only globally, but also per group. This ensures that within
a given group unlinked streams will be throttled by that group's high-time
instead.

This fixes gaps when switching downstream elements (like switching audio tracks).
2016-06-30 14:45:10 +02:00
Vincent Penquerc'h
b3802f7a9e queue2: fix crash deleting current region for small ring buffers
Ensure we do not attempt to destroy the current range. Doing so
causes the current one to be left dangling, and it may be dereferenced
later, leading to a crash.

This can happen with a very small queue2 ring buffer (10000 bytes)
and 4 kB buffers.

repro case:

gst-launch-1.0 fakesrc sizetype=2 sizemax=4096 ! \
queue2 ring-buffer-max-size=1000 ! fakesink sync=true

https://bugzilla.gnome.org/show_bug.cgi?id=767688
2016-06-21 10:20:20 +01:00
Nicolas Dufresne
4603722e2d tee: Properly handle return value when only 1 pad
This patch handle the case when you have 1 pad (so the fast path is
being used) but this pad is removed. If we are in allow-not-linked, we
should return GST_FLOW_OK, otherwise, we should return GST_FLOW_UNLINKED
and ignore the meaningless return value obtained from pushing.

https://bugzilla.gnome.org/show_bug.cgi?id=767413
2016-06-17 13:03:20 +03:00
Sebastian Dröge
722ad08733 queue: Only unblock upstream waiting for the query once downstream is finished
... when flushing and deactivating pads. Otherwise downstream might have a
query that was already unreffed by upstream, causing crashes or other
interesting effects.

https://bugzilla.gnome.org/show_bug.cgi?id=763496
2016-05-15 11:06:08 +03:00
Sebastian Dröge
5e43ee5989 typefind: Only push a CAPS event downstream if the sinkpad is not in PULL mode
The other signal handlers of the type-found signal might have reactivated
typefind in PULL mode already, pushing a CAPS event at that point would cause
deadlocks and is in general unexpected by elements that are in PULL mode.

https://bugzilla.gnome.org/show_bug.cgi?id=765906
2016-05-11 15:06:39 +03:00
Matej Knopp
efb1955ffb multiqueue: Ignore time when determining whether sparse stream limits have been reached
Basically, sq->max_size.visible is never increased for sparse streams in
overruncb when empty queue has been found;

If the queue is sparse it just skip the entire logic determining whether
max_size.visible should be increased, deadlocking the demuxer.

What should be done instead is that when determining if limits have been
reached, to ignore time for sparse streams, as the buffer may be far in the
future.

https://bugzilla.gnome.org/show_bug.cgi?id=765736
2016-04-29 16:09:23 +03:00
Carlos Rafael Giani
3bd5aeac52 multiqueue: Recheck buffering status after changing low threshold
https://bugzilla.gnome.org/show_bug.cgi?id=763757
2016-04-15 16:04:54 +03:00
Carlos Rafael Giani
a1d2f387c6 multiqueue: Recalculate fill level after changing high-threshold
This ensures the following special case is handled properly:

1. Queue is empty
2. Data is pushed, fill level is below the current high-threshold
3. high-threshold is set to a level that is below the current fill level

Since mq->percent wasn't being recalculated in step #3 properly, this
caused the multiqueue to switch off its buffering state when new data is
pushed in, and never post a 100% buffering message. The application will
have received a <100% buffering message from step #2, but will never see
100%.

Fix this by recalculating the current fill level percentage during
high-threshold property changes in the same manner as it is done when
use-buffering is modified.

https://bugzilla.gnome.org/show_bug.cgi?id=763757
2016-04-15 16:04:54 +03:00
Vincent Penquerc'h
53a7a991e2 multiqueue: catch errors and flushing case after lock
This ensures we can not get into an indefinite wait on the
following cond var wait.

https://bugzilla.gnome.org/show_bug.cgi?id=764999
2016-04-14 09:12:27 +01:00
Vineeth TM
a541d63210 bad: use new gst_element_class_add_static_pad_template()
https://bugzilla.gnome.org/show_bug.cgi?id=763081
2016-03-24 14:56:51 +02:00
Havard Graff
1bc8d9f2ea valve: don't send sticky events as a direct response to upstream events
Also refactor the existing valve test to actually test the valve,
and not just test the EOS mechanism of a pad.

https://bugzilla.gnome.org/show_bug.cgi?id=763753
2016-03-24 14:50:50 +02:00
Tim-Philipp Müller
bc78548cfe capsfilter: optimisation: avoid unnecessary gst_pad_has_current_caps() checks
No need to do this for every input buffer, since it involves
locking and iterating of the sticky events array and such.

https://bugzilla.gnome.org/show_bug.cgi?id=763337
2016-03-24 14:48:40 +02:00
Edward Hervey
f87ec5e014 queue: Use full running time for level calculation
Ensures we have proper time level estimation for the cases where
the incoming buffers have PTS/DTS outside of the segment start/stop
values.

https://bugzilla.gnome.org/show_bug.cgi?id=762995
2016-03-24 14:42:31 +02:00
Sebastian Dröge
0d5326950a typefind: Remove redundant assignment
CID 1357158
2016-03-24 11:49:44 +02:00
Jan Schmidt
c9b6848885 multiqueue: Fix not-linked pad handling at EOS
Ensure that not-linked pads will drain out at EOS by
correctly detecting the EOS condition based on the EOS
pad flag (which indicates we actually pushed an EOS),
and make sure that not-linked pads are woken when doing
EOS processing on linked pads.

https://bugzilla.gnome.org/show_bug.cgi?id=763770
2016-03-18 21:21:44 +11:00
Romain Picard
20859af3f2 typefind: Allow caps query in "have-type" signal handlers
If an application calls gst_pad_query_caps from its "have-type" signal handler,
then the query fails because typefind->caps has not been set yet.

This patch sets typefind->caps in the object method handler, before the signal
handlers are called.

https://bugzilla.gnome.org/show_bug.cgi?id=763491
2016-03-15 18:58:06 +02:00
Sebastian Dröge
57bbd18471 typefind: Store caps on the pad before emitting have-type but send it downstream only in the default signal handler
https://bugzilla.gnome.org/show_bug.cgi?id=763491
2016-03-14 13:07:49 +02:00
Carlos Rafael Giani
46573a27da concat: Fix comment typo 2016-03-14 12:23:12 +02:00
Sebastian Dröge
a15fca1934 Revert "typefind: Store caps on the pad before emitting have-type but send it downstream only in the default signal handler"
This reverts commit 0835c3d656.

It causes deadlocks in decodebin, which currently would deadlock if the caps
are already on the pad in have-type and are forwarded while copying the sticky
events (while holding the decodebin lock)... as that might cause the next
element to expose pads, which then calls back into decodebin and takes the
decodebin lock.

This needs some more thoughts.
2016-03-12 12:57:47 +02:00
Sebastian Dröge
0835c3d656 typefind: Store caps on the pad before emitting have-type but send it downstream only in the default signal handler
https://bugzilla.gnome.org/show_bug.cgi?id=763491
2016-03-12 11:56:49 +02:00
Tim-Philipp Müller
cf0680017e elements: use new gst_element_class_add_static_pad_template()
https://bugzilla.gnome.org/show_bug.cgi?id=762778
2016-02-28 13:10:07 +00:00
Tim-Philipp Müller
94ec3f8a3e typefind: fix indentation 2016-02-27 16:39:50 +00:00
Sebastian Dröge
e953f20786 identity: Add a " " after pts: in the silent=false output 2016-02-25 14:12:00 +02:00
Edward Hervey
555df9d614 plugins: Check return values of gst_buffer_map()
They can fail for various reasons.

For non-fatal cases (such as the dump feature of identiy and fakesink),
we just silently skip it.

For other cases post an error message.

https://bugzilla.gnome.org/show_bug.cgi?id=728326
2016-02-23 17:30:45 +01:00
Sebastian Dröge
e00bc04e3d dataurisrc: Don't assume that get_current_caps() returns non-NULL caps after has_current_caps()
Remove calls to gst_pad_has_current_caps() which then go on to call
gst_pad_get_current_caps() as the caps can go to NULL in between. Instead just
use gst_pad_get_current_caps() and check for NULL.

https://bugzilla.gnome.org/show_bug.cgi?id=759539
2016-02-23 18:17:42 +02:00
Sebastian Dröge
fd253ab1ab Revert "queue2: add overrun signal"
This reverts commit 8ae8b2723d.

It's not used anymore by anything and was considered a bad idea in general.
2016-02-16 19:11:59 +02:00
Alex Henrie
78ba7f9a8e typefindelement: Improve English grammar
https://bugzilla.gnome.org/show_bug.cgi?id=761273
2016-01-29 10:34:44 +01:00
Tim-Philipp Müller
469475f06b multiqueue: two small fixes for when an existing pad is requested
Unlock when returning NULL from gst_single_queue_new(), and don't
crash with debug logging enabled if NULL is returned.

Spotted by Steven Hoving.
2016-01-20 10:06:14 +00:00
Jan Schmidt
c1f4920859 queue2: Add use-tags-bitrate property
The use-tags-bitrate property makes queue2 look at
tag events in the stream and extract a bitrate for the
stream to use when calculating a duration for buffers
that don't have one explicitly set.

This lets queue2 sensibly buffer to a time threshold
for any bytestream for which the general bitrate is known.
2016-01-20 03:13:44 +11:00
Sebastian Dröge
485b15d8a9 output-selector: Make access to the active pad and last buffer thread-safe
Both can be modified from different threads at the same time.
2016-01-16 10:48:02 +01:00
Sebastian Dröge
0e132260a3 output-selector: Notify when the active-pad property is changing 2016-01-16 10:47:36 +01:00
HoonHee Lee
788938640d funnel: improve debug message
https://bugzilla.gnome.org/show_bug.cgi?id=745939
2016-01-08 19:28:43 +00:00
Tim-Philipp Müller
61e2f1eab1 queue2: avoid calculating fill levels multiple times
Macro expansion means we might calculate the fill level once
for the check and then possibly again for the return value.
2016-01-06 20:00:46 +00:00
Tim-Philipp Müller
8c6c0bef88 queue2: fix fill level arithmetic overflow with large values
Based on patch by: Aleksander Wabik <awabik@opera.com>

https://bugzilla.gnome.org/show_bug.cgi?id=755971
2016-01-06 20:00:46 +00:00
Vineeth TM
16435c9ce0 plugins-bad: Fix example pipelines
rename gst-launch --> gst-launch-1.0
replace old elements with new elements(ffmpegcolorspace -> videoconvert, ffenc_** -> avenc_**)
fix caps in examples

https://bugzilla.gnome.org/show_bug.cgi?id=759432
2015-12-15 10:30:49 +00:00
Sebastian Dröge
7e761798bd tee: Check if parsing the name template with sscanf() was successful
If not, go back to the automatic pad numbering.

CID 1195129
2015-12-14 13:06:57 +01:00
Sebastian Dröge
33ded76ab8 queue/multiqueue: Don't special-case CAPS events in the event handlers
For CAPS events we will never ever have a FALSE return value here, so just
remove the dead code instead of causing future confusion.
2015-12-14 11:20:43 +01:00
Sebastian Dröge
0636fe1391 Revert "queue: Illegal memory access of sink event"
This reverts commit 78614c505a.

The code it was fixing does not have any effect anyway and will be removed in
the next commit.
2015-12-14 11:20:22 +01:00
Vineeth TM
78614c505a queue: Illegal memory access of sink event
Once event is pushed to pad, then queue should not access the event.
This is leading to invalid read valgrind errors

https://bugzilla.gnome.org/show_bug.cgi?id=759430
2015-12-14 10:41:50 +01:00
Reynaldo H. Verdejo Pinochet
2a17bad7e8 downloadbuffer: drop unneeded macros for G_OS_WIN32 2015-12-12 13:13:54 -08:00
Reynaldo H. Verdejo Pinochet
b3a704de6a fdsrc: drop unneeded macros for G_OS_WIN32 2015-12-12 13:13:54 -08:00
Reynaldo H. Verdejo Pinochet
e71344010a fdsrc: enable large file support in Android
https://bugzilla.gnome.org/show_bug.cgi?id=758980
2015-12-12 13:13:54 -08:00
Reynaldo H. Verdejo Pinochet
806b48f6ba fdsink: enable large file support in Android
https://bugzilla.gnome.org/show_bug.cgi?id=758980
2015-12-12 13:13:54 -08:00
Reynaldo H. Verdejo Pinochet
85e7cfd811 queue2: fix some typos 2015-12-12 13:13:54 -08:00
Reynaldo H. Verdejo Pinochet
ea8bbd58df queue2: enable large file support on Android
https://bugzilla.gnome.org/show_bug.cgi?id=758980
2015-12-12 13:13:54 -08:00
Reynaldo H. Verdejo Pinochet
5261283dd9 downloadbuffer: fix some typos 2015-12-12 13:13:54 -08:00
Reynaldo H. Verdejo Pinochet
63727152e0 downloadbuffer: enable large file support on Android
https://bugzilla.gnome.org/show_bug.cgi?id=758980
2015-12-12 13:13:54 -08:00
Reynaldo H. Verdejo Pinochet
2a51ae6a4c sparsefile: drop bogus reference to file descriptor
+fix typo on return value comment
2015-12-12 13:13:54 -08:00
Reynaldo H. Verdejo Pinochet
6e563cf353 sparsefile: enable large file support on Android
https://bugzilla.gnome.org/show_bug.cgi?id=758980
2015-12-12 13:13:54 -08:00
Reynaldo H. Verdejo Pinochet
a7f8ad9c9a filesrc: enable large file support in Android
https://bugzilla.gnome.org/show_bug.cgi?id=758980
2015-12-09 14:15:26 -08:00
Reynaldo H. Verdejo Pinochet
add4526314 filesink: enable large file support on Android
https://bugzilla.gnome.org/show_bug.cgi?id=758980
2015-12-09 14:15:26 -08:00
Reynaldo H. Verdejo Pinochet
c0d2c1e793 filesink: indentation fixes 2015-12-09 14:15:26 -08:00
Edward Hervey
5f1764232f multiqueue: Don't use random segment.position from upstream
segment.position is meant for internal usage only, but the various
GST_EVENT_SEGMENT creationg/parsing functions won't clear that field.

Use the appropriate segment boundary as an initial value instead
2015-12-09 17:41:49 +01:00
Edward Hervey
906a50b995 multiqueue: Fix set/get property
Blame it on the rebasing :)
2015-12-02 16:28:58 +01:00
Edward Hervey
56d4650789 pad: Implement GstPadEventFullFunction
API: GstPadEventFullFunction

Returns a GstFlowReturn, allows asynchronous elements to properly
propagate flow returns

https://bugzilla.gnome.org/show_bug.cgi?id=757821
2015-12-02 16:04:03 +01:00
Edward Hervey
4d96e5b834 multiqueue: Use signed clock values for running time calculation
This improves the accuracy of queue levels and when to push buffers
for buffers falling outside of the segment

https://bugzilla.gnome.org/show_bug.cgi?id=757193
2015-12-02 16:03:20 +01:00
Edward Hervey
c51d2b2a37 multiqueue: Add an extra cache time for unlinked streams
When synchronizing the output by time, there are some use-cases (like
allowing gapless playback downstream) where we want the unlinked streams
to stay slightly behind the linked streams.

The "unlinked-cache-time" property allows the user to specify by how
much time the unlinked streams should wait before pushing again.
2015-12-02 16:03:20 +01:00
Edward Hervey
72c31876aa multiqueue: Optimize multiqueue sizes based on interleave
Multiqueue should only be used to cope with:
* decoupling upstream and dowstream threading (i.e. having separate threads
  for elementary streams).
* Ensuring individual queues have enough space to cope with upstream interleave
  (distance in stream time between co-located samples). This is to guarantee
  that we have enough room in each individual queues to provide new data in
  each, without being blocked.
* Limit the queue sizes to that interleave distance (and an extra minimal
  buffering size). This is to ensure we don't consume too much memory.

Based on that, multiqueue now continuously calculates the input interleave
(per incoming streaming thread). Based on that, it calculates a target
interleave (currently 1.5 x real_interleave + 250ms padding).

If the target interleave is greater than the current max_size.time, it will
update it accordingly (to allow enough margin to not block).
If the target interleave goes down by more than 50%, we re-adjust it once
we know we have gone past a safe distance (2 x current max_size.time).

This mode can only be used for incoming streams that are guaranteed to be
properly timestamped.

Furthermore, we ignore sparse streams when calculating interleave and maximum
size of queues.

For the simplest of use-cases (single stream), multiqueue acts as a single
queue with a time limit of 250ms.
If there are multiple inputs, but each come from a different streaming thread,
the maximum time limit will also end up being 250ms.

On regular files (more than one input stream from the same upstream streaming
thread), it can reduce the total memory used as much as 10x, ending up with
max_size.time around 500ms.

Due to the adaptive nature, it can also cope with changing interleave (which
can happen commonly on some files at startup/pre-roll time)
2015-12-02 16:03:20 +01:00
Vincent Penquerc'h
f6069c2c72 multiqueue: use new stream-start event sparse flag to avoid overreading subtitles
This will mean a much lower delay before a subtitles track changes take
effect. Also avoids excessive memory usage in many cases.

This will also consider sparse streams as (individually) never full, so
as to avoid blocking all playback due to one sparse stream.

https://bugzilla.gnome.org/show_bug.cgi?id=600648
2015-12-02 16:03:20 +01:00
Edward Hervey
785edec270 multiqueue: Fix high_time computation
* Avoid the computation completely if we know we don't need it (not in
  sync time mode)
* Make sure we don't override highest time with GST_CLOCK_TIME_NONE on
  unlinked pads
* Ensure the high_time gets properly updated if all pads are not linked
* Fix the comparision in the loop whether the target high time is the same
  as the current time
* Split wake_up_next_non_linked method to avoid useless calculation

https://bugzilla.gnome.org/show_bug.cgi?id=757353
2015-12-02 16:03:16 +01:00
Jan Schmidt
725a71ea0c queue2: Don't report 0% unless empty
When preparing a buffering message, don't report 0% if there
is any bytes left in the queue at all. We still have something
to push, so don't tell the app to start buffering - maybe
we'll get more data before actually running dry.
2015-12-02 19:32:12 +11:00
Luis de Bethencourt
d0624eb945 docs: update gst-launch-0.10 lines
Update references to gst-launch-0.10 to gst-launch-1.0
2015-11-19 17:25:01 +00:00
Tim-Philipp Müller
ffecef4fa0 queue2: don't print criticals when receiving custom events in ring buffer mode
Downgrade from g_warning to GST_WARNING log message.

https://bugzilla.gnome.org/show_bug.cgi?id=758276
2015-11-18 11:46:45 +00:00
Aleix Conchillo Flaqué
2c238705a1 identity: add drop-buffer-flags property
New property drop-buffer-flags that will discard buffers that have the
given flags set.

https://bugzilla.gnome.org/show_bug.cgi?id=751182
2015-11-13 07:37:12 -08:00
Duncan Palmer
45fa81e564 queue2: Add the avg-in-rate property.
https://bugzilla.gnome.org/show_bug.cgi?id=733959
2015-11-06 12:32:16 -03:00
Philippe Normand
8ae8b2723d queue2: add overrun signal
Notifies that the queue2 is full, same as queue does

https://bugzilla.gnome.org/show_bug.cgi?id=733959
2015-11-06 12:32:10 -03:00
Anton Bondarenko
f468eb7db0 filesink: continue element cleanup even if fclose fails
Sometimes filesink cleanup during stop may fail due to fclose error.
In this case object left partial cleanup with no file opened
but still holding old file descriptor.

It's not possible to change location property in a such state,
so next start will cause old file overwrite if 'append' does not set.

According to man page and POSIX standard about fclose behavior(extract):
------------------------------------------------------------------------
The fclose() function shall cause the stream pointed to by stream
to be flushed and the associated file to be closed.
...
Whether or not the call succeeds, the stream shall be disassociated
from the file and any buffer set by the setbuf() or setvbuf()
function shall be disassociated from the stream.
...
The fclose() function shall perform the equivalent of a close()
on the file descriptor that is associated with the stream
pointed to by stream.

After the call to fclose(), any use of stream results
in undefined behavior.
------------------------------------------------------------------------

So file is in 'closed' state no matter if fclose succeed or not.
And cleanup could be continued.

https://bugzilla.gnome.org/show_bug.cgi?id=757596
2015-11-05 10:17:41 +01:00
Edward Hervey
a9c923d585 queue/queue2: Use GST_BUFFER_DTS_OR_PTS
The input of queue/queue2 might have DTS set, in which cas we want
to take that into account (instead of the PTS) to calculate position
and queue levels.

https://bugzilla.gnome.org/show_bug.cgi?id=756507
2015-10-27 08:49:02 +01:00
Edward Hervey
692c0dc060 multiqueue: Use buffer DTS if present, else PTS
In order to accurately determine the amount (in time) of data
travelling in queues, we should use an increasing value.

If buffers are encoded and potentially reordered, we should be
using their DTS (increasing) and not PTS (reordered)

https://bugzilla.gnome.org/show_bug.cgi?id=756507
2015-10-27 08:38:42 +01:00
Edward Hervey
7c8f76a39f multiqueue: Improve incoming SEGMENT handling
Previously this code was just blindly setting the cached flow return
of downstream to GST_FLOW_OK when we get a SEGMENT.

The problem is that this can not be done blindly. If downstream was
not linked, the corresponding sinqlequeue source pad thread might be
waiting for the next ID to be woken up upon.

By blindly setting the cached return value to GST_FLOW_OK, and if that
stream was the only one that was NOT_LINKED, then the next time we
check (from any other thread) to see if we need to wake up a source pad
thread ... we won't even try, because none of the cached flow return
are equal to GST_FLOW_NOT_LINKED.

This would result in that thread never being woken up

https://bugzilla.gnome.org/show_bug.cgi?id=756645
2015-10-19 14:31:05 +02:00
Edward Hervey
14ad763698 multiqueue: Accept STREAM_START after EOS
In the same way core now allows STREAM_START to remove the flushing
state from pads, we need to do the same thing in multiqueue
2015-10-15 17:21:40 +02:00
Thiago Santos
7f5f1df59b capsfilter: remove proxying of accept-caps downstream
The design is to only do a local check
2015-09-26 07:13:45 -03:00
Stian Selnes
2c60b7eb1f funnel: Fix racy state change
Iterator may need to be resynced, for instance if pads are released
during state change.

got_eos should be protected by the object lock of the element, not of
the pad, as is the case throughout the rest of the funnel code.

https://bugzilla.gnome.org/show_bug.cgi?id=755343
2015-09-24 12:14:57 +02:00
Eunhae Choi
ebd2748cd0 inputselector: Fix buffer leak in sync_streams & cache_buffers mode
After doing gst_pad_push() in case of sync_streams and cache_buffers,
if the buffer can not be kept in cache, it should be unreffed to avoid
memory leackage.

https://bugzilla.gnome.org/show_bug.cgi?id=755141
2015-09-21 10:33:55 +02:00
Vineeth TM
fcdfcbd618 downloadbuffer, benchmarks: fix error leaks in failure code paths
https://bugzilla.gnome.org/show_bug.cgi?id=755019
2015-09-15 18:21:58 +01:00
Tim-Philipp Müller
c55bfecc55 Revert "queue2: Process SEEKING query"
This caused problems with oggdemux when queue2 was
operating in queue mode and the souphttpsrc upstream
is not seekable because the server doesn't support
range requests. It would then still claim seekability
and then things go wrong from there.

This reverts commit 7b0b93dafe.

https://bugzilla.gnome.org/show_bug.cgi?id=753887
2015-08-31 12:07:10 +01:00
Eunhae Choi
ed7e0e744f queue2: not update upstream size with negative value
upstream_size can be negative but queue->upstream_size is unsigned type.
to get a chance to update queue->upstream_size in gst_queue2_get_range()
it should keep the default value.

https://bugzilla.gnome.org/show_bug.cgi?id=753011
2015-08-04 07:03:24 -03:00
Stefan Sauer
3ee4d608c2 filesink: use GST_INFO_OBJECT for more detail
Helps to distiguish multiple filesinks.
2015-08-04 00:12:57 +02:00
Nicolas Dufresne
1177291e1e doc/capsfilter: Document filtering modes
This is documentation for the HTML documentation.
2015-07-28 16:57:43 -04:00
Nicolas Dufresne
25fa87a9e4 doc/filesink: Add BufferMode enumeration
This is purely for documentation purpose. This way the values will
show up in the HTML documentation.
2015-07-28 16:57:36 -04:00
Sebastian Dröge
a30c4cf721 capsfilter: Only remember previous filter caps if they were actually used for something
If nobody ever saw the previous filter caps, nothing could've negotiated with
them and we can just pretend they never existed at all.
2015-07-28 14:16:35 +03:00
Sebastian Dröge
4e2eb93f04 capsfilter: When switching caps change modes, forget all previous caps 2015-07-28 14:16:35 +03:00
Thiago Santos
0accb7f700 concat: dot not reset pad states too early
Resetting the flushing state of the pads at the end of the
PAUSED_TO_READY transition will make pads handle serialized
queries again which will wait for non-active pads and might
cause deadlocks when stopping the pipeline.

Move the reset to the READY_TO_PAUSED instead.

https://bugzilla.gnome.org/show_bug.cgi?id=752623
2015-07-21 00:22:25 -03:00
Tim-Philipp Müller
a7ea17a83d tee: fix typo in allow-not-linked property description 2015-07-14 12:44:31 +01:00
Justin Joy
6c93236462 docs: add StreamidDemux to documentation
https://bugzilla.gnome.org/show_bug.cgi?id=749873
2015-07-08 17:07:49 +01:00
Havard Graff
ee63702d61 identity: refactor and add tests using GstHarness
Writing a test for unscheduling the gst_clock_id_wait inside the
identity element, found an invalid read, caused by removing the clock-id
when calling _unschedule instead of letting the code calling _wait remove
the clock-id after being unscheduled.

https://bugzilla.gnome.org/show_bug.cgi?id=752055
2015-07-07 13:05:34 +03:00
Tim-Philipp Müller
41fdf21a60 queue: avoid slice allocs/frees for each item
Microoptimisation: Let GstQueueArray store our
item struct. That way we don't have to alloc/free
temporary QueueItem slices for every item we want
to put into the queue.

https://bugzilla.gnome.org/show_bug.cgi?id=750149
2015-07-04 11:07:19 +01:00
Stefan Sauer
c11e5d0f7d docs: another sweep canonicalizing the plugin docs sections file
Use underscores for capsfilter macros. Correct the type-name for fakesrc
if we ever implement the enum.
2015-07-03 12:39:57 +02:00
Stefan Sauer
feadd6a1f1 docs: order and canonicalize the -sections.txt file
Have all sections in alphabetical order. Also make the macro order consistent.
This is a preparation for generating the file. Remove GET_CLASS macro for
typefine element, since it is not used and the header is not installed.
2015-07-03 11:52:22 +02:00
Luis de Bethencourt
c635f38cdc inputselector: remove always-true check
event can't be NULL, it has been dereferenced by GST_EVENT_TYPE (), and no
case frees the pointer. Remove unnecessary check which will always be True.

CID #1308955
2015-07-02 15:10:58 +01:00
Miguel París Díaz
c2e15651be funnel: add "forward-sticky-events" property
It is useful to avoid sending sticky event on stream changes.

https://bugzilla.gnome.org/show_bug.cgi?id=749315
2015-06-25 10:53:55 +02:00
Song Bing
e9c9a1e3e2 inputselector: Handle different duration track selection
Support track switch from EOS track to non-EOS one.

https://bugzilla.gnome.org/show_bug.cgi?id=750761
2015-06-23 15:28:13 +02:00
Mathieu Duponchelle
056283ff85 concat: when releasing pad, send EOS appropriately.
Previously, concat sent an EOS if there was a next pad.

https://bugzilla.gnome.org/show_bug.cgi?id=751107
2015-06-22 14:15:28 +02:00
Carlos Rafael Giani
c50e47343a concat: Add adjust-base property
This disables the segment.base adjustments, which is useful if downstream
takes care of base adjustments already (example: a combination of concat
and streamsynchronizer)

https://bugzilla.gnome.org/show_bug.cgi?id=751047
2015-06-22 14:11:30 +02:00
Tim-Philipp Müller
7be8acbfb0 typefindelement: reset segment only once streaming has stopped
Fixes the occasional criticals in the discoverer unit test.

https://bugzilla.gnome.org/show_bug.cgi?id=745073
https://bugzilla.gnome.org/show_bug.cgi?id=750823
2015-06-14 21:25:29 +01:00
Tim-Philipp Müller
f190d01e0d gst_writev: define UIO_MAXIOV on iOS/OSX
Apparently it's only seton iOS/OSX if defined(KERNEL).
2015-06-11 23:06:26 +01:00
Jan Schmidt
e08db722f5 gst_writev: Respect UIO_MAXIOV limit for the iov array
If we receive more than UIO_MAXIOV (1024 typically) buffers
in a single writev call, fall back to consolidating them
into one output buffer or multiple write calls.

This could be made more optimal, but let's wait until it's
ever a bottleneck for someone
2015-06-12 01:17:24 +10:00
Carlos Rafael Giani
77b6352194 concat: Add active-pad property
https://bugzilla.gnome.org/show_bug.cgi?id=746949
2015-06-11 12:02:30 +02:00
Sebastian Dröge
d8db88d078 concat: Also reset the current start offset when receiving a FLUSH_STOP on the srcpad 2015-06-11 11:05:53 +02:00
Sebastian Dröge
c324e31c26 concat: Add some newlines to event handling code to make the code look a bit less dense 2015-06-11 11:05:38 +02:00
Carlos Rafael Giani
25c66e6004 concat: Reset segment base offset after FLUSH_STOP with reset_time = TRUE
If the reset_time value of a FLUSH_STOP event is set to TRUE, the pipeline
will have the base_time of its elements reset. This means that the concat
element's current_start_offset has to be reset to 0, since it was
calculated with the old base-time in mind.

Only FLUSH_STOP events coming from the active pad are looked at.

Signed-off-by: Carlos Rafael Giani <dv@pseudoterminal.org>
2015-06-11 11:03:18 +02:00
Carlos Rafael Giani
426a6ea644 concat: Forward FLUSH_START and FLUSH_STOP events
Without this, seeking deadlocks if performed while the pipeline is paused.
Only flush events coming from the active pad are forwarded.

https://bugzilla.gnome.org/show_bug.cgi?id=745366
2015-06-10 11:51:49 +02:00
Edward Hervey
084f6859ea filesink: Fix fsync/_commit usage
_MSC_VER will only be defined when building *on* windows and not just
*for* windows. Instead, use the G_OS_WIN32 define
2015-06-09 11:03:28 +02:00
Jan Schmidt
ef2a4083af filesink: Fix Windows build by using _commit instead of fsync. 2015-06-09 00:52:34 +10:00
Jan Schmidt
ade4a83e63 Add GST_BUFFER_FLAG_SYNC_AFTER flag, and implement in filesink.
Makes it possible to get filesink to fsync() after rendering
a buffer.
2015-06-08 19:13:18 +10:00
Sebastian Dröge
91f537edf2 typefind: Post an error if we can't typefind the data until EOS
https://bugzilla.gnome.org/show_bug.cgi?id=750439
2015-06-05 10:02:04 +02:00
eunhae choi
e921ee132b downloadbuffer: release lock before posting msg
to avoid the deadlock in playbin2,
send msg after release the download buffer lock.

https://bugzilla.gnome.org/show_bug.cgi?id=749535
2015-06-01 14:05:16 -03:00
Sebastian Dröge
179ba9f182 funnel: Improve debug output a bit 2015-05-27 13:54:37 +02:00
Tim-Philipp Müller
19e5356afd Revert "doc: Workaround gtkdoc issue"
This reverts commit 460a7bf682.

This should be fixed by the gtk-doc 1.23 release.

<para> cannot contain <refsect2>:
http://www.docbook.org/tdg/en/html/para.html
http://www.docbook.org/tdg/en/html/refsect2.html
2015-05-18 13:13:55 +01:00
Wim Taymans
1d1f76a328 sparsefile: small cleanup
The error path unrefs file->file so make sure we only go there when
there is a non-NULL file->file.
2015-05-18 11:26:07 +02:00
Nicolas Dufresne
460a7bf682 doc: Workaround gtkdoc issue
With gtkdoc 1.22, the XML generator fails when a itemizedlist is
followed by a refsect2. Workaround the issue by wrapping the refsect2
into para.
2015-05-16 23:29:03 -04:00
Tim-Philipp Müller
8c85795e92 fakesrc: fix property description
We're enterprise now folks.
2015-05-15 20:44:08 +01:00
Víctor Manuel Jáquez Leal
aafce9bea1 fdsrc: docs: fix and update documentation
Update example to use gst-launch-1.0 and fix a paragraph.

https://bugzilla.gnome.org/show_bug.cgi?id=749233
2015-05-12 10:15:22 +01:00
Tim-Philipp Müller
1a9a3c7ef9 docs: gst-launch -> gst-launch-1.0 in example pipelines
And some small example pipeline fix-ups.
2015-05-10 11:35:50 +01:00
Olivier Crête
d1620f1c2e identity: Also synchronize GAP events in sync=1
https://bugzilla.gnome.org/show_bug.cgi?id=601853
2015-04-27 12:27:40 -04:00
Olivier Crête
5ea338907c identity: With sync=true, don't pre-roll
To act like a real live element, block the streaming when paused, and
return NO_PREROLL.

https://bugzilla.gnome.org/show_bug.cgi?id=601853
2015-04-27 12:27:40 -04:00
Olivier Crête
7807296afd identity: Take upstream latency into account for sync=1
https://bugzilla.gnome.org/show_bug.cgi?id=601853
2015-04-27 12:27:40 -04:00
Olivier Crête
f2992654ca identity: Handle PTS and DTS separately
https://bugzilla.gnome.org/show_bug.cgi?id=601853
2015-04-27 12:27:40 -04:00
Tim-Philipp Müller
8e6561be91 Remove obsolete Android build cruft
This is not needed any longer.
2015-04-26 17:49:44 +01:00
Thiago Santos
88a898080a inputselector: Only try to push the first EOS received
Subsequent EOS will push on the source pad that already received
EOS and that will make the event function return FALSE. It needs
only to push the first one and only return TRUE for the subsequent
ones.
2015-04-24 17:19:49 -03:00
Tim-Philipp Müller
3191440485 tee: fix use of possibly-freed pad in debug statement
The gst_object_unref() in the block above may be dropping
the last ref to the pad and free the pad. Set pad pointer
to NULL here, so that we don't accidentally use a
possibly-freed pad pointer in the debug log statements
further below, and also use the tee element as log object
since that's more appropriate anyway.

Fixes valgrind warnings and crashes in tee test_stress
unit test when debug logging is enabled.
2015-04-18 12:01:54 +01:00
Sebastian Dröge
d70631fe99 typefindelement: Use gst_event_unref() instead of gst_mini_object_unref() + casting 2015-04-13 17:01:41 +02:00
Guillaume Desmottes
15fd78f0b6 typefind: fix leak in gst_type_find_element_src_event()
gst_type_find_element_src_event() is supposed to consume @event but wasn't
doing so when it was handling the event itself.

https://bugzilla.gnome.org/show_bug.cgi?id=747775

Signed-off-by: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
2015-04-13 10:33:41 -03:00
Sebastian Dröge
6409420474 typefind: Run the default have-type handler after all application handlers
Otherwise the CAPS event will already be forwarded downstream and
the application has no way to intervene anymore.

https://bugzilla.gnome.org/show_bug.cgi?id=735896
2015-04-13 09:04:14 +02:00
Duncan Palmer
0ad06434da multiqueue: Don't automatically enter the buffering state when use-buffering is set.
There is no reason I can see to set mq->buffering = TRUE when
use_buffering is set; the code here also calls update_buffering(), which
will set mq->buffering = TRUE if this is warranted because of low buffer
levels.

https://bugzilla.gnome.org/show_bug.cgi?id=745937
2015-04-10 10:40:00 -03:00
Guillaume Desmottes
b15e6f4bf0 inputselector: fix cached buffer leak in chain function
gst_selector_pad_chain() was popping cached buffers out of the queue without
freeing those. Make sure we don't steal the GstBuffer as the cached buffer ref
has been passed to the pad chain function.

This can be reproduced by running the
validate.file.playback.switch_subtitle_track_while_paused.test5_mkv scenario
with Valgrind.

https://bugzilla.gnome.org/show_bug.cgi?id=747611

Signed-off-by: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
2015-04-10 09:27:30 -03:00
Jose Antonio Santos Cadenas
3e8e0a7065 tee: Add allow-not-linked property
This property avoids not linked error when all the pads are unlinked
or when there are no source pads. This is useful in dynamic pipelines
where it can happen that for a short time there are no pads at all or
all downstream pads are not linked yet.

https://bugzilla.gnome.org/show_bug.cgi?id=746436
2015-03-26 10:46:26 +01:00
Thiago Santos
25295ee285 output-selector: add drain handling
Release the latest buffer, if any, and then just let
the drain be pushed downstream
2015-03-24 16:21:23 -03:00
Jan Alexander Steffens (heftig)
27644a6bd2 input-selector: Rename _activate_sinkpad to _get_active_sinkpad
Removes the now unused 'pad' parameter and renames the function
to something more appropriate.

https://bugzilla.gnome.org/show_bug.cgi?id=739620
2015-03-24 10:34:27 -03:00
Jan Alexander Steffens (heftig)
bf8a71104c input-selector: Remove pad's 'active' field
This is now never read.

https://bugzilla.gnome.org/show_bug.cgi?id=739620
2015-03-24 10:34:27 -03:00
Jan Alexander Steffens (heftig)
6f24f4917d input-selector: Use segment-presence for running_time check
When determining whether the running_time of a pad can be
calculated, check if the segment is in TIME format instead
of using the 'active' field.

Since the latter is set through *any* activity, it's not a
reliable indicator of segment presence.

https://bugzilla.gnome.org/show_bug.cgi?id=739620
2015-03-24 10:34:27 -03:00
Jan Alexander Steffens (heftig)
0a3ded1932 input-selector: Remove 'blocked' flag
With the disappearance of the 'block' signal, this
flag cannot be set to TRUE.

gst_input_selector_wait disappears as it never waits
and just returns self->flushing.

https://bugzilla.gnome.org/show_bug.cgi?id=736891
2015-03-24 09:42:14 -03:00
Jan Alexander Steffens (heftig)
7a1ebbe0e3 input-selector: Remove obsolete 'block' signal
This signal blocks the input-selector with no means of unblocking
other than a state change back to READY. It seems this signal was
part of an old way of synchronously switching the selector,
together with the already-removed 'switch' signal.

Removing the signal is safe, as attempting to use it could only
end in deadlocks. Attempting to emit an unknown signal just causes
g_criticals.

https://bugzilla.gnome.org/show_bug.cgi?id=736891
2015-03-24 09:42:14 -03:00
Jan Alexander Steffens (heftig)
ce663311e1 input-selector: Fix waiting on EOS
This apparently got broken by bc1ec4e. Since self->blocked is always
FALSE, gst_input_selector_wait never actually waits.

Using (!self->eos || self->blocked) && ... as the loop condition would
be incorrect as well, because then the other call to the function in
_chain would block until EOS, so the functions cannot be merged trivially.

Since blocking is obsolete, gst_input_selector_wait will get removed anyway.
As such, just inline the loop.

https://bugzilla.gnome.org/show_bug.cgi?id=746518
2015-03-24 09:28:44 -03:00
Jan Alexander Steffens (heftig)
7b0b93dafe queue2: Process SEEKING query
Add QUERY_SEEKING handling to queue2, so RTMP live streams become
seekable when a queue2 in download or ringbuffer mode is inserted:

rtmpsrc ! queue2 ! flvdemux

https://bugzilla.gnome.org/show_bug.cgi?id=733351
2015-03-23 10:47:41 +01:00
Sebastian Dröge
6a6188a82f valve: Don't drop non-serialized queries when the valve is dropping
Otherwise we end up dropping e.g. CAPS queries, and then upstream just
negotiates to whatever format it wants to. Once the valve is not-dropping
anymore this can easily result in negotiation failing completely.

https://bugzilla.gnome.org/show_bug.cgi?id=746448
2015-03-20 09:32:34 +01:00
Sebastian Dröge
78bdbadc4e funnel: Add support for buffer lists 2015-03-18 09:37:47 +01:00
Sebastian Dröge
5fc2a3fd66 multiqueue: Don't grow queue infinitely if only one pad is linked
This was introduced by
https://bugzilla.gnome.org/show_bug.cgi?id=719893
https://bugzilla.gnome.org/show_bug.cgi?id=722891
but it doesn't make any sense at all and causes huge memory leaks.

https://bugzilla.gnome.org/show_bug.cgi?id=744253
2015-03-15 14:19:17 +00:00
Sebastian Dröge
ad161f7df5 streamiddemux: Reset pad counter after removing all pads 2015-03-12 14:42:18 +00:00
HoonHee Lee
fadabe8b78 streamiddemux: Add streamiddemux element
Demultiplex a stream to multiple source pads based on the stream ids from the
stream-start events. This basically reverses the behaviour of funnel.

https://bugzilla.gnome.org/show_bug.cgi?id=707605
2015-03-12 14:42:18 +00:00
Sebastian Dröge
53e8e7da75 typefind: Reset segment when deactivating pull mode or not running in pull mode
We use the segment format to detect if we run the streaming thread or not.
Without resetting we might believe we do so, although we only did in the past
and are now running in e.g. push mode.

https://bugzilla.gnome.org/show_bug.cgi?id=745073
2015-03-12 12:59:57 +00:00
hoonhee.lee
8ce1f4d470 funnel: handle GAP event to forwards sticky events into downstream
If no data is coming and funnel receive GAP event, need to forwards sticky events
into downstream if it needs.

https://bugzilla.gnome.org/show_bug.cgi?id=738202
2015-03-10 16:15:35 -04:00
Sebastian Dröge
bc77a3fa0a queue2: Signal the sinkpad thread if a flow error happened
It might still be waiting for a query to be handled, or the queue to become
empty again for the next item. Also if downstream returns FLUSHING, flush the
queue like we do in queue and multiqueue.
2015-03-03 12:53:13 +01:00
Sebastian Dröge
a941b4651c queue: Wake up the query function on errors from the loop function
Otherwise we might wait forever for serialized queries to be handled as the
loop function is stopped and as such we will never ever dequeue the query and
handle it.

https://bugzilla.gnome.org/show_bug.cgi?id=745319
2015-03-03 12:49:47 +01:00
Arun Raghavan
49a4951a0c input-selector: Drop custom latency query handling
The default latency query handler now implements this logic
2015-02-27 00:49:06 +05:30
Mark Nauwelaerts
c3454a85c5 multiqueue: avoid returning downstream GST_FLOW_EOS from previous segment to current upstream segment 2015-02-23 20:08:20 +01:00
Sebastian Dröge
66e8d3b9a0 inputselector: Use a separate query for upstream pads and let it fail if one upstream query fails 2015-02-19 01:16:52 +02:00
Sebastian Dröge
f2b27d3962 queue: Remove unused boolean parameter from internal functions 2015-02-18 11:05:19 +02:00
Sebastian Dröge
6369ba06ff queue: Add support for buffer lists 2015-02-18 11:03:08 +02:00
Sebastian Dröge
927666642e queue2: Count the number of buffers in a buffer list for updating the current levels
instead of just assuming one buffer.
2015-02-18 11:03:08 +02:00
Frédéric Wang
d7dd082574 fdsrc: use g_ascii_strtoull() to convert size string in uri
sscanf() doesn't handle G_GUINT64_FORMAT well on mingw64 it
appears, leading to compiler warnings.

https://bugzilla.gnome.org/show_bug.cgi?id=744034
2015-02-12 14:50:15 +00:00
Sebastian Dröge
4a5ce862a2 Improve and fix LATENCY query handling
This now follows the design docs everywhere.

https://bugzilla.gnome.org/show_bug.cgi?id=744106
2015-02-11 17:53:04 +02:00
Sebastian Dröge
50de594718 output-selector: Constify negotiation mode GEnumValue table 2015-01-21 09:45:36 +01:00
Vincent Penquerc'h
0bd45dc401 identity: send gap events when dropping buffers 2015-01-14 10:52:40 +00:00
Sebastian Dröge
29d8b9df8b inputselector: Don't dereference NULL pointer
CID 1262286
2015-01-12 16:03:31 +01:00
Tim-Philipp Müller
3390b70d78 inputselector: fix silly GQueue iteration code
Not active by default though.
2015-01-05 00:22:11 +00:00
Sebastian Dröge
bc1ec4ec5f inputselector: Use the same waiting function for EOS and non-EOS waiting 2014-12-24 13:46:28 +01:00
Sebastian Dröge
a1c183417f inputselector: Wake up all waitings pads directly if we forward the EOS event
Otherwise they might wait a bit longer unnecessarily.

Also do some minor cleanup.
2014-12-24 13:44:09 +01:00
Song Bing
11e4b744f5 inputselector: Block when receiving an EOS event on a deactivated pad
... and only unblock when either a) the pad becomes active and the event
should be forwarded or b) the active pad went EOS itself.

Otherwise it can happen that we switch from a longer track that is not EOS yet
to a shorter track that already is EOS, but the shorter track won't have any
possibility to send its EOS event downstream anymore.

https://bugzilla.gnome.org/show_bug.cgi?id=740949
2014-12-24 13:33:12 +01:00
Sebastian Dröge
12a905929f inputselector: Keep a ref of the currently active sinkpad around
Otherwise we can't be sure that the pointer points to a still existing
pad instance after releasing the lock.
2014-12-23 12:54:50 +01:00
Song Bing
3137043c3a inputselector: Get the active sinkpad again after taking the lock when handling events
It might have changed in the meantime.

https://bugzilla.gnome.org/show_bug.cgi?id=741893
2014-12-23 12:53:58 +01:00
Tim-Philipp Müller
ed15125086 typefind: minor cosmetic change
No nee to abbrev variab nam here, nicer to read if full.
2014-12-10 11:17:25 +00:00
Tim-Philipp Müller
691bd8bd87 typefind: use GST_BUFFER_OFFSET_NONE for buffer offset 2014-12-10 11:16:09 +00:00
Edward Hervey
f1c2cd60c3 typefind: Propagate input buffer offset
The initial buffers might have non-default offsets, make sure they get
propagated if present.
2014-12-01 10:47:01 +01:00
Sebastian Dröge
154eefecc9 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.

Also normalize booleans in a few places.
2014-12-01 09:51:37 +01:00
Tim-Philipp Müller
f2e4c25588 plugins: fix build on windows
gstelements_private.c: In function 'gst_writev_buffers':
gstelements_private.c:236:51: error: 'EWOULDBLOCK' undeclared
2014-11-30 23:56:06 +00:00
Tim-Philipp Müller
5b50f39015 filesink: use writev() in ::render() to write out memories without merging them 2014-11-30 14:40:46 +00:00
Tim-Philipp Müller
5a4fb5c314 filesink: implement ::render_list() function that uses writev() 2014-11-30 14:40:46 +00:00
Tim-Philipp Müller
ad3e12b006 fdsink: use writev() in ::render() to write out memories without merging them 2014-11-30 14:40:46 +00:00
Tim-Philipp Müller
dc73245edd fdsink: implement ::render_list() using writev()
Write out multiple buffers possibly containing multiple
memories with one writev() call, without merging the
buffer memories first, like ::render() does currently.
2014-11-30 14:40:46 +00:00
Tim-Philipp Müller
66bdae5f33 plugins: add helper function for writing buffers out with writev() 2014-11-30 14:40:46 +00:00
Thiago Santos
8d835ec400 queue2: percentage is relative to high-percent
When comparing percentage values, compare with 0-100 scale as it
has already been made relative to 0-high_percent, otherwise we mark
the queue as not buffering and report a 50% to the user. This leads to
a buffering stall as the user assumes the queue is still buffering but
it thinks it isn't.

https://bugzilla.gnome.org/show_bug.cgi?id=736969
2014-11-23 05:51:12 -03:00
Thiago Santos
5a759011a0 multiqueue: percentage is an absolute value
multiqueue's queues stored percent value is the percentage from 0
to 100 (max-size-*) and should be compared with the requested limit
(high_percentage) set by the user and not with 100% to check if
buffering should stop. Otherwise we are only stopping buffering when the
queue gets completely full.
2014-11-23 05:51:12 -03:00
Sebastian Dröge
9606e04895 capsfilter: Add an optional delayed caps change mode
In this mode we accept previously set filter caps until
upstream renegotiates to something that is compatible
to the current filter caps.

This allows dynamic caps changes in the pipeline even
if there is a queue between any conversion element
and the capsfilter. Without this we would get not-negotiated
errors if timing is bad.

https://bugzilla.gnome.org/show_bug.cgi?id=739002
2014-11-03 08:09:21 +01:00
Stefan Sauer
9a66e3169f identity: include the actual delta in the message
Including the actual delta in the message makes it easy to see, if the new
buffer is behind or ahead and how much.
2014-10-20 16:39:38 +02:00
Andrei Sarakeev
ee93c807e1 multiqueue: Wake up any waiting streams if the current one goes EOS
Otherwise we might have unlinked streams waiting.

https://bugzilla.gnome.org/show_bug.cgi?id=738198
2014-10-20 12:31:42 +02:00
Aleix Conchillo Flaqué
41fa9ad9f2 multiqueue: don't lock multiqueue when pushing serialized queries
If we are pushing a serialized query into a queue and the queue is
filled, we will end in a deadlock. We need to release the lock before
pushing and acquire it again afterward.

https://bugzilla.gnome.org/show_bug.cgi?id=737794
2014-10-09 11:49:49 +03:00
Tim-Philipp Müller
64a0abb0f4 inputselector: fix compilation 2014-10-03 14:04:58 +01:00
Stefan Sauer
e3dc7366bd input-selector: extract some common code into helpers 2014-10-03 14:44:48 +02:00
Stefan Sauer
8285002693 input-selector: small code cleanups
Rename TIMESTAMP -> PTS. Move a var down to the scope where it is used. Use
g_queue_free_full().
2014-10-03 14:22:01 +02:00
Stefan Sauer
d8bee3c769 inputselector: fix printf format
The padcount is uint. Also add comments to the instance vars.
2014-10-03 13:47:42 +02:00