Commit graph

2116 commits

Author SHA1 Message Date
Guillaume Desmottes 3bb5c1e73a leaks tracer: add checkpoint support using SIGUSR2
https://bugzilla.gnome.org/show_bug.cgi?id=767857
2016-07-08 11:23:43 +03:00
Guillaume Desmottes 53d2e8c977 leaks tracer: log alive objects when receiving SIGUSR1
We don't want to automatically catch signals so use an env variable to
enable this feature.

https://bugzilla.gnome.org/show_bug.cgi?id=767857
2016-07-08 11:23:38 +03: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
Tim-Philipp Müller 6446a1a45c tracers: leaks: some micro-optimisations
- we know number of filter items is not going to change,
  but compiler doesn't

- only do GST_IS_TRACER check for GObjects, not mini objects

- use non-type check cast macros in performance critical paths
2016-06-03 14:03:25 +01:00
Guillaume Desmottes 0bb7fa9855 tracers: add leaks tracer
https://bugzilla.gnome.org/show_bug.cgi?id=765052
2016-06-03 00:36:46 +01: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
Guillaume Desmottes e0757e1d80 rusage: properly free the queue memory
The queue is allocated as part of the tracer struct so we should not
use g_queue_free() to free it.

https://bugzilla.gnome.org/show_bug.cgi?id=764985
2016-04-13 12:40:41 +03: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 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
Stefan Sauer ec75b68984 tracerrecord: don't leak the spec structures
Change the gst_tracer_record_new() api to take the parameters the make the
spec structure directly. This allows us to own the top-level structure and
also collect the args so that we can take ownership of the sub-structures.

https://bugzilla.gnome.org/show_bug.cgi?id=760821
2016-01-22 10:07:26 +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
Stefan Sauer f69382c5f9 tracer/gststats: fix mismatch between '.class' and tracer args
Clean up from the recent changes. The logging descriptiors did not match what we logged.
2016-01-20 09:14:12 +01: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
Tim-Philipp Müller 8641d7c911 tracers: fix thread-id casts to 64-bit ints on 32-bit systems
https://bugzilla.gnome.org/show_bug.cgi?id=760762
2016-01-18 11:28:28 +00:00
Stefan Sauer 84554af301 tracer/stats: use the right log template
When porting we used the wrong record (copy and paste).
2016-01-16 21:23:10 +01:00
Stefan Sauer af91d23204 tracer: use the new flags to create the optional field in the format string
This spares us explicitly listing the field in the spec. and thus hide this
implementation detail.
2016-01-16 19:21:00 +01:00
Stefan Sauer 8cd76a918a tracer: add a GstTracerValueFlags and replace strings
This allows us to document the flags and makes the logs a bit smaller.
2016-01-16 18:52:32 +01:00
Tim-Philipp Müller 8b88fc487f gst.h: Don't spew warnings if GST_USE_UNSTABLE_API is not defined
Only hide GstTracer and GstTracerRecord API behind GST_USE_UNSTABLE_API,
but don't spew any warnings, otherwise everyone has to define this
to avoid compiler warnings.

This reverts parts of commit 89ee5d948d.
2016-01-16 16:00:16 +00:00
Stefan Sauer 89ee5d948d tracer: add a GFlag for the tracer scope
Port all tracers. Add the GST_USE_UNSTABLE_API flag to the internal CFLAGS so
that we don't have to specify this for gir, docs, mkenum, ...
2016-01-16 13:31:51 +01: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
Stefan Sauer 10b78d872b tracerrecord: add a log record class
We use this class to register tracer log entry metadata and build a log
template. With the log template we can serialize log data very efficiently.
This also simplifies the logging code, since that is now a simple varargs
function that is not exposing the implementation details.

Add docs for the new class and basic tests.

Remove the previous log handler.

Fixes #760267
2016-01-15 21:54:01 +01:00
Stefan Sauer 30741e0206 tracers: code clean ups
Drop some trailing whilespace. Make field order consistent.
2016-01-10 14:30:05 +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
Stefan Sauer 2f41e7bc6a tracer: harmonize the query hooks
In post hooks always pass the return value as the last param. Pass the query
also to post hooks since it is still alive.
2016-01-07 23:03:48 +01:00
Stefan Sauer fb249dadcb tracers/stats: add missing parameters to callback functions 2016-01-07 22:47:37 +01:00