Commit graph

18983 commits

Author SHA1 Message Date
Edward Hervey
62f553873b 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>
2020-05-05 10:17:49 +00:00
Edward Hervey
7e1a0ed604 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>
2020-05-05 10:17:49 +00:00
Edward Hervey
586454bf10 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>
2020-05-05 10:17:49 +00:00
Edward Hervey
973986f40b 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>
2020-05-05 10:50:05 +02:00
Rubén Gonzalez
32600b48a2 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>
2020-05-04 20:20:17 +00:00
Edward Hervey
841fa7062e 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>
2020-05-04 14:41:01 +00:00
Edward Hervey
5e553b8cce 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>
2020-05-04 12:26:10 +00:00
Edward Hervey
7a207da733 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>
2020-05-04 12:26:10 +00:00
Edward Hervey
1d0bda8005 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>
2020-05-04 12:26:10 +00:00
Edward Hervey
a307c0623c 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>
2020-05-04 12:26:10 +00:00
Edward Hervey
c416e2457e 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>
2020-05-04 12:26:10 +00:00
Sebastian Dröge
687c65994e 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>
2020-05-04 09:21:02 +03:00
Sebastian Dröge
c09f797231 aggregator: Mark segment parameter as const in gst_aggregator_update_segment()
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/457>
2020-05-03 16:11:39 +03:00
Tim-Philipp Müller
df6cbe64cd 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>
2020-05-01 21:12:31 +00:00
Sebastian Dröge
333b77bc9f Add missing colons to Since markers in the docs
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/452>
2020-05-01 10:07:09 +03:00
Mathieu Duponchelle
d2299180c9 multiqueue: fix link-like syntax in doc 2020-04-28 00:33:22 +02:00
Matthew Waters
9c45afc87c 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>
2020-04-24 12:51:07 +10:00
Nicolas Dufresne
8ecf0956d7 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>
2020-04-23 13:20:46 +00:00
Matthew Waters
a4caf7b254 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>
2020-04-23 15:55:46 +10:00
Juan Navarro
358d4e991a 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>
2020-04-22 17:27:31 +00:00
Matthew Waters
166c0fbc47 Revert "gstvalue: Avoid expensive fallback on intersection"
This reverts commit cd751c2de3.
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>
2020-04-22 15:18:50 +00:00
Seungha Yang
684723d07c 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>
2020-04-22 20:59:02 +09:00
Charlie Turner
e310a738f6 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
74938f07c2 (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>
2020-04-21 19:53:33 +00:00
Sebastian Dröge
ed1022fa81 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.
2020-04-20 16:28:52 +00:00
dhilshad
c8bcb9db18 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
2020-04-17 15:16:18 +00:00
Edward Hervey
ab8674d503 gstregistrychunks: Directly set name on features 2020-04-17 09:26:45 +02:00
Edward Hervey
d4f84ad4e6 gstobject: Don't double-notify when setting names
If the name is set via the gobject setters, the notificatio will
already be emitted.
2020-04-17 09:26:45 +02:00
Jan Tojnar
dd2ec3681e
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]: 81ba2c7e7d
[2]: https://github.com/scop/bash-completion/pull/344
2020-04-16 15:50:02 +02:00
Matthew Waters
de0ec87ba1 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.
2020-04-16 01:26:59 +00:00
Matthew Waters
6f9a63a10d 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.
2020-04-16 01:26:59 +00:00
Matthew Waters
546bf6ec25 systemclock: log the object name with all debug logs
Simplifies correlating logs with clock instances
2020-04-16 01:26:59 +00:00
Matthew Waters
2c8a65745c systemclock: move to GCond waiting 2020-04-16 01:26:59 +00:00
Thibault Saunier
88f0312624 value: Fix segfault comparing empty GValueArrays
Adding a test
2020-04-12 20:33:43 -04:00
Mathieu Duponchelle
0566b0528a 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
2020-04-09 15:41:36 +00:00
Vivia Nikolaidou
4679c2ed6f multiqueue: Add current-level-{buffers, bytes, time} pad properties
To get the current buffers/bytes/time levels of the corresponding
internal queue
2020-04-09 18:03:35 +03:00
Vivia Nikolaidou
74938f07c2 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.
2020-04-09 17:57:43 +03:00
Xavier Claessens
c18f9d4ad4 Meson: Change extra-checks to feature option and make it yielding 2020-04-08 18:41:51 +00:00
Jan Schmidt
e94ad24b9f 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
2020-04-08 19:13:25 +10:00
Vivia Nikolaidou
cbdc259865 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.
2020-04-06 18:19:06 +03:00
Sebastian Dröge
606a9acd74 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.
2020-04-02 13:47:37 +03:00
Nicolas Dufresne
e272ae281f 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.
2020-04-01 15:13:59 +00:00
Mathieu Duponchelle
c682579c5e 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.
2020-04-01 15:41:49 +02:00
Jan Schmidt
e906197c62 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
2020-04-01 18:36:19 +11:00
Jan Schmidt
35136dc91a baseparse: Fix typo 2020-04-01 18:36:19 +11:00
Seungha Yang
13bee5ae0c 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.
2020-03-31 19:05:30 +09:00
Seungha Yang
5c74c8c4f8 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
2020-03-28 16:20:51 +09:00
Jan Schmidt
e98ccc7665 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.
2020-03-26 13:51:41 +00:00
Jan Schmidt
1b92672e3b basesrc: Check the return value of gst_segment_do_seek()
Don't assume that a given seek succeeds - check the return result.
2020-03-26 13:51:41 +00:00
Sebastian Dröge
dcb2be3282 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.
2020-03-26 11:31:03 +00:00
Sebastian Dröge
93ffec7b2e filesink/fdsink: Write 1 iovec directly without copying if there's no writev() support 2020-03-26 11:31:03 +00:00