Edward Hervey [Thu, 23 Apr 2020 12:57:59 +0000 (14:57 +0200)]
gstvalue: Use quark-based structure usage for segment (de)serialization
Instead of string-based one. Smaller and faster code
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/453>
Edward Hervey [Fri, 17 Apr 2020 15:14:36 +0000 (17:14 +0200)]
value: Handle runtime checks as such
The various `g_strdup_printf()` returns values are runtime checks
which could be disabled if one wants and therefore should be
handled as such with g_return_val_if_fail()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/453>
Edward Hervey [Fri, 1 May 2020 13:15:46 +0000 (15:15 +0200)]
gstvalue: Remove useless checks
The calling function already checks that the values exists and it's
a valid list
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/453>
Edward Hervey [Fri, 1 May 2020 12:50:52 +0000 (14:50 +0200)]
gstvalue: Use previous assumption
The types were already checked for equality just before, not need to
check for that again
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/453>
Edward Hervey [Fri, 1 May 2020 12:48:37 +0000 (14:48 +0200)]
gstvalue: Use comparision functions directly
We know the types of values, just use the comparision function directly
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/453>
Edward Hervey [Fri, 1 May 2020 12:45:28 +0000 (14:45 +0200)]
gstvalue: Minor optimization for checks
For value types that aren't subclassable, just check the type directly.
For flags, compare against the fundamental type directly instead of going through
the more expensive recursive check of `G_TYPE_CHECK_VALUE_TYPE()`
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/453>
Edward Hervey [Mon, 23 Mar 2020 16:03:51 +0000 (17:03 +0100)]
gstvalue: Optimize list subset some more
Avoid going through the double subtract function when comparing
anything to a list.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/453>
Edward Hervey [Mon, 23 Mar 2020 16:01:20 +0000 (17:01 +0100)]
gstvalue: Optimize gst_value_compare_list
The compare function only needs to be retrieved once and used
directly
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/453>
Edward Hervey [Sat, 21 Mar 2020 12:05:33 +0000 (13:05 +0100)]
gstvalue: Avoid temporary allocation
The problem is that:
* g_value_init will end up allocating an internal list/array
* g_value_copy *clears* the existing value by calling the free func
and then the copy function (creating it again)
To avoid that alloc/free/alloc cycle, directly call the appropriate
function
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/453>
Edward Hervey [Mon, 23 Mar 2020 07:20:58 +0000 (08:20 +0100)]
gstcaps: Move assignment outside loop
s1 and f1 stay the same within the inner loop
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/453>
Edward Hervey [Mon, 23 Mar 2020 07:10:53 +0000 (08:10 +0100)]
gststructure: inline gst_structure_is_subset()
Having direct access to the iteration allows tighter code and
also being able to stop earlier.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/453>
Edward Hervey [Mon, 23 Mar 2020 07:06:26 +0000 (08:06 +0100)]
gststructure: Inline gst_structure_intersect()
Having direct access to the iteration allows tighter code and
also being able to stop earlier.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/453>
Edward Hervey [Tue, 5 May 2020 08:47:07 +0000 (10:47 +0200)]
gstregistry: Directly get list of plugin features
Previously this was:
* iterating and referencing all plugin features in a GList
* *then* filtering out the ones we want
* Was doing that filtering by name (i.e. `strcmp`) instead of direct pointer
comparision
Instead, just create a private direct function to get the list of plugin
features
Uses 4 times less instructions ...
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/462>
Rubén Gonzalez [Mon, 4 May 2020 16:51:19 +0000 (16:51 +0000)]
plugin: Fix typo with GStremaer version:
```
has incompatible version (plugin: 1.15, gst: 1,12)
```
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/460>
Edward Hervey [Fri, 1 May 2020 13:03:55 +0000 (15:03 +0200)]
gstvalue: No longer store same-type intersection functions in table
The intersection function table is a legacy of 2005, when one could
register random intersection functions. This is no longer the case.
The only place where that table was used was:
* `gst_value_can_intersect()`, where it was already only used for identical
GType
* `gst_value_intersect()`, where the table iteration was insanely expensive
Instead this patch:
* Only stored intersection functions for *different* types (of which there are
only 4)
* Make gst_value_intersect directly call the same-type intersection functions
and only use the table if ever it doesn't match.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/454>
Edward Hervey [Fri, 1 May 2020 15:27:07 +0000 (17:27 +0200)]
gstpad: Simplify task name creation
This was going through a few locks and doing temporarily allocations for every
single task creation.. just to get a name.
We don't need to take locks since:
* The parent exists (we have a reference to it)
* The pad exists (the task belongs to it)
* Changing names of pad/elements when activating is a big no-no
Instead use the existing direct GST_DEBUG_PAD_NAME macro
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/455>
Edward Hervey [Fri, 1 May 2020 15:30:20 +0000 (17:30 +0200)]
gstevent: Add function for checking event name by GQuark
Avoids doing string<=>quark conversions in the sticky event handling path.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/455>
Edward Hervey [Fri, 17 Apr 2020 15:12:10 +0000 (17:12 +0200)]
caps: Unify common checks for intersections
Regardless of the intersect method chosen, migrate the same checks
up into the calling function. Same result, just less code.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/455>
Edward Hervey [Wed, 15 Apr 2020 07:09:22 +0000 (09:09 +0200)]
gstregistry: Remove unneeded call
_priv_gst_preload_plugins is only filled if option parsing is active.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/455>
Edward Hervey [Fri, 1 May 2020 08:19:08 +0000 (10:19 +0200)]
basesrc: Don't get flow name if not needed
Put it in the debug call so it's only called when/if needed
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/455>
Sebastian Dröge [Wed, 22 Apr 2020 07:26:45 +0000 (10:26 +0300)]
clocksync: Remove handoff signals
They're not really useful on this element and were just a leftover from
identity.
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/540
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/443>
Sebastian Dröge [Sun, 3 May 2020 13:11:39 +0000 (16:11 +0300)]
aggregator: Mark segment parameter as const in gst_aggregator_update_segment()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/457>
Tim-Philipp Müller [Mon, 24 Feb 2020 11:24:16 +0000 (11:24 +0000)]
tools: gst-stats: parse thread-id in windows debug logs properly
They don't seem to have the "0x" prefix.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/376>
Sebastian Dröge [Fri, 1 May 2020 07:07:09 +0000 (10:07 +0300)]
Add missing colons to Since markers in the docs
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/452>
Mathieu Duponchelle [Mon, 27 Apr 2020 22:33:22 +0000 (00:33 +0200)]
multiqueue: fix link-like syntax in doc
Matthew Waters [Fri, 24 Apr 2020 02:47:52 +0000 (12:47 +1000)]
harness: also forward context queries between harnesses
Fixes multiple OpenGL contexts being created with a setup like:
h = gst_harness_new ("glcolorconvert");
gst_harness_add_src (h, "gltestsrc", FALSE);
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/448>
Nicolas Dufresne [Wed, 22 Apr 2020 16:58:35 +0000 (12:58 -0400)]
baseparse: Always clear drain flag before pulling
In pull mode, each pull is unique. A following pull can be well inside the
range even if the previous one wasn't. Fix this my moving the drain flag
right before the pull.
This avoids passing a bad drain flag to parsers, which may endup truncate
buffers causing data corruption.
Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1275
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/446>
Matthew Waters [Thu, 23 Apr 2020 05:46:48 +0000 (15:46 +1000)]
build: libcheck may require linking against rt
In static linking scenarios, this is required to avoid this error
building tests:
/work/prefix/lib/libgstcheck-1.0.a(check_run.c.o): In function `tcase_run_tfun_fork':
/work/gstreamer/_builddir/../../../src/gstreamer/libs/gst/check/libcheck/check_run.c:476: undefined reference to `timer_create'
/work/gstreamer/_builddir/../../../src/gstreamer/libs/gst/check/libcheck/check_run.c:483: undefined reference to `timer_settime'
/work/gstreamer/_builddir/../../../src/gstreamer/libs/gst/check/libcheck/check_run.c:493: undefined reference to `timer_delete'
/work/prefix/lib/libgstcheck-1.0.a(check.c.o): In function `check_get_clockid':
/work/gstreamer/_builddir/../../../src/gstreamer/libs/gst/check/libcheck/check.c:628: undefined reference to `timer_create'
/work/gstreamer/_builddir/../../../src/gstreamer/libs/gst/check/libcheck/check.c:629: undefined reference to `timer_delete'
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/447>
Juan Navarro [Wed, 22 Apr 2020 16:59:54 +0000 (18:59 +0200)]
gstcaps: fix out of bounds checks
These two checks could end up allowing out of bounds array access, when
the index equals the array size.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/445>
Matthew Waters [Tue, 21 Apr 2020 09:33:08 +0000 (19:33 +1000)]
Revert "gstvalue: Avoid expensive fallback on intersection"
This reverts commit
cd751c2de39969ab6187eab12e4e8a85e0467cf7.
Reverts https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/406
Fixes glviewconvert negotiation in e.g.:
gltestsrc ! glviewconvert output-mode-override=side-by-side ! glstereosplit name=s s.left ! queue ! fakesink s.right ! queue ! glimagesink
Problem here is that intersecting flagsets in gst_value_intersect will
always find a value comparison function but may fail a direct type
comparison due to flagsets supporting derived types. When flagset
derived types are intersected, an intersection will therefore always
fail.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/441>
Seungha Yang [Wed, 22 Apr 2020 11:19:23 +0000 (20:19 +0900)]
systemclock: Fix clock waiting on Windows
Add missing parentheses in macro for the divide operation
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/444>
Charlie Turner [Tue, 21 Apr 2020 17:14:00 +0000 (18:14 +0100)]
debugutils: Skip multiqueue stats in dot dump
If this is not done, tools like xdot fail with "unexpected char
b'\\'". This is a regression caused by commit
74938f07c2a9b3411716fa7595178942c80e20f4 (multiqueue: Add stats
property).
The deserialized value coming out of g_object_get_property looks like
this,
$24 = (gchar *) 0x7f560c0046a0 "application/x-gst-multi-queue-stats, queues=(structure)< \\\"queue_0\\\\,\\\\ buffers\\\\=\\\\(uint\\\\)39\\\\,\\\\ bytes\\\\=\\\\(uint\\\\)8
120251\\\\,\\\\ time\\\\=\\\\(guint64\\\\)
1460000000\\\\;\\\", \\\"queue_1\\\\,\\\\ buffers\\\\=\\\\(uint\\\\)186\\\\,\\\\ bytes\\\\=\\\\(uint\\\\)838020\\\\,\\\\ time\\\\=\
\\\(guint64\\\\)
1984000002\\\\;\\\" >;"
That is immediately looking wrong. I don't know enough about GNOME
serialization details to say with confidence what happened here. It
gets worse after this is sent through g_strescape and then written to
the dot file. Interestingly, dot -Tpng is fine to ignore them it
seems.
Since the stats are by definition verbose, I decided the best choice
to omit them from the dot file, since such details are not of interest
there.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/442>
Sebastian Dröge [Mon, 20 Apr 2020 13:21:10 +0000 (16:21 +0300)]
Use gst_object_unref() / gst_object_clear() instead of the GObject ones
To allow the refcounting tracer to work better. In childproxy/iterator
these might be plain GObjects but gst_object_unref() also works on them.
In other places where it is never GstObject, g_object_unref() is kept.
dhilshad [Fri, 17 Apr 2020 06:14:40 +0000 (11:44 +0530)]
downloadbuffer:fix pushing buffer before stream start event
downloadbuffer source pad pushes the first buffer before pushing
Stream Start and Segment event, when working in Push mode.
Fix:Pushing Stream Start and Segment after coming out of
wait for data, and before pushing the buffer to next element.
Fixes #534
Edward Hervey [Fri, 17 Apr 2020 05:44:55 +0000 (07:44 +0200)]
gstregistrychunks: Directly set name on features
Edward Hervey [Fri, 17 Apr 2020 05:44:26 +0000 (07:44 +0200)]
gstobject: Don't double-notify when setting names
If the name is set via the gobject setters, the notificatio will
already be emitted.
Jan Tojnar [Thu, 16 Apr 2020 09:40:49 +0000 (11:40 +0200)]
build: Install bash-completion relative to datadir
Since bash-completion 2.9, it was no longer possible to override
the completionsdir through prefix. [1] In 2.10, the overridability
was re-estabilished but this time through datadir variable. [2]
This should not really matter except for developers installing the project
into a custom prefix or distros using per-package prefixes like NixOS.
[1]: https://github.com/scop/bash-completion/commit/
81ba2c7e7dfbaefbafa1e8615727c9612e5fb314
[2]: https://github.com/scop/bash-completion/pull/344
Matthew Waters [Wed, 15 Apr 2020 10:27:36 +0000 (20:27 +1000)]
systemclock: introduce a minimum wait time
There is not point waiting if the time to wait is less than this
platform specific value. The worst case here is GCond usage on windows
where the granularity is 1ms.
Matthew Waters [Wed, 15 Apr 2020 07:54:21 +0000 (17:54 +1000)]
gst/systemclock: wait on each entry individually
Problem:
multiple aggregator elements (audiomixer, compositor) in a live
pipeline use a lot of CPU waiting each other up. This is because
of the previously unused clock entry unscheduling during regular
operation.
Clock entry unscheduling has the potential to wake up every clock entry
waiting using the system clock which may be a large number.
Solution:
Implement waiting per entry and only wakeup the unscheduled entry.
While this may be possible using GCond, theoretically GCond only gives
us microsecond accuracy and uses relative waits in a number of places.
We can unfortunately do better poking at the platform specifics
ourselves by using futexes on linux and pthread on other unix. Windows
may have a possible implementation using Waitable timers but that is
not implemented here and instead falls back to the GCond implementation.
GCond waits on Windows is still as accurate as the previous GstPoll-based
implementation.
Matthew Waters [Tue, 14 Apr 2020 05:08:47 +0000 (15:08 +1000)]
systemclock: log the object name with all debug logs
Simplifies correlating logs with clock instances
Matthew Waters [Tue, 14 Apr 2020 04:48:20 +0000 (14:48 +1000)]
systemclock: move to GCond waiting
Thibault Saunier [Mon, 13 Apr 2020 00:33:43 +0000 (20:33 -0400)]
value: Fix segfault comparing empty GValueArrays
Adding a test
Mathieu Duponchelle [Wed, 8 Apr 2020 20:22:48 +0000 (22:22 +0200)]
pipeline: fix base_time selection when flush seeking live
When a live pipeline goes to PLAYING, its change_state method
is called twice for PAUSED_TO_PLAYING: the first time is
from GstElement, when NO_PREROLL is returned, the second
is from GstBin, after all async_done messages have been
collected.
base_time selection is done only the first time, through
comparisons with start_time.
On the other hand, when this live pipeline gets flush seeked,
even though start_time is reset by the sink upon reception
of flush_stop(reset_time=TRUE), PAUSED_TO_PLAYING only occurs
once, from GstBin, after all async_done messages have been
collected. This causes the base_time to be off by <latency>.
This commit addresses this by mimicing the behaviour of
GstElement on NO_PREROLL, and calling the change_state
method manually when the following conditions are met:
* The pipeline is live
* The target state is PLAYING
Vivia Nikolaidou [Thu, 9 Apr 2020 13:38:23 +0000 (16:38 +0300)]
multiqueue: Add current-level-{buffers, bytes, time} pad properties
To get the current buffers/bytes/time levels of the corresponding
internal queue
Vivia Nikolaidou [Thu, 9 Apr 2020 10:12:22 +0000 (13:12 +0300)]
multiqueue: Add stats property
The returned "stats" structure contains, for now, one array called
"queues" with one GstStructure per internal queue, containing said
queue's current level of bytes, buffers, and time.
Xavier Claessens [Wed, 8 Apr 2020 16:09:10 +0000 (12:09 -0400)]
Meson: Change extra-checks to feature option and make it yielding
Jan Schmidt [Wed, 8 Apr 2020 07:53:17 +0000 (17:53 +1000)]
baseparse: Don't return more data than asked for in pull_range()
Even when pulling a new 64KB buffer from upstream, don't return
more data than was asked for in the pull_range() method and then
return less later, as that confused subclasses like h264parse.
Add a unit test that when a subclass asks for more data, it always
receives a larger buffer on the next iteration, never less.
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/530
Vivia Nikolaidou [Mon, 6 Apr 2020 15:14:12 +0000 (18:14 +0300)]
downloadbuffer, multiqueue, queue2: Fix watermark docs
It is not explicitly specified anywhere in the docs that 0% buffering is
at low-watermark and 100% buffering is at high-watermark. It was
specified only in the sources.
Sebastian Dröge [Thu, 2 Apr 2020 10:45:48 +0000 (13:45 +0300)]
pad: Add a guard against getrange functions not filling a caller-provided buffer
It's a programming error to not do so and would cause all kinds of
problems in the caller that assumed its own buffer to have been filled.
Nicolas Dufresne [Fri, 31 Jan 2020 16:32:10 +0000 (11:32 -0500)]
task: Introduce gst_task_resume() API
This new API allow resuming a task if it was paused, while leaving it to
stopped stated if it was stopped or not started yet. This new API can be
useful for callback driver workflow, where you basically want to pause and
resume the task when buffers are notified while avoiding the race with a
gst_task_stop() coming from another thread.
Mathieu Duponchelle [Wed, 1 Apr 2020 13:41:49 +0000 (15:41 +0200)]
gst-launch: go back down to GST_STATE_NULL in one step.
Going through each state on the way back down to GST_STATE_NULL
can cause deadlocks, for example:
gst-launch-1.0 audiotestsrc ! valve drop=true ! autoaudiosink
ctrl + C
Hangs forever when going to PAUSED, because the "final" state is
ASYNC, and the sink blocks waiting for a preroll buffer.
Going straight to NULL addresses this issue, and also helps
making teardown faster when piping sparse streams to a
sync sink.
Jan Schmidt [Tue, 31 Mar 2020 15:36:40 +0000 (02:36 +1100)]
baseparse: Fix upstream read caching
When running in pull mode (for e.g. mp3 reading),
baseparse currently reads 64KB from upstream, then mp3parse
consumes typically around 417/418 bytes of it. Then
on the next loop, it will read a full fresh 64KB again,
which is a big waste.
Fix the read loop to use the available cache buffer first
before going for more data, until the cache drops to < 1KB.
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/518
Jan Schmidt [Tue, 31 Mar 2020 15:46:52 +0000 (02:46 +1100)]
baseparse: Fix typo
Seungha Yang [Tue, 31 Mar 2020 10:05:30 +0000 (19:05 +0900)]
filesink: Fix for updating the index of memory to write in the next iteration
current_buf_mem_idx stands for the index of memory of the corresponding
buffer which is scheduled to be written in the next iteration.
If all memory objects were scheduled to be written in the current
iteration, reset the index to zero so that starting from the first
memory object of the next buffer.
Seungha Yang [Sat, 28 Mar 2020 07:20:51 +0000 (16:20 +0900)]
filesink: Fix crash caused by zero-size memory allocation
If size of vector is greater than one, we are allocating zero-size
memory and trying invalid memcpy operation
Jan Schmidt [Fri, 22 Nov 2019 12:55:56 +0000 (23:55 +1100)]
gstsegment: Refuse instant-rate seeks in gst_segment_do_seek()
Elements that pass a seek with INSTANT_RATE flag to
gst_segment_do_seek() haven't been updated and we should
refuse the seek.
Jan Schmidt [Fri, 22 Nov 2019 12:53:59 +0000 (23:53 +1100)]
basesrc: Check the return value of gst_segment_do_seek()
Don't assume that a given seek succeeds - check the return result.
Sebastian Dröge [Fri, 20 Mar 2020 17:28:37 +0000 (19:28 +0200)]
filesink: Add a new full buffer mode to filesink
Previously the default and full modes were the same. Now the default
mode is like before: it accumulates all buffers in a buffer list until
the threshold is reached and then writes them all out, potentially in
multiple writes.
The new full mode works by always copying memory to a single memory area
and writing everything out with a single write once the threshold is
reached.
Sebastian Dröge [Fri, 20 Mar 2020 16:48:52 +0000 (18:48 +0200)]
filesink/fdsink: Write 1 iovec directly without copying if there's no writev() support
Sebastian Dröge [Fri, 20 Mar 2020 16:43:30 +0000 (18:43 +0200)]
fdsink/filesink: Refactor writev() code to prevent stack overflows
If buffer lists with too many buffers would be written before, a stack
overflow would happen because of memory linear with the number of
GstMemory would be allocated on the stack. This could happen for example
when filesink is configured with a very big buffer size.
Instead now move the buffer and buffer list writing into the helper
functions and at most write IOV_MAX memories at once. Anything bigger
than that wouldn't be passed to writev() anyway and written differently
in the previous code, so this also potentially speeds up writing for
these cases.
For example the following pipeline would crash with a stackoverflow:
gst-launch-1.0 audiotestsrc ! filesink buffer-size=
1073741824 location=/dev/null
Matthew Waters [Wed, 25 Mar 2020 09:23:17 +0000 (20:23 +1100)]
flowcombiner: passthrough the flow return if there are no pads
What may happen is that during the course of processing a buffer,
all of the pads in a flow combiner may disappear. In this case, we
would return NOT_LINKED. Instead return whatever the input flow return
was.
Jose Antonio Santos Cadenas [Tue, 10 Apr 2018 16:09:18 +0000 (18:09 +0200)]
gstinfo: Check threshold for category from macro
This way we can avoid to process parameters if log is not going
to be printed.
Matthew Waters [Tue, 24 Mar 2020 04:00:03 +0000 (15:00 +1100)]
docs/running: be consistent with ordering of full-stops inside ``
Everywhere else places the period outside.
Jan Alexander Steffens (heftig) [Mon, 23 Mar 2020 11:28:12 +0000 (12:28 +0100)]
gststructure: Fix gst_structure_take ownership handling
The old code would leave a dangling pointer in oldstr_ptr if two threads
attempted to take the same structure into the same location at the same
time:
1. First "oldstr == newstr" check (before the loop) fails.
2. Compare-and-exchange fails, due to a second thread completing the
same gst_structure_take.
3. Second "oldstr == newstr" check (in the loop) succeeds, loop breaks.
4. "oldstr" check succeeds, old structure gets freed.
5. oldstr_ptr now contains a dangling pointer.
This shouldn't happen in code that handles ownership sanely, so check
that we don't try to do this and complain loudly.
Also simplify the function by using a do-while loop, like
gst_mini_object_take.
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/413
Jan Alexander Steffens (heftig) [Mon, 23 Mar 2020 11:36:01 +0000 (12:36 +0100)]
gstdeviceproviderfactory: Remove volatile from provider storage
Avoids a few compiler warnings:
../subprojects/gstreamer/gst/gstdeviceproviderfactory.c: In function ‘gst_device_provider_factory_finalize’:
../subprojects/gstreamer/gst/gstdeviceproviderfactory.c:96:12: warning: assignment discards ‘volatile’ qualifier from pointer target type [-Wdiscarded-qualifiers]
96 | provider = g_atomic_pointer_get (&factory->provider);
| ^
../subprojects/gstreamer/gst/gstdeviceproviderfactory.c: In function ‘gst_device_provider_factory_get’:
../subprojects/gstreamer/gst/gstdeviceproviderfactory.c:276:19: warning: assignment discards ‘volatile’ qualifier from pointer target type [-Wdiscarded-qualifiers]
276 | device_provider = g_atomic_pointer_get (&newfactory->provider);
| ^
../subprojects/gstreamer/gst/gstdeviceproviderfactory.c:309:21: warning: assignment discards ‘volatile’ qualifier from pointer target type [-Wdiscarded-qualifiers]
309 | device_provider = g_atomic_pointer_get (&newfactory->provider);
|
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/414
Ondřej Hruška [Sun, 22 Mar 2020 08:47:35 +0000 (09:47 +0100)]
gstdatetime: Add missing NULL check to gst_date_time_new_local_time
Also add a unit test for this.
Fixes #524
Edward Hervey [Fri, 20 Mar 2020 08:11:02 +0000 (09:11 +0100)]
registrychunks: Use strnlen if available
When this `_strnlen` internal method was added, strnlen (in glibc)
was not available yet (appeared in 2.10 it was released that same
year).
If available, use the much more optimized strnlen
Sebastian Dröge [Fri, 20 Mar 2020 14:32:07 +0000 (16:32 +0200)]
filesink: Check for sys/uio.h so we can actually use writev()
Edward Hervey [Thu, 19 Mar 2020 10:20:14 +0000 (11:20 +0100)]
gstvalue: Avoid expensive fallback on intersection
The type checks at the end of `gst_value_intersect` to call the flagset
intersection are relatively expensive.
If we already know that:
* There was a compare function but it didn't return GST_VALUE_EQUAL
* AND none of the registered intersect functions failed
Then we know they can't intersect and can return early.
Trims ~20% of the instruction calls
Edward Hervey [Wed, 18 Mar 2020 08:43:27 +0000 (09:43 +0100)]
gstvalue: Optimize some list<=>list functions
For subtracting a list from another, the previous implementation would
do a double subtraction of one from another (which would create temporary
arrays/values which would then be discarded). Instead iterate and do
the comparision directly.
For intersecting a list with another, we can directly iterate both at
once and therefore avoid doing a *full* check of all values of the list
against all other values of the list.
Edward Hervey [Wed, 18 Mar 2020 08:39:35 +0000 (09:39 +0100)]
gstvalue: Inline GstValueList/GstValueArray
This tries to inline as much as possible array/list and its contents
in order to avoid double allocation/freeing. This also improves the
locality of data.
The internal value is still API/ABI compatible with the *public*
GArray structure. This allows READ-ONLY backwards compatibility with
any external users that assume that the content of a list/array value
is backed by a GArray.
Miguel Paris [Tue, 3 Mar 2020 14:36:26 +0000 (15:36 +0100)]
bufferlist: foreach: always remove as parent if buffer is changed
In case the buffer is not writable, the parent (the BufferList) is not
removed before calling func. So if it is changed, the parent (the BufferList)
of the previous buffer should be removed after calling func.
Edward Hervey [Wed, 18 Mar 2020 10:10:13 +0000 (11:10 +0100)]
bufferlist: Add check for overflow
Edward Hervey [Tue, 10 Mar 2020 17:14:57 +0000 (18:14 +0100)]
gststructure: Optimize pre-allocation of structures
For all the structure creation using valist/varargs we calculate
the number of fields we will need to store. This ensures all callers
will end up with a single allocation.
Edward Hervey [Tue, 10 Mar 2020 17:13:09 +0000 (18:13 +0100)]
gststructure: Inline array and contents
Instead of having 3 allocations:
* One for GstStructure
* One for GArray
* One for the array *within* GArray
We try to limit this to a single allocation, inlining everything. This
reduces the number of micro-allocations and improves locality of data
access.
Thibault Saunier [Fri, 13 Mar 2020 19:41:52 +0000 (16:41 -0300)]
value: Handle NULL caps for comparisons
Having a NULL caps in a GValue is legal and we should handle it
properly for comparisons.
Stéphane Cerveau [Fri, 13 Mar 2020 11:14:08 +0000 (12:14 +0100)]
identity: Fix a minor leak using meta_str
Thibault Saunier [Wed, 11 Mar 2020 18:19:45 +0000 (15:19 -0300)]
value: Refactor parsing lists to allow trailing comas
Before that commit `{test, }` wouldn't be accepted as an array
because of the trailing coma, the commit fixes that.
At the same time, the code has been refactored to avoid special casing
the first element of the list, making `{,}` or `<,>` valid lists.
Guillaume Desmottes [Mon, 10 Feb 2020 12:59:41 +0000 (18:29 +0530)]
clock: remove documentation link on GTimeVal
Looks like it's been removed from glib.devhelp2 on Fedora 31.
Fix #508
Matthew Waters [Wed, 11 Mar 2020 11:39:35 +0000 (22:39 +1100)]
basetransform: allow not passthrough if generate_output is implemented
This allows an element to not require implementing transform or
transform_ip.
Sebastian Dröge [Mon, 9 Mar 2020 19:32:28 +0000 (21:32 +0200)]
clocksync: Use g_cond_signal() instead of g_cond_broadcast()
There can only be a single waiter: on the streaming thread.
Sebastian Dröge [Mon, 9 Mar 2020 19:31:48 +0000 (21:31 +0200)]
identity: Use g_cond_signal() instead of g_cond_broadcast()
There can only be a single waiter: on the streaming thread.
Sebastian Dröge [Mon, 9 Mar 2020 18:27:58 +0000 (20:27 +0200)]
identity: Unblock condition variable on FLUSH_START
... and immediately return FLUSHING from the streaming thread instead of
waiting potentially forever.
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/516
Sebastian Dröge [Mon, 9 Mar 2020 13:17:08 +0000 (15:17 +0200)]
systemclock: Don't start the system clock at 0 on Windows
We kept the start time around and subtracted it everywhere for "easy of
debugging", but we don't do anything like this anywhere else and it
only complicates the code unnecessarily.
Sebastian Dröge [Mon, 9 Mar 2020 13:16:00 +0000 (15:16 +0200)]
systemclock: Don't divide by zero on Windows if high performance timers are not available
Sebastian Dröge [Sat, 7 Mar 2020 09:09:05 +0000 (11:09 +0200)]
caps: Don't assert in fixate() on EMPTY/ANY caps and document EMPTY/ANY behaviour on more functions
fixate() will return empty caps if it gets empty caps passed and assert
early if any caps are provided as there's no meaningful way of fixating
any caps.
truncate() and simplify() will return the input caps in case of
any/empty caps as before, but slightly optimized and as documented
behaviour.
Also add tests for this and a few other operations behaviour on
empty/any caps.
Mathieu Duponchelle [Wed, 4 Mar 2020 21:13:12 +0000 (22:13 +0100)]
gstaggregator: fix the prototype of sink_event_pre_queue
This is not an API breakage, as implementors are already
expected to return a GstFlowReturn
Seungha Yang [Tue, 3 Mar 2020 09:49:36 +0000 (18:49 +0900)]
gst-launch: Follow up to missing s/g_print/gst_print/g
Required to avoid broken log string on Windows but missed
in the commit of
493a3261a9757b5ade7aec289eb07221966f9eed
Seungha Yang [Sat, 29 Feb 2020 10:00:44 +0000 (19:00 +0900)]
tests: info: Fix thread-id pattern matching on Windows
The format modifier for thread-id prints hex value without "0x" prefix on Windows.
Tim-Philipp Müller [Sun, 26 Jan 2020 00:56:44 +0000 (00:56 +0000)]
tracers: rusage: use thread-local storage for per-thread stats
.. instead of looking things up by thread id from a GHashTable,
which also happens to have no locking around insertion/lookup.
Tim-Philipp Müller [Sun, 26 Jan 2020 00:32:18 +0000 (00:32 +0000)]
tracers: rusage: fix minor string leak in constructor
Johan Bjäreholt [Sat, 2 Nov 2019 10:49:25 +0000 (11:49 +0100)]
gst-stats: Fix missing NULL checks
gst-inspect-1.0 segfaults on tracing logs where it fails to find
element stats. So on the pipelines where we get the following WARNING
during execution will afterwards crash with a segfault as the
g_ptr_array has a index for it but it is just a NULL pointer.
WARN default gst-stats.c:444:do_message_stats: no element stats found for ix=X
An example of an pipeline which can reproducibly create a trace log
where this occurs would be this
GST_DEBUG="GST_TRACER:7" GST_TRACERS="stats;rusage;latency" gst-launch-1.0 videotestsrc num-buffers=120 ! autovideosink &> trace.log
gst-stats-1.0 trace.log
Olivier Crête [Mon, 24 Feb 2020 20:24:44 +0000 (15:24 -0500)]
basesink: Improve clarity of latency query maths debug message
Add the equation to the debug message to make it easier for non-GStreamer
experts to understand why their pipeline has latency.
Nirbheek Chauhan [Wed, 26 Feb 2020 11:50:04 +0000 (17:20 +0530)]
tests: Maintain compatibility with GLib 2.48
That's the minimum version of GLib we require right now.
Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/514
Jan Schmidt [Mon, 24 Feb 2020 17:47:35 +0000 (04:47 +1100)]
clocksync: Add new clocksync element
The clocksync element is a generic element that can be
placed in a pipeline to synchronise passing buffers to the
clock at that point. This is similar to 'identity sync=true',
but because it isn't GstBaseTransform-based, it can process
GstBufferLists without breaking them into separate GstBuffers
Seungha Yang [Wed, 26 Feb 2020 13:29:43 +0000 (22:29 +0900)]
gst-inspect: Add define guard for g_log_writer_supports_color()
g_log_writer_supports_color() was introduced since GLib 2.50.0
which is slightly higher version than our minimum required GLib version.
Nirbheek Chauhan [Tue, 25 Feb 2020 13:43:59 +0000 (19:13 +0530)]
Don't use glib format modifiers with sscanf or printf
We do not have a way to know the format modifiers to use with string
functions provided by the system. `G_GUINT64_FORMAT` and other string
modifiers only work for glib string formatting functions. We cannot
use them for string functions provided by the stdlib. See:
https://developer.gnome.org/glib/stable/glib-Basic-Types.html#glib-Basic-Types.description
F.ex.:
```
../tools/gst-stats.c:921:11: error: too many arguments for format [-Werror=format-extra-args]
printf ("Number of Buffers passed: %" G_GUINT64_FORMAT "\n", num_buffers);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../tools/gst-stats.c:922:11: error: unknown conversion type character 'l' in format [-Werror=format=]
printf ("Number of Events sent: %" G_GUINT64_FORMAT "\n", num_events);
^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /builds/nirbheek/cerbero/cerbero-build/dist/windows_x86_64/include/glib-2.0/glib/gtypes.h:32,
from /builds/nirbheek/cerbero/cerbero-build/dist/windows_x86_64/include/glib-2.0/glib/galloca.h:32,
from /builds/nirbheek/cerbero/cerbero-build/dist/windows_x86_64/include/glib-2.0/glib.h:30,
from ../gst/gst.h:27,
from ../tools/tools.h:28,
from ../tools/gst-stats.c:30:
/builds/nirbheek/cerbero/cerbero-build/dist/windows_x86_64/lib/glib-2.0/include/glibconfig.h:69:28: note: format string is defined here
#define G_GUINT64_FORMAT "llu"
^
```
and
```
../tests/misc/netclock-replay.c: In function 'main':
../tests/misc/netclock-replay.c:98:23: error: unknown conversion type character 'l' in format [-Werror=format=]
if (sscanf (line, "%" G_GUINT64_FORMAT " %" G_GUINT64_FORMAT " %"
^~~
In file included from /builds/nirbheek/cerbero/cerbero-build/dist/windows_x86/include/glib-2.0/glib/gtypes.h:32,
from /builds/nirbheek/cerbero/cerbero-build/dist/windows_x86/include/glib-2.0/glib/galloca.h:32,
from /builds/nirbheek/cerbero/cerbero-build/dist/windows_x86/include/glib-2.0/glib.h:30,
from ../tests/misc/../../libs/gst/net/gstntppacket.c:38,
from ../tests/misc/netclock-replay.c:31:
/builds/nirbheek/cerbero/cerbero-build/dist/windows_x86/lib/glib-2.0/include/glibconfig.h:69:28: note: format string is defined here
#define G_GUINT64_FORMAT "llu"
^
```
This is needed for upgrading glib inside Cerbero which builds with
`-Werror` on Windows:
https://gitlab.freedesktop.org/gstreamer/cerbero/merge_requests/419
Tim-Philipp Müller [Wed, 19 Feb 2020 18:49:07 +0000 (18:49 +0000)]
debugutils: skip "parent" property for elements when dumping pipeline graph
Seems unnecessary to print the parent name for every
element in the pipeline graph, it's clear from the
graph what the parent element is and it's hard to
imagine a case where this is useful info rather than
just distracting spam. So far this was only done for
pads, but we should just do it for everything.
Matus Gajdos [Thu, 19 Dec 2019 10:28:13 +0000 (11:28 +0100)]
baseparse: fix memory leak
A buffer to be skipped wasn't unref'd in gst_base_parse_chain().
Fixes #406
Olivier Crête [Mon, 27 Jan 2020 19:46:18 +0000 (14:46 -0500)]
leak tracer: Initialize GValue