Commit graph

2210 commits

Author SHA1 Message Date
Edward Hervey
08ad748ced concat: Make QoS forward MT-safe
In the same way it's done for other event forwarding.
2017-11-09 17:41:51 +01:00
Reynaldo H. Verdejo Pinochet
402159fb88 Use proper GtkDoc notation for NULL/FALSE/TRUE 2017-10-03 13:54:25 -07:00
Stefan Sauer
21c3f0ff22 tee: don't create a pool if none is needed
If the aggregated size is 0 and we create a pool, the pool would provide
buffers with no memory assigned. Handle that case and skip the pool.
This was the behaviour before cf803ea9f4.

Add a test for this scenario.

https://bugzilla.gnome.org/show_bug.cgi?id=730758
2017-10-02 13:58:04 -04:00
Mathieu Duponchelle
053f1523ad Multiqueue: don't allow dropping SEGMENT_DONE events
https://bugzilla.gnome.org/show_bug.cgi?id=780795
2017-09-18 14:12:06 +02:00
Tim-Philipp Müller
c2917b1ae2 plugins: use new gst_buffer_list_calculate_size() 2017-09-17 12:36:03 +01:00
Nicolas Dufresne
2cc5c539a3 identity: Add a drop-allocation property
When enabled, this property will make the allocation query fail. This is
the same as one could have done using a tee before the tee started
implementing the allocation query.

https://bugzilla.gnome.org/show_bug.cgi?id=730758
2017-09-06 10:03:20 -04:00
Nicolas Dufresne
1cd0dd3503 tee: Allocate one more buffer when multi-plexing
This extra buffer ensure that the downstream threads are not starved
when multiplexing a stream.

https://bugzilla.gnome.org/show_bug.cgi?id=730758
2017-09-05 16:00:09 -04:00
Nicolas Dufresne
cf803ea9f4 tee: Implement allocation query aggregation
This will aggregate allocation params, pool and will keep all
meta that has no parameters.

https://bugzilla.gnome.org/show_bug.cgi?id=730758
2017-09-05 16:00:09 -04:00
Nicolas Dufresne
945322f5a6 tee: Deprecate alloc-pad property
It has no effect, not implemented, and would lead to bad rendering.

https://bugzilla.gnome.org/show_bug.cgi?id=730758
2017-09-05 15:59:46 -04:00
Sebastian Dröge
82ed369991 identity: Return FLUSHING instead of EOS and don't start waiting for anything if currently flushing
Otherwise we might try unscheduling a clock id (that does not exist
yet), then the streaming thread waits for id and the state change never
continues because the streaming thread is blocked.

Also shutting down and flushing and similar should return FLUSHING, not
EOS. The stream is not over, we're just not accepting any buffers
anymore.
2017-08-16 22:50:49 +03:00
Sebastian Dröge
36372a9f4c queue: Allow re-usability after EOS
After EOS, it is possible for a pad to be resetted by sending
either a STREAM_START or SEGMENT event

Mimic the same behaviour when receiving STREAM_START/SEGMENT events
in queue if we are EOS'd

https://bugzilla.gnome.org/show_bug.cgi?id=786056
2017-08-11 11:12:09 +03:00
Edward Hervey
6566eff20d queue2: Allow re-usability after EOS
After EOS, it is possible for a pad to be resetted by sending
either a STREAM_START or SEGMENT event

Mimic the same behaviour when receiving STREAM_START/SEGMENT events
in queue2 if we are EOS'd

https://bugzilla.gnome.org/show_bug.cgi?id=786056
2017-08-09 16:18:40 +02:00
Edward Hervey
e2f8dc0aef plugins: *queue* elements: Handle STREAM_START in EOS situation
When queue-like elements are in "EOS" situation (received GST_FLOW_EOS
from downstream or EOS was pushed), they drain buffers/events that
wouldn't be processed anyway and let through events that might
modify the EOS situation.

Previously only GST_EVENT_EOS and GST_EVENT_SEGMENT events were let
through, but we also need to allow GST_EVENT_STREAM_START to go
through since it resets the EOS state of pads since 1.6

https://bugzilla.gnome.org/show_bug.cgi?id=786034
2017-08-09 10:54:17 +02:00
Edward Hervey
4312119d16 queue2: Handle buffering levels on NOT_LINKED
When downstream returns NOT_LINKED, we return the buffering level
as being 100%.

Since the queue is no longer being consumed/used downstream, we
want applications to essentially "ignore" this queue for buffering
purposes.

If other streams are still being used, those stream buffering levels
will be used. If none are used, upstream will post an error message
on the bus indicating no streams are used.

