Commit graph

8382 commits

Author SHA1 Message Date
Jan Schmidt 6b2bbd6036 segment: Allow stop == -1 in gst_segment_to_running_time() and rate < 0
If a segment has stop == -1, then gst_segment_to_running_time()
would refuse to calculate a running time for negative rates,
but gst_segment_do_seek() allows this scenario and uses a
valid duration for calculations.

Make the 2 functions consistent by using any configured duration
to calculate a running time too in that case.

https://bugzilla.gnome.org/show_bug.cgi?id=796559
2018-11-07 23:10:12 +02:00
Jan Schmidt 5978e3b958 gstsegment: Handle positions before the segment properly
Fixes for gst_segment_position_from_running_time_full() when
converting running_times that precede the segment start (or
stop in a negative rate segment)

The return value was incorrectly negated in those cases.

Add some more unit test checks for those cases, and especially
for segments with offsets.
2018-09-11 22:21:02 +10:00
Philippe Normand 208282e0b7 bin: Fix use-after-free issue in gst_bin_add()
gst_element_post_message() takes ownership of the message so we need to increase
its refcount until we no longer require access to its data (context_type).

https://bugzilla.gnome.org/show_bug.cgi?id=797099
2018-09-08 19:27:48 +01:00
Philippe Normand 3cf1bac0b7 utils: Set default values for position and duration query results
https://bugzilla.gnome.org/show_bug.cgi?id=797066
2018-09-03 13:27:11 +01:00
Sebastian Dröge 235241a00d Revert "pad: Don't drop LATENCY queries with default implementation"
This reverts commit 794944f779.

Accumulating non-live latency values generally makes no sense and often
gives invalid results with min>max
2018-08-31 12:17:07 +03:00
Sebastian Dröge 9477e15e96 Revert "pad: Accumulate live/non-live latency values separately"
This reverts commit f5783e1cac.
2018-08-31 12:17:07 +03:00
Sebastian Dröge 5182b18912 pad: Accumulate live/non-live latency values separately
And only ever use the non-live values if all pads are non-live,
otherwise only use the results of all live pads.

It's unclear what one would use the values for in the non-live case, but
by this we at least pass them through correctly then.

This is a follow-up for 794944f779, which
causes wrong latency calculations if the first pad is non-live but a
later pad is actually live. In that case the live values would be
accumulated together with the values of the non-live first pad,
generally causing wrong min/max latencies to be calculated.
2018-08-31 11:41:47 +03:00
Sebastian Dröge aeeefe399a pad: Ensure that the pad is blocked for IDLE probes if they are called from the streaming thread too
IDLE probes that are directly called when being added will increase /
decrease the "number of IDLE probes running" counter around the call,
but when running from the streaming thread this won't happen.

This has the effect that when running from a streaming thread it is
possible to push serialized events or data out of the pad without
problems, but otherwise it would deadlock because serialized data would
wait for the IDLE probe to finish first (it is blocking after all!).

With this change it will now always consistently deadlock instead of
just every once in a while, which should make it obvious why this
happens and prevent racy deadlocks in application code.

https://bugzilla.gnome.org/show_bug.cgi?id=796895
2018-08-02 10:55:01 +03:00
Sebastian Dröge c4cd50f734 pad: Update pad offsets on the current event if the offset changed in pad probes
https://bugzilla.gnome.org/show_bug.cgi?id=796898
2018-08-02 10:54:23 +03:00
Mark Nauwelaerts d6c697e7d9 gst: add some GIR array annotations 2018-05-21 10:42:58 +03:00
Sebastian Dröge d3f19741ad pad: Fix race condition causing the same probe to be called multiple times
Probes were remembering a cookie that was used to check if the probe was
already called this time before the probes list changed. However the
same probes could've been called by another thread in between and thus
gotten a new cookie, and would then be called a second time.

https://bugzilla.gnome.org/show_bug.cgi?id=795987
2018-05-14 17:01:25 +03:00
Edward Hervey fbf6e28747 gst: Use memcpy() instead of strncpy() where appropriate
strncpy() is assumed to be for strings so the compiler assumes that
it will need an extra byte for the string-terminaning NULL.

For cases where we know it's actually "binary" data, just copy it
with memcpy.

Fixes compiler warnings with gcc 8.

https://bugzilla.gnome.org/show_bug.cgi?id=795756
2018-05-08 16:42:37 +01:00
Tim-Philipp Müller f887db4ab1 bufferlist: fix abort due to underflow when creating 0-sized list
gst_buffer_list_new_sized(0) will cause an underflow in a calculation
which then makes it try to allocate huge amounts of memory, which
may lead to aborts.

