Sebastian Dröge
f1cdc6f243
allocator: Avoid integer overflow when allocating sysmem
...
Thanks to Antonio Morales for finding and reporting the issue.
Fixes GHSL-2024-166
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3851
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8032 >
2024-12-03 02:24:16 +00:00
Sebastian Dröge
1ee349f986
systemclock: Don't keep the clock entry locked while getting the time from the clock
...
gst_clock_get_time() will take the clock mutex, which would then result in a lock
order violation and possible deadlocks. If both mutexes are to be locked, the
clock must always be locked first.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7994 >
2024-12-02 08:21:59 +00:00
Sebastian Dröge
ec698179a9
systemclock: Get rid of conditional unlocking of the clock entries
...
At every point it is known whether the entry needs to be unlocked or not.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7994 >
2024-12-02 08:21:59 +00:00
Sebastian Dröge
4447114713
systemclock: Remove confusing conditional unlock
...
At this point the entry is always locked and needs to be unlocked.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7994 >
2024-12-02 08:21:59 +00:00
Sebastian Dröge
37b9bfdd2e
systemclock: Use a flag while waiting for the async thread to start
...
Otherwise there can be spurious wakeups.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7994 >
2024-12-02 08:21:59 +00:00
wbartel
de41680f78
gstreamer: prefix debug dot node names to prevent splitting
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7979 >
2024-11-28 15:38:56 +00:00
He Junyan
df7a0d0fec
utils: Add gst_util_floor_log2 helper function
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5003 >
2024-11-24 16:49:24 +00:00
Qian Hu (胡骞)
6335c5d005
meta: add aggregation function for allocation meta api params
...
since tee do allocation query for each downstream element, and
get allocation query params from them. this function will aggregate
all params, and propose it for upstream element of tee
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7201 >
2024-11-19 15:27:38 +00:00
Albert Sjolund
f068b3bf5c
gstpad: specialize gst_pad_chain_list_default
...
In the case where the bufferlist is writable, send the
buffers immediately without adding to the refcount. This
allows writable buffers to maintain their writability, even
without implementing a chain_list function on the element.
Adds a test to verify this property, where a writable list
maintains refcount 1, but a readonly list increases it.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7894 >
2024-11-18 10:59:34 +00:00
Robert Rosengren
6fff1ef971
gstdeviceprovider: fix leaking hidden providers
...
Free list of hidden providers upon stop and dispose.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7912 >
2024-11-18 09:20:34 +01:00
Matthew Waters
8e758c715b
value: silence a maybe-unitialized warning
...
gstvalue.c:376:8: error: ‘s_val’ may be used uninitialized [-Werror=maybe-uninitialized]
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7875 >
2024-11-18 12:10:57 +11:00
Stéphane Cerveau
a6f82ba590
utils: improve gst_util_ceil_log2
...
According to the following comparison of algorithms, the value
for 0 and 1 was giving an incorrect result.
https://gist.github.com/ceyusa/6061b33ac109a68bcd222f6919968c9a
More information here:
https://github.com/rofrol/codeforces/blob/master/ceil_log2.c
Use a different algorithm which offers better result and keep the
performance.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7429 >
2024-11-15 16:52:29 +00:00
Sebastian Dröge
bc63d85f19
idstr: Fix docs of set_static_str_with_len()
...
The passed string must be NUL-terminated because otherwise a copy would be
necessary to make it NUL-terminated, which defeats the whole purpose of the
set_static() functions.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7863 >
2024-11-14 17:12:27 +00:00
Thibault Saunier
23ce0d2901
meson: gst: Make GST_FULL_STATIC_COMPILATION a static only arg
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7874 >
2024-11-12 16:28:39 +00:00
Sebastian Dröge
128dd3d82c
buffer: Don't copy reference timestamp meta if the destination buffer already has the same
...
GstRtpBaseDepayload and other places already had such de-duplication code, so
it's probably better to solve this at the root.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7747 >
2024-10-28 12:35:57 +00:00
Edward Hervey
38c07a2d01
all: Fix closure annotations
...
This was misused almost everywhere.
See
https://gi.readthedocs.io/en/latest/annotations/giannotations.html#support-for-gobject-closures
and: https://www.bassi.io/articles/2023/02/20/bindable-api-2023/
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7725 >
2024-10-25 08:58:29 +00:00
François Laignel
7fc418e08c
gst: add more GstIdStr functions to Caps & Structure
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7644 >
2024-10-16 23:14:50 +00:00
François Laignel
375acaed51
gst: hamonise recent Caps function names with Structure counterparts
...
These functions were introduced as part of the GstIdStr MR:
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7432
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7644 >
2024-10-16 23:14:50 +00:00
Alicia Boya García
59b714edc3
pad: Never push sticky events in response to a FLUSH_STOP
...
FLUSH_STOP is meant to clear the flushing state of pads and elements
downstream, not to process data. Hence, a FLUSH_STOP should not
propagate sticky events. This is also consistent with how flushes are a
special case for probes.
Currently this is almost always the case, since a FLUSH_STOP is
__usually__ preceded by a FLUSH_START, and events (sticky or not) are
discarded while a pad has the FLUSHING flag active (set by FLUSH_START).
However, it is currently assumed that a FLUSH_STOP not preceded by a
FLUSH_START is correct behavior, and this will occur while autoplugging
pipelines are constructed. This leaves us with an unhandled edge case!
This patch explicitly disables sending sticky events when pushing a
FLUSH_STOP, instead of relying on the flushing flag of the pad, which
will break in the edge case of a FLUSH_STOP not preceded by a
FLUSH_START.
If sticky events are propagated in response to a FLUSH_STOP, the
flushing thread can end up deadlocked in blocking code of a downstream
pad, such as a blocking probe. Instead, those events should be
propagated from the streaming thread of the pad when handling a
non-flushing synchronized event or buffer.
This fixes a deadlock found in WebKit with playbin3 when seeks occur
before preroll, where the seeking thread ended up stuck in the blocking
probe of playsink:
https://github.com/WebPlatformForEmbedded/WPEWebKit/issues/1367
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7632 >
2024-10-16 16:50:44 +00:00
François Laignel
067fe7b9bc
gst: structure: add more GstIdStr methods
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7613 >
2024-10-04 11:19:46 +02:00
François Laignel
86776dc62e
gst: structure: fix some GstIdStr documentation
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7613 >
2024-10-03 19:56:06 +02:00
Corentin Damman
16da96653a
macos: Fix race conditions
...
This commit fixes two issues:
- The event must be posted *after* calling stop, otherwise a race condition can occur and the app never stops
- isFinishedLaunching and applicationDidFinishLaunching are not always synchronized, causing sometimes
a deadlock on the g_cond_wait never catching the g_cond_signal
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7593 >
2024-10-03 11:47:45 +02:00
Daniel Morin
a40ed16a0e
value: Fix nested caps intersection
...
Without this change intersection operand containing caps-in-caps need
to be equal for the intersection to work.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7572 >
2024-10-01 22:17:51 +00:00
Seungha Yang
a8f8bbef99
structure,capsfeatures: Fix MSVC build warnings
...
Fixing warning "warning C4068: unknown pragma 'GCC'"
Use portable GLib macro instead
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7589 >
2024-09-30 21:56:28 +00:00
Sebastian Dröge
21af7061eb
gst: caps: Add API for creating caps / setting caps fields from static strings
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7432 >
2024-09-26 19:26:18 +03:00
Sebastian Dröge
ba552fb76f
gst: Remove gstquark.c / gstquark.h
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7432 >
2024-09-26 19:26:18 +03:00
Sebastian Dröge
eed7c9c66a
gst: capsfeatures: Use GstIdStr for caps features
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7432 >
2024-09-26 19:21:29 +03:00
Sebastian Dröge
6233eb0ff3
common: Stop using GQuark-based GstStructure field name API
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7432 >
2024-09-26 19:21:29 +03:00
Sebastian Dröge
2df9c4739e
gst: structure: Use GstIdStr for structure field names
...
And add corresponding API with GstIdStr parameters, static string parameters and
deprecate the old GQuark based API.
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3567
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7432 >
2024-09-26 19:21:29 +03:00
Sebastian Dröge
0c1611d31d
common: Stop using GQuark-based GstStructure name API
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7432 >
2024-09-26 19:21:29 +03:00
Sebastian Dröge
8cbc76b180
gst: structure: Use GstIdStr for structure names
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7432 >
2024-09-26 19:21:29 +03:00
Sebastian Dröge
0ee18781f9
gst: Add GstIdStr for holding structure names and field names
...
This is an efficient string storage for short strings without heap allocations,
and falling back to the heap for bigger allocations. Almost all structure fields
and structure names in use nowadays are short enough to not require a heap
allocation.
As structure names and fields are sometimes dynamically created, storing them in
a GQuark can create a memory leak and potentially a DoS attack by continously
triggering creating of new quarks.
Thanks to Tim for coming up with the name!
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7432 >
2024-09-26 19:21:29 +03:00
Sebastian Dröge
0823c639cc
gst: structure: Stop using private structure name quark field
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7432 >
2024-09-26 19:21:29 +03:00
Arun Raghavan
90e58aec3c
gstreamer: parse: Use child proxy for deferred property setting
...
We use that mechanism for the non-deferred path, and this makes sure we are
consistent for deferred set too.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7519 >
2024-09-23 17:47:20 +00:00
Arun Raghavan
92d8da92dc
gstreamer: parse: Minor whitespace fixups
...
Mostly replacing some tabs with spaces.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7519 >
2024-09-23 17:47:20 +00:00
Arun Raghavan
ba69987114
gstreamer: parse: Make sure children are bins before recursing in
...
A deferred set of the form parentbin::childelement::pad works in the
non-deferred property setting path, but the deferred path assumes that all
non-root non-leaf children specify bins. We already have a bin check on the
root, so let's add one for other non-leaves to avoid a critical.
Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3806
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7519 >
2024-09-23 17:47:19 +00:00
Sebastian Dröge
389302eb96
dynamictypefactory: Fix name of the class cast macro
...
And deprecate the old name.
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3814
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7541 >
2024-09-23 15:04:31 +00:00
Peter Kjellerstedt
0db32b3b3a
meta: Add missing include of gststructure.h
...
This avoids the following error when only including gstmeta.h:
/usr/include/gstreamer-1.0/gst/gstmeta.h:146:3: error: unknown type
name 'GstStructure'
146 | GstStructure *structure;
| ^~~~~~~~~~~~
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7520 >
2024-09-16 06:58:08 +00:00
Arun Raghavan
f30321538b
pad: Check data NULL-ness when probes are stopped
...
We were correctly handling this for buffers, but not events and queries.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7493 >
2024-09-12 05:47:16 +00:00
Sebastian Dröge
e5133033fa
clock: Use external / internal as term for the two clock bases everywhere
...
It was confusing that some functions were using master for the external time and
slave for the internal time. This is not consistently using external / internal
when talking about concrete clock times.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7456 >
2024-09-08 11:42:38 +01:00
Sebastian Dröge
f463d4c3c1
clock: Use nullable / optional annotations instead of ambiguous allow-none
...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7456 >
2024-09-08 09:54:56 +00:00
Tim-Philipp Müller
6031f9ece1
gstreamer: use g_sort_array() instead of deprecated g_qsort_with_data()
...
Fixes compiler warnings with the latest GLib versions.
See https://gitlab.gnome.org/GNOME/glib/-/merge_requests/4127
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7384 >
2024-09-02 22:31:34 +00:00
Sebastian Dröge
55994477a7
bus: Switch from GstAtomicQueue to GstVecDeque
...
All accesses to it were protected either by a mutex already, or at least
used yet another mutex for gst_poll_read_control() / gst_poll_write_control().
The usage of GstPoll has to stay for backwards compatibility as it is
used to manage the (public) fd that can be used to wait for the bus to
be ready, but this switch at least simplifies the implementation a bit
and results in fewer atomic operations.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6684 >
2024-09-02 09:26:23 +00:00
Sebastian Dröge
8e589eec08
bufferpool: Switch from GstAtomicQueue to GstVecDeque and a mutex/cond
...
While the atomic queue itself is lock-free, all its usage had to be
synchronized externally via a GstPoll and gst_poll_read_control() /
gst_poll_write_control(). Both functions were always taking a mutex
internally since cd06aea1, so the implementation was just very
complicated but not lock-free at all.
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/2714
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6684 >
2024-09-02 09:26:23 +00:00
Sebastian Dröge
3c7ddf902a
structure: Remove quadratic behaviour from gst_structure_fixate()
...
It was iterating over each field and after fixating its value was again
iterating over every field to find where to store the value.
Instead directly overwrite the value after validating it.
Also actually check that the structure is writable before modifying its fields
by using gst_structure_map_in_place() instead of gst_structure_fixate().
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7420 >
2024-09-02 07:32:16 +00:00
Sebastian Dröge
8b0ae3ba87
clock: Fix calculation for number of bits needed to store a 64 bit value
...
It was using log2(n) but what actually is needed is log2(n) + 1. Also add a
fast-path that uses __builtin_clzll() on gcc/clang.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7406 >
2024-08-29 10:55:35 +00:00
Sebastian Dröge
41f3fab3d4
clock: Fix unchecked overflows in linear regression code
...
The initial calculation for the precision shift was wrong and would allow for
overflows during the calculations which were not detected and lead to wrong
results.
Also add a test for a case where overflows where previously not detected and
caused a completely wrong result.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7406 >
2024-08-29 10:55:35 +00:00
Daniel Morin
4106ad4ae6
doc: correct delimiters documentation
...
- "<>" are delimiters for GST_TYPE_ARRAY and "{}" are delimiters for
GST_TYPE_LIST.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7419 >
2024-08-29 00:00:43 +00:00
Jan Schmidt
e76581fe93
core: Log pad name, not just the pointer
...
Change a debug statement that was just logging a pad pointer where
it could log the pad name more usefully.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6943 >
2024-08-12 12:38:44 +05:30
Sebastian Dröge
9bbb7accb3
bin: Don't keep the object lock while setting a GstContext when handling NEED_CONTEXT
...
This can potentially deadlock.
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/3707
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7305 >
2024-08-06 07:00:29 +00:00