Commit graph

8338 commits

Author SHA1 Message Date
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
Tim-Philipp Müller
3aa5ff37cd info: reset default threshold to LEVEL_DEFAULT not 0
in set_threshold_from_string().
2018-01-11 11:36:53 +00:00
Sebastian Dröge
e32d89d6c9 streams: GstStreamType/GstStream are available since 1.10
Annotate them as such.
2017-12-26 18:10:25 +01:00
Stefan Sauer
c96901d4d9 segment: add a FIXME-2.0 for the format parameters
Capture the somewhat not ordinary use of the extra format parameter in a
comment.
See https://bugzilla.gnome.org/show_bug.cgi?id=788979
2017-12-26 11:29:39 +01:00
Tim-Philipp Müller
252ce5a093 Skip gst_deinit() if gstreamer was not initialized properly
Can happen if an error occurs during option parsing, for example.

https://bugzilla.gnome.org/show_bug.cgi?id=781914
2017-12-24 16:21:38 +01:00
Sebastian Dröge
70104857b0 systemclock: set_default() clock parameter can be NULL 2017-12-20 18:56:23 +02:00
Sebastian Dröge
1a5a5709ad element: Annotate set_clock() clock parameter with allow-none 2017-12-20 18:11:48 +02:00
Sebastian Dröge
e16e55ed04 element: Annotate set_bus() bus parameter as allow-none
It's possible to replace the bus with NULL/None
2017-12-20 18:09:28 +02:00
Sebastian Dröge
f85e93d004 plugin: Annotate add_dependency() arguments as NULL-terminated arrays 2017-12-17 14:19:14 +02:00
Umang Jain
52d2891fe3 docs: GstBus: Provide more information for ref/unref during bus watch.
https://bugzilla.gnome.org/show_bug.cgi?id=791588
2017-12-14 09:34:59 +00:00
Matthew Waters
a0400a0d28 docs: include tracers in the documentation
Requires exposing the tracer GType from the GstTracerFactory in order
to link the plugin with the tracer in the documentation.

https://bugzilla.gnome.org/show_bug.cgi?id=791253
2017-12-14 14:46:46 +11:00
Tim-Philipp Müller
f05bd2a016 docs: Fix a few gtk-doc warnings
Broken links mostly.
2017-12-07 12:16:57 +00:00
Edward Hervey
0afc114629 gstpad: Handle GST_PAD_PROBE_HANDLED on sticky event push
When actually pushing an event, if we get GST_FLOW_CUSTOM_SUCCESS_1
(which is the conversion of GST_PAD_PROBE_HANDLED return value),
don't consider the stick event push as ignored, but as handled
2017-12-06 17:23:05 +01:00
Sebastian Dröge
adf304d5af event/query/message: Annotate get_structure() return value as nullable 2017-12-06 13:40:46 +02:00
Sebastian Dröge
c813b1c276 query: Add an empty structure in writable_structure() if there is none yet
This is consistent with how it works for GstEvent already.
2017-12-06 13:36:30 +02:00
Edward Hervey
62ebee096b docs: Misc addition/fixes
And also add the "Since" API sections for 1.12 and 1.14
2017-12-05 18:48:56 +01:00
Edward Hervey
eb6ba249c4 docs: Add documentation for GST_SEQNUM_INVALID
And link to it
2017-12-05 18:20:34 +01:00
Edward Hervey
e5c15f6b96 utils: Never return a group_id of 0, add GST_GROUP_ID_INVALID
Various plugins use special values (0 or G_MAXUINT32) as an
invalid/unset group_id, but nothing guarantees a groupid won't have
that value.

Instead define a value which group_id will never have and make
gst_group_id_next() always return a value different from that.

API: GST_GROUP_ID_INVALID
2017-12-05 18:19:32 +01:00
Tim-Philipp Müller
bcc5e5bcd5 buffer: document that _extract_dup() will return NULL for 0-sized buf
And make it explicit, and don't call _extract() on NULL data buffer.
2017-12-05 15:18:29 +00:00
Nirbheek Chauhan
3c5edc76e5 meson: Use new find_program fallback syntax
We use this syntax in libs/gst/helpers/meson.build already.
2017-12-05 12:26:44 +05:30
Sebastian Dröge
16de48ae03 gst: gst_element_remove_pad() is transfer none for the pad
While the refcount of the pad is decreased, it's the refcount that is
owned by the parent (i.e. the element) and not the one passed in by the
caller.

Fixes a memory leak in bindings.
2017-12-04 18:10:23 +02:00
Jan Alexander Steffens (heftig)
d9b20492f3 devicemonitor: Avoid maybe-uninitialized compiler warning
On Arch Linux x86_64, gcc 7.2.0-3, -Og -g3:

gstdevicemonitor.c: In function ‘bus_sync_message’:
gstdevicemonitor.c:276:8: error: ‘matches’ may be used uninitialized in this function [-Werror=maybe-uninitialized]

This commit also simplifies the code a bit.

https://bugzilla.gnome.org/show_bug.cgi?id=789983
2017-12-04 10:56:44 +00:00
Sebastian Dröge
464f840a23 gst: Annotate various strings as type filename if they represent a path/filename 2017-12-03 14:48:54 +02:00
Tim-Philipp Müller
9b944f7fd0 info: always check match patterns for new debug categories
Not only if a match pattern was set originally via GST_DEBUG.
Patterns might be set programmatically as well after all.
2017-12-02 12:51:17 +00:00
Tim-Philipp Müller
67e9d13950 info: fix performance issue with registering categories after gst_init()
When registering a new debug category after gst_init(), simply check
the existing patterns against that new category.

No need to iterate over all categories and recheck them all against
the existing patterns.