https://bugzilla.gnome.org/show_bug.cgi?id=795758
2018-05-05 16:28:04 +02:00
Mark Nauwelaerts 2601fabccf gst: add some GIR array annotations 2018-04-16 11:11:36 +03:00
Tim-Philipp Müller ee0619ec66 gstdebug: fix occasional deadlocks on windows when outputting debug logging
When outputting debug logs on Windows, some sections are protected
with a non-recursive lock. Turns out though that gst_debug_message_get()
might indirectly, via our printf format extensions, call code which
in turn would try to log something when it can't handle something. If
that happens we end up in gst_debug_log_default() again recursively and
try to again take the lock that's already taken, thus deadlocking.

Format the debug message string outside of the critical section
instead to avoid this.

https://bugzilla.gnome.org/show_bug.cgi?id=784382
2018-04-11 23:19:46 +01:00
Tim-Philipp Müller 92887d4767 gsturi: include gstconfig.h earlier for GST_API define 2018-04-11 23:19:43 +01:00
Jan Alexander Steffens (heftig) 0b293cad89 gstinfo: fix debug levels being applied in the wrong order
Remove unneeded reapplication of patterns. Besides being
superfluous (gst_debug_reset_threshold already applies
patterns) it was also wrong and didn't stop checking patterns
after the first match (broken in 67e9d139).

Also fix up unit test which checked for the wrong order.

https://bugzilla.gnome.org/show_bug.cgi?id=794717
2018-04-05 20:01:16 +01:00
Matthew Waters 1e3272ee91 bin: fix deep-element-added signal debug log message
Adding the bin to the child element doesn't really make sense.
2018-04-05 20:01:06 +01:00
Sebastian Dröge fef082b5d0 gst: Fix compilation with latest GLib
g_object_ref() forwards the type of its argument nowadays.

./grammar.y:409:14: error: assignment from incompatible pointer type [-Werror=incompatible-pointer-types]
gstchildproxy.c:212:7: error: assignment from incompatible pointer type [-Werror=incompatible-pointer-types]
2018-03-25 12:36:09 +03:00
Sebastian Dröge deb0d9d49b paramspecs: Set g-i annotation values for GST_PARAM_* constants 2018-03-25 12:32:36 +03:00
Sebastian Dröge 72025c538c elementfactory: GST_ELEMENT_FACTORY_TYPE_DECODABLE had DECRYPTOR added, update g-i annotation value 2018-03-25 12:32:31 +03:00
Tim-Philipp Müller 8983cce9f6 gst: GST_EXPORT -> GST_API
We need different export decorators for the different libs.
For now no actual change though, just rename before the release,
and add prelude headers to define the new decorator to GST_EXPORT.
2018-03-13 00:45:35 +00:00
Matthew Waters 7a008ea481 promise: be more explicit in docs about who/when to use reply/interrupt/expire
https://bugzilla.gnome.org/show_bug.cgi?id=794153
2018-03-12 22:06:21 +11:00
Sebastian Dröge f204b57fa5 debugutils: Change dot-file functions documentation to proper gtk-doc
This way gobject-introspection also picks it up and handles our
annotations.

See https://gitlab.gnome.org/GNOME/gobject-introspection/issues/194
2018-03-05 11:52:24 +02:00
Sebastian Dröge a1bf0f0e6a gst: Add some more (type filename) annotations 2018-03-04 10:25:08 +02:00
Mathieu Duponchelle d67623c7a9 meson: enable more warnings
Modeled on the autotools build, -W flags are only
added if the compiler supports them.

https://bugzilla.gnome.org/show_bug.cgi?id=793958
2018-03-01 17:20:48 +01:00
Mathieu Duponchelle 609adc0609 ghostpad: ensure we build a ghost pad ..
When we construct from a custom GType
2018-03-01 01:12:07 +01:00
Mathieu Duponchelle 60fae518b0 pad: fix mixed declarations 2018-03-01 01:09:48 +01:00
Mathieu Duponchelle 7847e69ef8 pad, ghostpad: use the template gtype if specified
Also make sure the GType passed to the with_gtype versions
of the template constructors is_a GstPad

https://bugzilla.gnome.org/show_bug.cgi?id=793933
2018-03-01 00:39:08 +01:00
Mark Nauwelaerts 9fb56a32f5 gst: fix some GIR annotations
Mostly related to out parameters and their transfer
2018-02-18 12:16:36 +01:00
Tim-Philipp Müller ea402c7034 gstconfig.h: want deprecation warnings if GST_DISABLE_DEPRECATED is *set*
Fix inverted logic. If GST_DISABLE_DEPRECATED is undefined,
we don't want warnings about deprecated API, and if it's
defined we do want warnings.
2018-02-15 12:11:41 +00:00
Tim-Philipp Müller ffa4dc4dce autotools: use -fno-strict-aliasing where supported
https://bugzilla.gnome.org/show_bug.cgi?id=769183
2018-02-03 17:56:04 +01:00
Tim-Philipp Müller 08dab770d6 buffer: fix gtk-doc warning regarding _get_n_meta() declaration 2018-02-03 17:55:29 +01:00
Matthew Waters 442aca430a gstpromise: add since 1.14 markers 2018-02-02 15:06:36 +11:00
Mathieu Duponchelle 8451a2ab04 gstbuffer.h: move FLAG_LAST documentation back to the bottom 2018-01-31 14:01:36 +01:00
Mathieu Duponchelle ebcdfd2e9c gstbuffer: add GST_BUFFER_FLAG_NON_DROPPABLE
This can be used to identify buffers for which a higher percentage
of redundancy should be allocated when performing forward error
correction, or to prevent still video frames from being dropped by
elements due to QoS.