https://bugzilla.gnome.org/show_bug.cgi?id=785799
2017-08-07 15:20:55 +02:00
Tim-Philipp Müller
6575389908 downloadbuffer: remove unused struct member
This was used in queue2 when handling in coming serialized
queries, but downloadbuffer just refuses serialized queries.
2017-07-26 14:20:44 +01:00
Edward Hervey
78ee0dfad1 multiqueue: Fix access to NULL pointer
sq can be NULL.

Also fix commit message (it's the queue we are iterating over that we
are logging, not the one passed as argument).

CID #1415569
2017-07-20 14:18:51 +02:00
Seungha Yang
1b0059e0c5 multiqueue: Calculate interleave only within each streaming thread
... and use the biggest interleave value among streaming threads.
This is to optimize multiqueue size adaptation on adaptive streaming
use case with "use-interleave" property.

https://bugzilla.gnome.org/show_bug.cgi?id=784448
2017-07-19 17:19:14 +02:00
Nicolas Dufresne
4a108c7858 meson: Use join_paths and .set_quoted where possible 2017-07-11 14:57:26 -04:00
Nicolas Dufresne
d143af2c77 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:29:38 -04:00
Thiago Santos
058bdcfe6b queue: avoid return flushing if we have a not-linked
Return the correct flow return instead of returning always flushing.
This would cause queue to convert not-linked to flushing and making
upstream elements stop.

Based on the previous patch for queue2.

https://bugzilla.gnome.org/show_bug.cgi?id=776999
2017-03-14 22:20:04 -07:00
Thiago Santos
045700e80e queue2: avoid return flushing if we have a not-linked
Return the correct flow return instead of returning always flushing.
This would cause queue2 to convert not-linked to flushing and making
upstream elements stop.

https://bugzilla.gnome.org/show_bug.cgi?id=776999
2017-03-11 11:19:33 -08:00
Wim Taymans
586b34436e buffer: handle gst_buffer_map failures 2017-03-10 10:13:05 +01:00
Wim Taymans
64a1d4ad0b downloadbuffer: unlock mutex in error case 2017-03-10 10:12:49 +01:00
Jan Schmidt
9b0a6ca7ab multiqueue: Make min-interleave-time a configurable property
Remove a FIXME about making the minimum interleave
buffering a configurable property
2017-03-09 12:09:57 +11:00
Seungha Yang
89082272f8 inputselector: Always proxy position/duration query
active-pad switch causes reconfigure event with lock taken,
and upstream element might query the current position or duration
before returning the reconfigure event.
Meanwhile, gst_input_selector_get_linked_pad() is used to get srcpad
inside of default query handle, and it takes also lock.
Since inputselector is still locked by active-pad switch, and so the query
cannot be handled further.

https://bugzilla.gnome.org/show_bug.cgi?id=775445
2017-03-07 12:48:47 +02:00
Thibault Saunier
a87b4551a6 Port gtk-doc comments to their equivalent markdown syntax
Modernizing our documentation and preparing a possible move to hotdoc.
This commits also adds missing @title metadatas to all SECTIONs
2017-01-27 16:36:38 -03:00
Jan Schmidt
0528645f7c identity: Add ts-offset property.
Add a property to delay or advance sync time
when sync=true, with the same behaviour as
the ts-offset property in basesink
2017-01-16 09:40:25 +11:00
Jan Schmidt
748687fc30 queue: Don't generate GST_FLOW_ERROR without logging
At least log a message to the debug log when generating
a GST_FLOW_ERROR, to make it possible to find where it came from.
2017-01-03 02:21:10 +11:00
Jan Schmidt
e64765c0d8 typefind: Switch to normal mode before have-type
Before emitting have-type, switch to NORMAL
mode, as part of the have-type processing sends
the caps event downstream, which might trigger
actions like downstream autoplugging or
flushing seeks - and the latter are only
passed upstream if we've set typefind to NORMAL
mode.
2016-12-21 00:40:10 +11:00
Sebastian Dröge
47f9223750 multiqueue: Protect against spurious wakeups of the condition variable 2016-12-18 13:59:12 +02:00
Sebastian Dröge
3fab00b46a queue/queue2: Protect against spurious condition variable wakeups
Make sure that we only wake up when we have to flush, or when this
specific query was handled.

https://bugzilla.gnome.org/show_bug.cgi?id=776039
2016-12-13 21:03:54 +02:00
Sebastian Dröge
33c239828b queue/queue2: Ensure that the streaming thread is unlocked after deactivating the srcpad
It might happen that the srcpad task function is never called at all, in
which case unlocking everything from there will never happen.

Make sure to unlock everything another time after the task function is
definitely stopped.