Also, no need to re-parse the existing pattern string set via GST_DEBUG
and add the same set of match patterns all over again to the existing
list of match patterns every time we register a new debug category.

Combined with iterating all debug categories on a change this would
make adding debug categories after gst_init() very very very slow.
2017-12-02 12:51:17 +00:00
Nicolas Dufresne
4bb5da9c28 plugin-scanner: Measure string length in bytes
g_strndup() wants a number of bytes to copy, so use strlen intead of
UTF-8 strlen function.
2017-12-01 13:42:00 -05:00
Thibault Saunier
4f4157ddb2 Revert "preset: Do not save deprecated properties"
This reverts commit 81e10f6123.

A mistake lead to committing it twice in a weird way.
2017-11-26 13:31:58 -03:00
Thibault Saunier
81e10f6123 preset: Do not save deprecated properties
It will g_warn upon deserialization and we should not use
those anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=789871
2017-11-26 13:28:10 -03:00
Thibault Saunier
e45873c6ec taglist: Avoid assertions when getting tag nick from unregister tag
With serialized GstDiscovererInfos we might end up trying to use
tags that have not been registered.
2017-11-26 12:53:54 -03:00
Thibault Saunier
28d142e6da preset: Do not save deprecated properties
It will g_warn upon desarialization and we should not use
those anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=789871
2017-11-26 12:53:54 -03:00
Tim-Philipp Müller
8cc7c3f6aa tools: gst-inspect: print pad properties where we know the subclass type 2017-11-26 00:17:27 +00:00
Edward Hervey
a066522ad9 gstinfo: Use free instead of g_free
Because
2017-11-25 13:07:12 +01:00
Edward Hervey
4ac09c73f6 gstinfo: Don't leak array of strings
The array provided by backtrace_symbols needs to be freed.
2017-11-25 12:44:11 +01:00
Edward Hervey
741ff6a371 gstutils: Fix linear regression comparision
The check for dropping precision was wrong when sxx and syy were negative.

if they are negative then "G_MAXINT64 - val" would always overflow

The check was meant to use G_MININT64 (like in the loop contained just
after).
2017-11-24 15:40:14 +01:00
Mikhail Fludkov
6577f5e91e gsttraceutils: actually disable tracing system hooks if configured
`./configure --disable-gst-tracer-hooks` didn't do anything, hooks were
always enabled regardless of the option. It works correctly in the
Meson build though.
2017-11-24 13:40:34 +01:00
Havard Graff
eb9ac74362 utils: add gst_utils_dump_buffer()
Useful for debugging.
2017-11-24 13:40:33 +01:00
Stian Selnes
512cec3dea pad: gst_pad_activate_mode() always succeed if same mode
Checking that the pad is in the correct mode before the parent is
checked makes the call always succeed if the mode is ok.

This fixes a race with ghostpad where gst_pad_activate_mode() could
trigger a g_critical() if the ghostpad is unparented while the
proxypad is deactivating, for instance if the ghostpad is released.
More specifically, gst_ghost_pad_internal_activate_push_default()'s
call to gst_pad_activate_mode() would fail if ghostpad doesn't have a
parent. With this patch it will return true of mode is already
correct.
2017-11-24 13:40:31 +01:00
Tim-Philipp Müller
b63ed9e066 ghostpad: return TRUE if target pad was already set
The state is as it should be, so no reason to return
FALSE really, everything's good.
2017-11-24 13:39:39 +01:00
Tim-Philipp Müller
3203a10821 ghostpad: access internal pad with lock held 2017-11-24 13:39:39 +01:00
Havard Graff
e515aa06fe ghostpad: fix race-condition while tearing down
An upstream query will take a ref on the internal proxypad, and can
hence end up owning the last reference to that pad, causing a crash.
2017-11-24 13:39:36 +01:00
Tim-Philipp Müller
7ea4152323 gstvalue: allocate slightly larger than needed tables at startup
If we pre-allocate only *exactly* as many nodes as we need for the
core types, we are practically guaranteed a re-alloc when external
code like GstVideoTimeCode or GstEncodingProfile register their
own GstValue things. So allocate a bit more than strictly needed.
2017-11-23 13:56:51 +01:00
Mathieu Duponchelle
c01949a99e pad templates: Allow specifying GType
See https://bugzilla.gnome.org/show_bug.cgi?id=731301

https://bugzilla.gnome.org/show_bug.cgi?id=789986
2017-11-22 16:44:08 +01:00
Matthew Waters
86abf49c23 gst: add a promise object
An object that can be waited on and asked for asynchronous values.
In much the same way as promise/futures in js/java/etc

A callback can be installed for when the promise changes state.

Original idea by
Jan Schmidt <jan@centricular.com>

With contributions from
Nirbheek Chauhan <nirbheek@centricular.com>
Mathieu Duponchelle <mathieu@centricular.com>

https://bugzilla.gnome.org/show_bug.cgi?id=789843
2017-11-23 00:48:30 +11:00
Edward Hervey
40c5396c24 registrychunks: Make sure we use aligned memory
This is in the same vein as for all other features. Some systems
might not allow unaligned read.
2017-11-20 17:01:04 +01:00
Edward Hervey
d915dd4b20 gstpad: Make pad (de)activation atomic
The following could happen previously:
* T1: calls gst_pad_set_active()
* T2: currently (de)activating it
* T1: gst_pad_set_active() returns, caller assumes that the pad has
  completed the requested (de)activation ... whereas it is not
  the case since the actual (de)activation in T2 might still be
  going on.

To ensure atomicity of pad (de)activation, we use a internal
variable (and cond) to ensure only one thread at a time goes through
the actual (de)activation block

https://bugzilla.gnome.org/show_bug.cgi?id=790431
2017-11-16 10:55:36 +01:00