https://bugzilla.gnome.org/show_bug.cgi?id=793008
2018-01-31 13:34:13 +01:00
Tim-Philipp Müller cd10f14726 buffer: add gst_buffer_get_n_meta() convenience function
Counts how many metas there are for a certain api type.

https://bugzilla.gnome.org/show_bug.cgi?id=791918
2018-01-27 11:18:19 +00:00
Arun Raghavan b5028383ab gst: Fix up a bunch of GIR annotations
This is mostly on nullable return values, and some other minor ones that
I ran across.

https://bugzilla.gnome.org/show_bug.cgi?id=789319
2018-01-27 10:41:24 +00:00
Arun Raghavan 41a59cddb6 devicemonitor: Return NULL instead of FALSE
Same effect, meaning is clearer.

https://bugzilla.gnome.org/show_bug.cgi?id=789319
2018-01-27 10:29:18 +00:00
François Laignel 46b1a6e505 message: Add gst_message_writable_structure()
Add gst_message_writable_structure() to be able to add extra fields to
messages (and be on par with GstEvent).

https://bugzilla.gnome.org/show_bug.cgi?id=792928
2018-01-26 16:09:10 +02:00
Tim-Philipp Müller db1d99db76 childproxy: gracefully handle methods being NULL
Do this for all method invoke functions for consistency.

https://bugzilla.gnome.org/show_bug.cgi?id=750154
2018-01-20 15:30:53 +00:00
Sebastian Dröge e8bae061f1 padtemplate: And add missing GST_EXPORT to gst_pad_template_new_with_gtype() 2018-01-18 19:16:12 +02:00
Sebastian Dröge 6b1df25441 padtemplate: Add missing Since: 1.14 marker to gst_pad_template_new_with_gtype() 2018-01-18 19:15:09 +02:00
Sebastian Dröge 50433576b5 padtemplate: Add gst_pad_template_new_with_gtype()
For being able to create a pad template with GType without having a
static pad template.
2018-01-18 19:09:46 +02:00
Sebastian Dröge 645840676c padtemplate: Add Since: 1.14 marker to gst_pad_template_new_from_static_pad_template_with_gtype() 2018-01-18 19:09:46 +02:00
Edward Hervey 31383e4413 gstpad: Avoid stream-dead-lock on deactivation
The following case can happen when two thread try to activate and
deactivate a pad at the same time:
T1: starts to deactivate, calls pre_activate(), sets in_activation
    to TRUE and carries on
T2: starts to activate, calls pre_activate(), in_activation is TRUE
    so it waits on the GCond
T1: calls post_activate(), tries to acquire the streaming lock ..
    but can't because T2 is currently holding it

With this patch, the deadlock will no longer happen but does not
solve the problem that:
T2: will resume activation of the pad, set the pad mode to the target
   one (PUSH or PULL) and eventually the streaming lock gets released.
T1: is able to finish calling post_activate() ... but ... the pad
   wasn't deactivated (T2 was the last one to "activate" the pad.

https://bugzilla.gnome.org/show_bug.cgi?id=792341
2018-01-16 10:29:18 +01:00
Edward Hervey 6cd783b9fc gstpad: Release pending g_cond_wait() when stopping/pausing task
Otherwise we would deadlock waiting forever for the streaming lock
to be released

https://bugzilla.gnome.org/show_bug.cgi?id=792341
2018-01-15 18:19:48 +01:00
Tim-Philipp Müller 968dd651c2 docs: explicit refer to GObject docs for floating refs
https://bugzilla.gnome.org/show_bug.cgi?id=788477
2018-01-12 18:47:17 +00:00
Tim-Philipp Müller d7a9b08268 utils: use g_get_monotonic_time() as fallback in gst_utils_get_timestamp()
This is a better fit given that the function docs say this
should (only) be used for interval measurements, but also
this seems to give much better granularity on Windows
systems, where before this change there would often be
10-20 lines of debug log with the same timestamp up front.
2018-01-11 18:44:50 +00:00
Tim-Philipp Müller 5feff26624 plugin: plugin_load() must return a ref even if it was loaded already
Fix refcounting issue when plugin was loaded already.
gst_plugin_load() is supposed to return a ref, so it
must always return a ref.

This also fixes the gstplugin unit test on windows where
fork is not available and where test_load_coreelements()
would unref a plugin ref it didn't get and then mess up
the internal registry plugin list state for the next test,
in case where the test registry does not exist yet.
2018-01-11 17:10:45 +00:00