https://bugzilla.gnome.org/show_bug.cgi?id=776039
2016-12-13 21:03:54 +02:00
Edward Hervey
6b73bf38d1 filesrc: Set GError in another error case
When changing the location while open, properly set the GError regarding
the failure.
2016-12-12 16:19:13 +01:00
Seungha Yang
ce11ddeb0c multiqueue: Fix overflow on get_buffering_level()
guint64 denominator factor for gst_util_uint64_scale_int() can cause overflow

https://bugzilla.gnome.org/show_bug.cgi?id=775921
2016-12-11 13:30:52 +02:00
Sebastian Dröge
d284be3505 typefind: Use gst_query_has_scheduling_mode_with_flags() convenience function 2016-12-09 18:02:41 +02:00
Tim-Philipp Müller
cf7cfb0a0e fakesink, identity: print metas attached to buffer in silent=false mode 2016-12-05 20:29:25 +00:00
Sebastian Dröge
e02405b284 elements: Handle GstIterator RESYNC return value correctly in gst_iterator_foreach() 2016-12-05 11:01:45 +02:00
Nirbheek Chauhan
ad592f86b6 meson: Add Autotools changes that weren't mirrored
commits:
a7d282d272
6fdb4df0f8
1aceebd67f
2016-11-28 19:28:27 +05:30
Tim-Philipp Müller
1aceebd67f elements: add dataurisrc to build
Moved from -bad.
2016-11-28 11:19:12 +00:00
Tim-Philipp Müller
76c47b7e9c dataurisrc: fix string leak in property getter 2016-11-28 11:19:07 +00:00
Tim-Philipp Müller
a837ff6581 Move dataurisrc element from -bad
https://bugzilla.gnome.org/show_bug.cgi?id=774527
2016-11-28 11:18:39 +00:00
Olivier Crête
5216322d39 fdsink: Block in preroll_wait on unlock
The correct behaviour of anything stuck in the ->render() function
between ->unlock() and ->unlock_stop() is to call
gst_base_sink_wait_preroll() and only return an error if this returns an
error, otherwise, it must continue where it left off!

https://bugzilla.gnome.org/show_bug.cgi?id=773912
2016-11-23 11:58:43 -05:00
Jan Schmidt
fa3eac2d28 multiqueue: Make sure not-linked streams get woken up
When running in sync-by-running-time mode, pad groups
that have exactly 1 pad and it's not-linked might never
wake up after computing a high time, as the per-pad-group
high time was only recomputed when a pad in the group
advances.

Wake those up using the global multiqueue high-time across
all other groups instead.

https://bugzilla.gnome.org/show_bug.cgi?id=774322
2016-11-17 00:46:31 +11:00
Jan Schmidt
a6ca8dfb42 queues: Don't return negative position queries.
When subtracting queued data sizes from upstream queries
in queue, queue2, downloadbuffer and typefind, clamp the
result to not go negative, in case upstream returned
a nonsense value that's too small (as could happen if
upstream is estimating, or just broken)
2016-11-16 00:12:22 +11:00
Sebastian Dröge
abe60a92c4 funnel: Make sure to only lock the stream lock once
We also only unlock it once, and otherwise have it locked forever from
this thread, causing deadlocks on shutdown later.
2016-11-09 11:37:09 +02:00
Jan Schmidt
812d4976f0 fakesink: Add property to not drop out-of-segment buffers
Implement handling in basesink to not unconditionally discard
out-of-segment buffers and expose it as a new property on fakesink
(not unconditionally in all basesink based sinks).

The property defaults to FALSE.

https://bugzilla.gnome.org/show_bug.cgi?id=765734
2016-11-02 11:21:37 +11:00
Sebastian Dröge
c56e1d18c1 funnel: Always push all sticky events whenever we forward a serialized event
Otherwise downstream will have an inconsistent set of sticky events at this
point, e.g. when a TAG event is pushed and downstream wants to relate it to
the stream by looking at the current STREAM_START event.

https://bugzilla.gnome.org/show_bug.cgi?id=768526
2016-11-01 21:01:28 +02:00
Sebastian Dröge
25bf63d6f7 tee: Set GST_PAD_FLAG_PROXY_CAPS before forwarding sticky events
https://bugzilla.gnome.org/show_bug.cgi?id=752213
2016-11-01 20:53:43 +02:00
Sebastian Dröge
cfdb97a135 Revert "queue: Fix race when calculating cur_level.time"
This reverts commit d03bd54780.

It breaks the unit test, although it ensures that only correct values
are used for calculations. Needs to be fixed up.

https://bugzilla.gnome.org/show_bug.cgi?id=773096
2016-10-21 15:23:14 +03:00
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