Commit graph

8395 commits

Author SHA1 Message Date
Matthew Waters
3991afe68b element: NULL the lists of contexts in dispose()
If dispose() is called more than once, we may double unref the list of
GstContext's.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/878>
2021-08-28 12:25:49 +01:00
Sebastian Dröge
10e2cb84f8 controlbinding: Check if the weak pointer was cleared before explicitly removing it
Otherwise we'll get an assertion if the object behind the weak pointer
was already destroyed in the meantime as we would pass NULL as first
argument to g_object_remove_weak_pointer().
2019-05-02 08:31:25 +01:00
Santiago Carot-Nemesio
c6a33f7641 gsttaskpool: Do not block tasks while cleaning up the taskpool
There is a deadlock if any thread from the pool tries to push
a new task while other thread is waiting for the pool of threads
to finish. With this patch the thread will get an error when it
tries to add a new task while the taskpool is being cleaned up.
2019-05-02 08:31:25 +01:00
Marco Trevisan (Treviño)
949598d987 gsturi: Fix annotation on get_path to return a nullable
Use proper syntax or the (nullable): part will be part of the description
2019-05-02 08:31:25 +01:00
Marco Trevisan (Treviño)
88aecda3de gstmessage: Fix annotations on details
Details argument should be nullable, but the docstring uses a wrong syntax.
2019-05-02 08:31:25 +01:00
Santiago Carot-Nemesio
d7a26ed55e taskpool: Set error in case something goes wrong in the default handlers 2019-05-02 08:31:25 +01:00
Sebastian Dröge
3555b3ebe0 bus: Make removing of signal/bus watches thread-safe
Between getting the GSource with the mutex and destroying it, something
else might've destroyed it already and we would have a dangling pointer.

Keep an additional reference just in case.
2019-05-02 08:31:25 +01:00
Sebastian Dröge
90e0311324 bus: Don't allow removing signal watches with gst_bus_remove_watch()
Signal watches are reference counted and gst_bus_remove_watch() would
immediately remove it, breaking the reference counting. Only
gst_bus_remove_signal_watch() should be used for removing signal
watches.
2019-05-02 08:31:25 +01:00
Sebastian Dröge
fd06d56d48 padtemplate: Constructors are all nullable as they check the template name 2019-05-02 08:31:25 +01:00
Daniel Drake
70599dc3d8 deviceprovider: fix counting number of times started
GstDeviceProvider has a started_count private variable counter,
and the gst_device_provider_start() documentation emphasizes the
importance of balancing the start and stop calls.

However, when starting a provider that is already started, the
current code will never increment the counter more than once.

So you start it twice, but it will have start_count 1, which is the
maximum value it will ever see.

Then when you stop it twice, on the 2nd stop, after decrementing the
counter in gst_device_provider_stop():

  else if (provider->priv->started_count < 1) {
    g_critical
        ("Trying to stop a GstDeviceProvider %s which is already stopped",
        GST_OBJECT_NAME (provider));

and the program is killed.

Fix this by incrementing the counter when starting a device provider that
was already started.
2019-05-02 08:31:25 +01:00
Dardo D Kleiner
4c87b6ee84 buffer: Fix memory corruption in gst_buffer_foreach_meta() when removing metas
Fix corruption of meta list head when removing metas at the beginning
during iteration. Linked list handling in gst_buffer_foreach_meta
failed to track the previous entry and update the correct next pointer
when removing items from beyond the head of the list, resulting in
arbitrary list pointer corruption.

Closes #332
2019-05-01 15:11:08 +01:00
Havard Graff
e4093f05f3 systemclock: pre-calculate the ratio for multiplying the perf-count on win
Saves a lot of computations.
2018-11-07 23:10:52 +02:00
Havard Graff
d819f6913c gstpad: use hook_id instead of hook in called_probes list
A pointer to a hook in this list can easily not be unique, given both
the slice-allocator reusing memory, and the OS re-using freed blocks
in malloc.

By doing many repeated add and remove of probes, this becomes very easily
reproduced.

Instead use hook_id, which *is* unique for a added GHook.
2018-11-07 23:10:42 +02:00
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