platform/upstream/gstreamer.git
4 years agopluginfeature: Allow updating initial rank of plugin feature
Seungha Yang [Thu, 15 Aug 2019 11:56:40 +0000 (20:56 +0900)]
pluginfeature: Allow updating initial rank of plugin feature

Introducing "GST_PLUGIN_FEATURE_RANK" environment variable in order for users
to adjust rank of plugin(s) via environment.

A "feature" and "rank" key-value pair should be separable by ":",
and each key-value pair is recognized per "," delimiters. The rank
can be a numerical value or one of pre-defined rank values
such as "NONE", "MARGINAL", "SECONDARY", and "PRIMARY" in case-insensitive manner.

In addition to pre-defined { NONE, MARGINAL, SECONDARY, PRIMARY },
"MAX" can be passed to key value used to ensure having a higher rank
than other plugin features.

Example)
- GST_PLUGIN_FEATURE_RANK=qtdemux:256,h264parse:NONE
Set rank of qtdemux plugin to 256 (primary) and 0 (none) for h264parse.

4 years agogstinfo: Add new API for getting debug log lines
Nirbheek Chauhan [Thu, 29 Aug 2019 18:53:09 +0000 (00:23 +0530)]
gstinfo: Add new API for getting debug log lines

If you're using a custom log handler, you had to reverse-engineer the
debug log format and create your own format function. Now, you can
call `gst_debug_log_get_line()` and it will return a string (without
ANSI escape color codes) representation instead.

This is useful in situations when you need to log the ordinary
gst_debug log to a resource that can't be opened as a `FILE` handle.

Also includes a test.

4 years agotests: remove system-dependent tests
Mathieu Duponchelle [Fri, 20 Dec 2019 13:01:02 +0000 (14:01 +0100)]
tests: remove system-dependent tests

We now have GstTestClock-based tests that validate the same logic,
without inducing spurious timing failures / overly relying on sleeps.

Fixes: #346
Fixes: #347
Fixes: #348

Co-authored by: Thibault Saunier <tsaunier@igalia.com>

4 years agotests-clock: Fix race in test_late_crank
Thibault Saunier [Fri, 20 Dec 2019 13:53:21 +0000 (10:53 -0300)]
tests-clock: Fix race in test_late_crank

There was a case where we started waiting on the clock before setting
the clock time, leading to the wait succeeding instead of being late:

    gsttestclock.c:1073:F:testclock:test_late_crank:0: '1 * GST_SECOND' (1000000000) is not equal to 'context.jitter' (-4000000000)

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/426

Co-authored by: Mathieu Duponchelle <mathieu@centricular.com>

4 years agobin: Add method to find elements by factory name
Niels De Graef [Fri, 15 Nov 2019 14:49:32 +0000 (15:49 +0100)]
bin: Add method to find elements by factory name

A common use case of a dynamically built pipeline is that you want to
(conditionally) find a certain element, e.g. the `rtpbin`s in a
`uridecodebin`. If that element has a fixed name inside its parent bin
(and only has a single instance) this can be easily done by
`gst_bin_get_by_name()`.

If there are multiple instances of the element however, you can only use
`gst_bin_iterate_all_by_interface()`, but this doesn't work if you don't
have the specific `GType` (which is often the case, due to plugins being
dynamically loaded). As such, another fallback could be to use the
well-known name of the element's factory (in case of our example, this
is of course `"rtpbin"`).

4 years agogstreamer: use of g_value_dup_string
Stéphane Cerveau [Wed, 18 Dec 2019 14:57:35 +0000 (15:57 +0100)]
gstreamer: use of g_value_dup_string

Use helper method to get string from GValue.

4 years agotests: fix pipelines_parse_launch.delayed_link flakiness
Mathieu Duponchelle [Fri, 13 Dec 2019 17:21:32 +0000 (18:21 +0100)]
tests: fix pipelines_parse_launch.delayed_link flakiness

Fixes #345

There were two causes for the flakiness, one much rarer than
the other.

The test sets up a source with a sometimes pad added during
the transition of a wrapper bin from READY to PAUSED.

It runs 4 iterations, the last of which makes it so the
negotiation fails.

In that case, the intention as correctly presented by the following
comment:

/* [..] ie, the pipeline should create ok but fail to change state */

However the implementation of run_delayed_test was neither calling
get_state on the pipeline (it called it on the wrapper bin), nor
checking that the return of get_state was FAILURE (it actually
checked that it was not).

This led to an obvious race condition, and was fixed by calling
get_state on the pipeline, then checking that in this specific
case (expect_link == FALSE), the state change has actually failed.

The second, rarer race condition is at set_state time. When we
don't expect the link to succeed, the return of set_state may
either be FAILURE or ASYNC, depending on timing. This was fixed
by taking expect_link into account when checking the return value
of set_state.

Co-authored by: Thibault Saunier <tsaunier@igalia.com>

4 years agopluginloader: handle fsync interrupted by signal (EINTR)
Peter Seiderer [Thu, 12 Dec 2019 10:39:56 +0000 (11:39 +0100)]
pluginloader: handle fsync interrupted by signal (EINTR)

According to [1] EINTR is a possible errno for fsync(),
so handle it as all other EINTR (do/while(errno == EINTR)).

Signed-off-by: Peter Seiderer <ps.report@gmx.net>
4 years agoregistry: handle fsync interrupted by signal (EINTR)
Peter Seiderer [Thu, 12 Dec 2019 10:37:56 +0000 (11:37 +0100)]
registry: handle fsync interrupted by signal (EINTR)

According to [1] EINTR is a possible errno for fsync(),
so handle it as all other EINTR (do/while(errno == EINTR)).

Signed-off-by: Peter Seiderer <ps.report@gmx.net>
4 years agofilesink: handle fsync interrupted by signal (EINTR)
Peter Seiderer [Thu, 12 Dec 2019 10:07:07 +0000 (11:07 +0100)]
filesink: handle fsync interrupted by signal (EINTR)

According to [1] EINTR is a possible errno for fsync() and it happens in
reality on linux (video writing via splitmuxsink with robust muxing enabled
on a cifs mounted network share), so handle it as all other EINTR
(do/while(errno == EINTR)).

Fixes:

  GError.message: Error while writing to file "vidoe_001.mp4". GError.domain: 2372 GError.code: 10 from: FileSink debug: gstfilesink.c(849): gst_file_sink_render (): /GstPipeline:Pipeline/GstSplitMuxSink:SplitMuxSink/GstBin:QueueBin/GstFileSink:FileSink: Interrupted system call

Signed-off-by: Peter Seiderer <ps.report@gmx.net>
4 years agoRemove deprecated GTimeVal
Olivier Crête [Tue, 10 Dec 2019 22:06:02 +0000 (17:06 -0500)]
Remove deprecated GTimeVal

GTimeVal won't work past 2038

4 years agodevice, elementfactory: relax floating requirement
Mathieu Duponchelle [Tue, 10 Dec 2019 12:31:50 +0000 (13:31 +0100)]
device, elementfactory: relax floating requirement

Using g_assert() is a bit too extreme, as it will abort the whole
program unless G_DISABLE_ASSERTS is true.

Switch to g_critical()

4 years agogstcheck: remove bogus refcount asserts
Mathieu Duponchelle [Tue, 10 Dec 2019 08:42:37 +0000 (09:42 +0100)]
gstcheck: remove bogus refcount asserts

As soon as gstcheck potentially calls out to code it does not
control, such as gst_element_request_pad, all assertions about
pad refcounts go out the window.

4 years agoaggregator: fix logging in new update_segment API
Mathieu Duponchelle [Fri, 6 Dec 2019 10:40:44 +0000 (11:40 +0100)]
aggregator: fix logging in new update_segment API

4 years agoaggregator: add method to update srcpad segment
Mathieu Duponchelle [Thu, 5 Dec 2019 12:44:33 +0000 (13:44 +0100)]
aggregator: add method to update srcpad segment

4 years agobus: Clean up #ifdefs to compile with debugging enabled in all combinations
Sebastian Dröge [Thu, 5 Dec 2019 07:54:32 +0000 (09:54 +0200)]
bus: Clean up #ifdefs to compile with debugging enabled in all combinations

Thanks to Roland Jon for finding this.

4 years agodevice, elementfactory: don't enforce floating status
Mathieu Duponchelle [Wed, 4 Dec 2019 19:12:02 +0000 (20:12 +0100)]
device, elementfactory: don't enforce floating status

The reference we receive when calling g_object_new should be
floating, but we can't force it at our level.

Switch from g_object_force_floating() to a simple assertion.

See https://gitlab.freedesktop.org/gstreamer/gst-python/issues/27

4 years agotestclock: added single clock id process function
Tulio Beloqui [Wed, 19 Jun 2019 11:45:54 +0000 (13:45 +0200)]
testclock: added single clock id process function

Co-authored-by: Havard Graff <hgr@pexip.com>
4 years agobus: Use new GSource dispose function
Sebastian Dröge [Mon, 21 Oct 2019 14:56:14 +0000 (17:56 +0300)]
bus: Use new GSource dispose function

Without this it is possible that we have a GSource with reference count
0 stored in the GstBus that is currently in the process of being
destroyed. gst_bus_remove_watch() might then access it, increase its
reference count to 1 again, call GSource API on it and then unref it,
which will then finalize it a second time.

The dispose function allows the GSource to be resurrected until it
returned so the above would be safe now.

This caused some spurious crashes during shutdown in various
applications.

4 years agoMeson: Add 'coretracers' feature option
Xavier Claessens [Tue, 3 Dec 2019 20:40:59 +0000 (15:40 -0500)]
Meson: Add 'coretracers' feature option

This was the only plugin still built when using
-Dauto_features=disabled, besides coreelements.

4 years agogstharness: don't push the event to the queue before processing
Håvard Graff [Tue, 3 Dec 2019 11:23:01 +0000 (11:23 +0000)]
gstharness: don't push the event to the queue before processing

The application might pull and unref it by the time the code gets
around to check it for EOS.

4 years agobaseparse: Don't copy invalid DTS to the PTS
Vivia Nikolaidou [Thu, 28 Nov 2019 11:09:45 +0000 (13:09 +0200)]
baseparse: Don't copy invalid DTS to the PTS

We were checking to make sure the buffer's DTS wouldn't be after its
PTS. However, the check would also trigger when DTS is NONE, which is
e.g. in the case of some broken cameras.

Fixes #470

4 years agotracers: Don't leak temporary GstStructure
Edward Hervey [Wed, 27 Nov 2019 14:47:32 +0000 (15:47 +0100)]
tracers: Don't leak temporary GstStructure

CID: 1455462

4 years agoGstBuffer: size-related optimization
Edward Hervey [Wed, 21 Nov 2018 15:14:58 +0000 (16:14 +0100)]
GstBuffer: size-related optimization

Avoid calling generic function when it's possible to directly
return/get sizes

4 years agoGstBuffer: Inline fast-path for merged memory
Edward Hervey [Wed, 21 Nov 2018 15:13:48 +0000 (16:13 +0100)]
GstBuffer: Inline fast-path for merged memory

4 years agodocs: mention gst_parse_bin_from_description() in gst_parse_launch() docs
Tim-Philipp Müller [Wed, 27 Nov 2019 09:41:36 +0000 (09:41 +0000)]
docs: mention gst_parse_bin_from_description() in gst_parse_launch() docs

4 years agodatetime: Add constructor for timestamps in microseconds
Linus Svensson [Fri, 22 Nov 2019 15:04:20 +0000 (16:04 +0100)]
datetime: Add constructor for timestamps in microseconds

4 years agobaseparse: Make sure PTS >= DTS
Vivia Nikolaidou [Fri, 11 Oct 2019 14:33:42 +0000 (17:33 +0300)]
baseparse: Make sure PTS >= DTS

If, for example, we are accumulating rounding errors from the buffer
duration when calculating the PTS/DTS, it can happen that the buffer
thinks it should be presented before it's decoded. In that case we just
clamp the DTS.

4 years agogstbuffer: update documentation
Stéphane Cerveau [Mon, 18 Nov 2019 00:15:31 +0000 (00:15 +0000)]
gstbuffer: update documentation

remove unclear documentation about GST_BUFFER_FLAG_MARKER

4 years agogst-launch: Disable printing current position by default when stdout is not a tty
Seungha Yang [Tue, 12 Nov 2019 02:24:45 +0000 (11:24 +0900)]
gst-launch: Disable printing current position by default when stdout is not a tty

... and add new option to force-enable printing position even if stdout
is not a tty.

4 years agostructure: add gst_structure_take
Havard Graff [Sun, 3 Nov 2019 11:55:13 +0000 (12:55 +0100)]
structure: add gst_structure_take

(╯°□°)╯︵ ┻━┻

4 years agoharness: fixed race condition on forward pad while forwarding sticky events to sink...
Tulio Beloqui [Tue, 20 Aug 2019 11:57:09 +0000 (13:57 +0200)]
harness: fixed race condition on forward pad while forwarding sticky events to sink harness

Co-authored-by: Camilo Celis <camilo@pexip.com>
Co-authored-by: Havard Graff <hgr@pexip.com>
4 years agohotdoc: Add missing json escaping
Thibault Saunier [Tue, 12 Nov 2019 22:15:34 +0000 (19:15 -0300)]
hotdoc: Add missing json escaping

Fixes https://gitlab.freedesktop.org/gstreamer/gst-docs/issues/50

4 years agoevent: Fix gir warning
Wonchul Lee [Tue, 12 Nov 2019 06:19:28 +0000 (15:19 +0900)]
event: Fix gir warning

It fixes below gir warnings.
../subprojects/gstreamer/gst/gstevent.c:2246: Warning: Gst:
gst_event_new_instant_rate_sync_time: unknown parameter
'rate_multiplier' in documentation comment, should be 'rate'
../subprojects/gstreamer/gst/gstevent.c:2296: Warning: Gst:
gst_event_parse_instant_rate_sync_time: unknown parameter
'rate_multiplier' in documentation comment, should be 'rate'

4 years agogst/parse: define pure-parser depending on bison version
Víctor Manuel Jáquez Leal [Mon, 26 Aug 2019 10:48:28 +0000 (12:48 +0200)]
gst/parse: define pure-parser depending on bison version

After release bison 2.5 the declaration %pure-parser was deprecated
in favor of %define api.pure

Nonetheless, until bison 3.4, the declaration was treated as backward
compatibility, but now bison shows a warning:

  warning: deprecated directive, use ‘%define api.pure’

The patch's approach is to handle both directives according with the
used bison's version, by string replacement at source configuration
stage.

4 years agopad: clear sticky event tag upon stream-start
Nayana Topolsky [Thu, 21 Feb 2019 12:29:31 +0000 (13:29 +0100)]
pad: clear sticky event tag upon stream-start

When playing gapless there were situations when some sticky events
like tags were stuck at some pad and then revived much later.
Therefore it is better to clear them upon stream-start.

Fixes #360

4 years agotaglist: Fix broken empty set character in code
Seungha Yang [Thu, 30 May 2019 13:29:23 +0000 (22:29 +0900)]
taglist: Fix broken empty set character in code

Previous one was not a valid ASCII empty set character.
'tig' and 'git log -p' couldn't represent it as expected.

4 years agogst-launch: Add support printing current position of pipeline
Seungha Yang [Thu, 30 May 2019 11:53:34 +0000 (20:53 +0900)]
gst-launch: Add support printing current position of pipeline

By default, gst-launch will print the current position of pipeline (with duration if available).
To disable it, use "--no-position" option.

4 years agogst-launch: Port to the direct use of GMainLoop
Seungha Yang [Wed, 29 May 2019 11:22:54 +0000 (20:22 +0900)]
gst-launch: Port to the direct use of GMainLoop

... instead of custom event loop.
This can make it easy to use GMainLoop related APIs in code.

4 years agogst-launch: Remove meaningless global variable
Seungha Yang [Wed, 29 May 2019 11:24:06 +0000 (20:24 +0900)]
gst-launch: Remove meaningless global variable

4 years agopipeline: Instant rate change handling
Jan Schmidt [Thu, 7 Feb 2019 12:59:51 +0000 (23:59 +1100)]
pipeline: Instant rate change handling

Implement aggregation of INSTANT_RATE_REQUEST messages and sending of
INSTANT_RATE_SYNC_TIME events.

4 years agobasesink: Add support for instant-rate-change events
Sebastian Dröge [Tue, 15 May 2018 15:42:25 +0000 (18:42 +0300)]
basesink: Add support for instant-rate-change events

Post instant-rate-request message when receiving an instant-rate-change
event, and handle the incoming instant-rate-sync-time events from the
pipeline.

4 years agoevent/message: Add new instant-rate-sync-time event and instant-rate-request message
Sebastian Dröge [Mon, 14 May 2018 20:14:24 +0000 (23:14 +0300)]
event/message: Add new instant-rate-sync-time event and instant-rate-request message

4 years agoevent: Add new GST_EVENT_INSTANT_RATE_CHANGE and GST_SEEK_FLAGS_INSTANT_RATE_CHANGE
Sebastian Dröge [Wed, 9 May 2018 12:28:13 +0000 (15:28 +0300)]
event: Add new GST_EVENT_INSTANT_RATE_CHANGE and GST_SEEK_FLAGS_INSTANT_RATE_CHANGE

A seek with that flag set must be non-flushing, not change the playback
direction and start/stop position. A seek handler will then send the new
GST_EVENT_INSTANT_RATE_CHANGE event downstream for downstream elements
to immediately apply the new playback rate before the new in-band segment
event arrives.

4 years agoelementfactory: add GST_ELEMENT_FACTORY_TYPE_HARDWARE
Víctor Manuel Jáquez Leal [Sat, 2 Nov 2019 14:06:28 +0000 (15:06 +0100)]
elementfactory: add GST_ELEMENT_FACTORY_TYPE_HARDWARE

This new symbol matches with the elements within "Hardware" class.

4 years agoqueue2: Use g_object_notify_by_pspec
Niels De Graef [Thu, 31 Oct 2019 10:06:48 +0000 (11:06 +0100)]
queue2: Use g_object_notify_by_pspec

`g_object_notify()` actually takes a global lock to look up the
`GParamSpec` that corresponds to the given property name. It's not a
huge performance hit, but it's easily avoidable by using the
`_by_pspec()` variant.

4 years agotee: First deactivate the pad and then remove it when releasing pads
Sebastian Dröge [Thu, 24 Oct 2019 22:41:27 +0000 (01:41 +0300)]
tee: First deactivate the pad and then remove it when releasing pads

This reverts a96002bb28c21b30fb9338a4620ad20504c70aa5, which is not
necessary anymore. If we release the pad after removing it then none of
the deactivation code will actually be called because the pad has no
parent anymore, and we require a parent on the pad for deactivation to
happen.

This can then, among other things, cause a streaming thread to be still
stuck in a pad probe because the pad was never flushed, and waiting
there forever because now the pad will actually never be flushed anymore.

4 years agotee: Check for the removed pad flag also in the slow pushing path
Sebastian Dröge [Thu, 24 Oct 2019 22:39:50 +0000 (01:39 +0300)]
tee: Check for the removed pad flag also in the slow pushing path

If a pad is currently being released we don't want to forward the
FLUSHING flow return but instead consider it as NOT_LINKED. FLUSHING
would also cause upstream to be FLUSHING.

This part was missed in a3c4a3201a705eb1934ceeea34d1ca42d4571c07 and
resulted in a different (and wrong) workaround in
a96002bb28c21b30fb9338a4620ad20504c70aa5.

4 years agotee: Lock mutex before reading the removed flag of the pads
Sebastian Dröge [Thu, 24 Oct 2019 22:39:05 +0000 (01:39 +0300)]
tee: Lock mutex before reading the removed flag of the pads

Otherwise we're not guaranteed to read the very latest value that
another thread might've written in there when the pad was released, and
could instead work with an old value.

4 years agobin: Drop need-context messages without source instead of crashing
Sebastian Dröge [Mon, 30 Sep 2019 08:34:51 +0000 (11:34 +0300)]
bin: Drop need-context messages without source instead of crashing

4 years agomeson: build gir even when cross-compiling if introspection was enabled explicitly
Tim-Philipp Müller [Thu, 17 Oct 2019 11:13:35 +0000 (12:13 +0100)]
meson: build gir even when cross-compiling if introspection was enabled explicitly

This can be made to work in certain circumstances when
cross-compiling, so default to not building g-i stuff
when cross-compiling, but allow it if introspection was
enabled explicitly via -Dintrospection=enabled.

Fixes #454 and #381.

4 years agoRemove autotools build system
Tim-Philipp Müller [Sun, 9 Jun 2019 00:34:04 +0000 (01:34 +0100)]
Remove autotools build system

4 years agocore: Avoid usage of deprecated API
Edward Hervey [Thu, 10 Oct 2019 13:53:16 +0000 (15:53 +0200)]
core: Avoid usage of deprecated API

GTimeval and related functions are now deprecated in glib.
Replacement APIs have been present since 2.26

4 years agoCheck buffer size before checking buffer data
Xavier Claessens [Mon, 23 Sep 2019 15:19:07 +0000 (11:19 -0400)]
Check buffer size before checking buffer data

If the expected size is bigger than the actual buffer size, it would
memcmp random memory which could lead to crashes instead of proper error
reporting.

4 years agodataurisrc: Do not include trailing `\0` into buffer
Xavier Claessens [Tue, 24 Sep 2019 14:09:08 +0000 (10:09 -0400)]
dataurisrc: Do not include trailing `\0` into buffer

4 years agoharness: Add gst_harness_pull_until_eos()
Xavier Claessens [Tue, 24 Sep 2019 14:06:51 +0000 (10:06 -0400)]
harness: Add gst_harness_pull_until_eos()

4 years agodocumentation: fix a number of typos
Aaron Boxer [Sun, 6 Oct 2019 15:12:11 +0000 (11:12 -0400)]
documentation: fix a number of typos

4 years agogstdirectcontrolbinding: Fix integer comparison
Jordan Petridis [Fri, 4 Oct 2019 17:01:46 +0000 (20:01 +0300)]
gstdirectcontrolbinding: Fix integer comparison

i is declared as gint but then compared against `n_values` guint
in the for loop below.

5 years agogst: Don't pass miniobjects to GST_DEBUG_OBJECT() and similar macros
Sebastian Dröge [Mon, 30 Sep 2019 08:49:35 +0000 (11:49 +0300)]
gst: Don't pass miniobjects to GST_DEBUG_OBJECT() and similar macros

The argument must be at least a GObject according to the GstLogFunction
definition, and while the default C log function handles miniobjects
just fine this is crashing bindings and user-supplied log functions that
(rightfully) don't expect anything but GObjects.

5 years agogstvalue: use value_nick for serialization
Mathieu Duponchelle [Sat, 7 Sep 2019 02:36:18 +0000 (04:36 +0200)]
gstvalue: use value_nick for serialization

not value_name . This was causing incorrect launch lines to be
displayed by gst-device-monitor, and the deserialization code
below works with nicks.

5 years agodeviceprovider: set the bus to non-flushing before calling klass->start
Mathieu Duponchelle [Mon, 9 Sep 2019 22:28:45 +0000 (00:28 +0200)]
deviceprovider: set the bus to non-flushing before calling klass->start

Not posting DEVICE_ADDED messages while a device provider is being
started makes things awkward for applications, as they have to call
get_devices() after starting the monitor.

This requires redundant code on the application side, and as far as
I understand also could cause race conditions, when a device gets
added between the calls to gst_device_monitor_start() and
gst_device_monitor_get_devices(), causing the application to "see"
the same device twice.

5 years agoelement: Enforce that elements created by gst_element_factory_create/make() are floating
Sebastian Dröge [Thu, 12 Sep 2019 07:09:18 +0000 (10:09 +0300)]
element: Enforce that elements created by gst_element_factory_create/make() are floating

Bindings might have a hard time making sure that the reference is indeed
still floating after returning here.

See https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/444

5 years agodevice: Enforce that elements created by gst_device_create_element() are floating
Sebastian Dröge [Thu, 12 Sep 2019 07:08:39 +0000 (10:08 +0300)]
device: Enforce that elements created by gst_device_create_element() are floating

Bindings might have a hard time making sure that the reference is indeed
still floating after returning here.

See https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/444

5 years agodevice: gst_device_create_element() is `transfer floating`, not `transfer full`
Sebastian Dröge [Thu, 12 Sep 2019 07:03:08 +0000 (10:03 +0300)]
device: gst_device_create_element() is `transfer floating`, not `transfer full`

Fixing the annotation fixes leaking of the created element in all
bindings using GObject-Introspection.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/444

5 years agobase: GstBaseSrc/GstBaseSink::get_caps: add (nullable) to `filter`
Sebastiano Barrera [Tue, 10 Sep 2019 10:31:40 +0000 (12:31 +0200)]
base: GstBaseSrc/GstBaseSink::get_caps: add (nullable) to `filter`

The virtual method named `get_caps` in both `GstBaseSrc` and
`GstBaseSink` has a `filter` parameter which can be `NULL` (the
default implementation in GstBaseSrc already considers the case).
Before this commit, there was no gtk-doc annotation representing this
fact, which caused the corresponding entry in the GIR file to also
miss this fact.

This caused bugs in other places, such inducing the Vala compiler to
introduce a wrongly assert on `(filter != NULL)` in every
implementation of the `get_caps` method implemented in Vala.

5 years agoDon't pass default GLib marshallers for signals
Niels De Graef [Mon, 26 Aug 2019 05:34:30 +0000 (07:34 +0200)]
Don't pass default GLib marshallers for signals

By passing NULL to `g_signal_new` instead of a marshaller, GLib will
actually internally optimize the signal (if the marshaller is available
in GLib itself) by also setting the valist marshaller. This makes the
signal emission a bit more performant than the regular marshalling,
which still needs to box into `GValue` and call libffi in case of a
generic marshaller.

Note that for custom marshallers, one would use
`g_signal_set_va_marshaller()` with the valist marshaller instead.

5 years agoconsolidated IOV_MAX/UIO_MAXIOV handling per GLib + legacy behaviour for osx/ios
Jim Mason [Sat, 7 Sep 2019 11:32:40 +0000 (12:32 +0100)]
consolidated IOV_MAX/UIO_MAXIOV handling per GLib + legacy behaviour for osx/ios

5 years agogst_writev: respect IOV_MAX for the writev iovec array #439
Jim Mason [Fri, 6 Sep 2019 18:23:01 +0000 (19:23 +0100)]
gst_writev: respect IOV_MAX for the writev iovec array #439

5 years agopad: Added gst_pad_get_single_internal_link
Vivia Nikolaidou [Wed, 4 Sep 2019 13:59:58 +0000 (16:59 +0300)]
pad: Added gst_pad_get_single_internal_link

gst_pad_iterate_internal_links is usually used to find a single internal
link that a pad has, e.g. to find the corresponding pad of a multiqueue.
Added a helper function that will return either a single internal link,
if there's no other, or NULL.

5 years agominiobject: free qdata array when the last qdata is removed
David Svensson Fors [Tue, 3 Sep 2019 08:38:13 +0000 (10:38 +0200)]
miniobject: free qdata array when the last qdata is removed

In cases with many long-lived buffers that have qdata only very
briefly, the memory overhead of keeping an array of 16 GstQData
structs for each buffer can be significant. We free the array when
the last qdata is removed, like it was done in 1.14.

Fixes #436

5 years agobin: Fix minor race when adding to a bin
Nicolas Dufresne [Tue, 3 Sep 2019 17:44:24 +0000 (13:44 -0400)]
bin: Fix minor race when adding to a bin

This patch simply add a null check around a case where a child may have
been unparented concurrently to the deep_add_remove operation. This was
found by accident in the form of an "IS_GST_OBJECT" assertion, but had
no other known side effect in that test.

5 years agolibcheck: fix macos werror build
Matthew Waters [Fri, 30 Aug 2019 02:04:40 +0000 (12:04 +1000)]
libcheck: fix macos werror build

../libs/gst/check/libcheck/check.c:617:15: error: result of comparison of constant 4294967295 with expression of type 'clockid_t' is always false [-Werror,-Wtautological-constant-out-of-range-compare]
  if (clockid == -1) {
      ~~~~~~~ ^  ~~

5 years agofile/fdsrc: use struct stat64 on android to match stat64()
Matthew Waters [Wed, 28 Aug 2019 05:19:54 +0000 (15:19 +1000)]
file/fdsrc: use struct stat64 on android to match stat64()

Fixes android werror failures:

../plugins/elements/gstfdsrc.c:244:25: error: incompatible pointer types passing 'struct stat *' to parameter of type 'struct stat64 *' [-Werror,-Wincompatible-pointer-types]
    if (fstat (src->fd, &stat_results) < 0)
                        ^~~~~~~~~~~~~
/home/matt/Projects/cerbero/build/android-ndk-18/sysroot/usr/include/sys/stat.h:159:38: note: passing argument to parameter '__buf' here
int fstat64(int __fd, struct stat64* __buf) __RENAME_STAT64(fstat, 3, 21);
                                     ^
../plugins/elements/gstfdsrc.c:560:23: error: incompatible pointer types passing 'struct stat *' to parameter of type 'struct stat64 *' [-Werror,-Wincompatible-pointer-types]
  if (fstat (src->fd, &stat_results) < 0)
                      ^~~~~~~~~~~~~
/home/matt/Projects/cerbero/build/android-ndk-18/sysroot/usr/include/sys/stat.h:159:38: note: passing argument to parameter '__buf' here
int fstat64(int __fd, struct stat64* __buf) __RENAME_STAT64(fstat, 3, 21);
                                     ^

  if (fstat (fd, &stat_results) < 0)
                 ^~~~~~~~~~~~~
/home/matt/Projects/cerbero/build/android-ndk-18/sysroot/usr/include/sys/stat.h:159:38: note: passing argument to parameter '__buf' here
int fstat64(int __fd, struct stat64* __buf) __RENAME_STAT64(fstat, 3, 21);
                                     ^

  if (fstat (src->fd, &stat_results) < 0)
                      ^~~~~~~~~~~~~
../../../../../android-ndk-18/sysroot/usr/include/sys/stat.h:159:38: note: passing argument to parameter '__buf' here
int fstat64(int __fd, struct stat64* __buf) __RENAME_STAT64(fstat, 3, 21);
                                     ^
../plugins/elements/gstfilesrc.c:477:23: error: incompatible pointer types passing 'struct stat *' to parameter of type 'struct stat64 *' [-Werror,-Wincompatible-pointer-types]
  if (fstat (src->fd, &stat_results) < 0)
                      ^~~~~~~~~~~~~
../../../../../android-ndk-18/sysroot/usr/include/sys/stat.h:159:38: note: passing argument to parameter '__buf' here
int fstat64(int __fd, struct stat64* __buf) __RENAME_STAT64(fstat, 3, 21);
                                     ^

5 years agocheck: fix werror build with clang
Matthew Waters [Mon, 26 Aug 2019 12:36:25 +0000 (22:36 +1000)]
check: fix werror build with clang

Silence -Wformat-nonliteral warnings from the internal copy of libcheck

../subprojects/gstreamer/libs/gst/check/libcheck/check.c:379:29: warning: format string is not a string literal [-Wformat-nonliteral]
    vsnprintf (buf, BUFSIZ, msg, ap);
                            ^~~
../subprojects/gstreamer/libs/gst/check/libcheck/check_error.c:48:21: warning: format string is not a string literal [-Wformat-nonliteral]
  vfprintf (stderr, fmt, args);
                    ^~~
../subprojects/gstreamer/libs/gst/check/libcheck/check_str.c:92:29: warning: format string is not a string literal [-Wformat-nonliteral]
    n = vsnprintf (p, size, fmt, ap);
                            ^~~

5 years agoobject: Use g_object_notify_by_pspec()
Niels De Graef [Sun, 25 Aug 2019 17:37:30 +0000 (19:37 +0200)]
object: Use g_object_notify_by_pspec()

`g_object_notify()` actually takes a global lock to look up the
`GParamSpec` that corresponds to the given property name. It's not a
huge performance hit, but it's easily avoidable by using the
`_by_pspec()` variant.

5 years agogst-launch: Use gst_print* instead of g_print* to fix broken stdout on Windows
Seungha Yang [Mon, 19 Aug 2019 16:02:48 +0000 (01:02 +0900)]
gst-launch: Use gst_print* instead of g_print* to fix broken stdout on Windows

Concurrent Windows' colored debug message and g_print will print
string hard to read. Instead, use gst_print* which serialize
debug output and the APIs call.

5 years agoinfo: Take lock around all prinf on Windows
Seungha Yang [Mon, 19 Aug 2019 15:59:15 +0000 (00:59 +0900)]
info: Take lock around all prinf on Windows

On Windows, concurrent colored gstreamr debug output and usual
stdout/stderr string will cause broken output on terminal.
Since it's OS specific behavior, that's hard to completely avoid it
but we can protect it at least among our printing interfaces side.

5 years agodocstrings: port ulinks to markdown links
Mathieu Duponchelle [Fri, 23 Aug 2019 16:17:41 +0000 (18:17 +0200)]
docstrings: port ulinks to markdown links

5 years agoutils: Avoid memory merge in gst_util_dump_buffer()
Johan Sternerup [Tue, 20 Aug 2019 15:18:31 +0000 (17:18 +0200)]
utils: Avoid memory merge in gst_util_dump_buffer()

For buffers with multiple memory chunks, gst_buffer_map() has the side
effect of merging the memory chunks into one contiguous
chunk. Since gst_util_dump_mem() used gst_buffer_map() the internals
of the buffer could actually change as a result of printing it.

For the case of a buffer containing several memory chunks,
gst_memory_map() is now used to obtain the memory address and each
memory chunk is dumped separately preceded by a header line. The
behaviour for a buffer containing a single memory chunk is left unchanged.

5 years agoaggregator: Always handle serialized events/queries directly before waiting
Sebastian Dröge [Mon, 19 Aug 2019 15:19:50 +0000 (18:19 +0300)]
aggregator: Always handle serialized events/queries directly before waiting

Otherwise it can happen that we start waiting for another pad, while one
pad already has events that can be handled and potentially also a buffer
that can be handled. That buffer would then however not be accessible by
the subclass from GstAggregator::get_next_time() as there would be the
events in front of it, which doesn't allow the subclass then to
calculate the next time based on already available buffers.

As a side-effect this also allows removing the duplicated event handling
code in the aggregate function as we'll always report pads as not ready
when there is a serialized event or query at the top of at least one
pad's queue.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/428

5 years agomeson: fix warning about configure_file() install kwarg
Tim-Philipp Müller [Thu, 15 Aug 2019 11:56:06 +0000 (12:56 +0100)]
meson: fix warning about configure_file() install kwarg

The install kwarg on configure_file() was only added in
Meson 0.50 but we're targetting older versions as well,
which caused a warning. The install kwarg is not needed
here as we specify install_dir, so we can just drop it.

Fixes #379

5 years agoaggregator: Add sink_event_pre_queue() and sink_query_pre_queue() vfuncs
Sebastian Dröge [Wed, 14 Aug 2019 11:25:48 +0000 (14:25 +0300)]
aggregator: Add sink_event_pre_queue() and sink_query_pre_queue() vfuncs

These allow subclasses catching serialized events/queries before they're
queued up.

5 years agoaggregator: Add GstAggregator::negotiate()
Sebastian Dröge [Wed, 14 Aug 2019 07:05:53 +0000 (10:05 +0300)]
aggregator: Add GstAggregator::negotiate()

For consistency with other base classes and for allowing to completely
override the negotiation behaviour.

5 years agoaggregator: Actually handle NEED_DATA return from update_src_caps()
Sebastian Dröge [Wed, 14 Aug 2019 06:51:55 +0000 (09:51 +0300)]
aggregator: Actually handle NEED_DATA return from update_src_caps()

The documentation says that this allows the subclass to signal that it
needs more data before it can decide on caps, so let's actually
implement it that way.

5 years agoaggregator: Assert if the sink/src pad type that is to be used is not a GstAggregator...
Sebastian Dröge [Tue, 13 Aug 2019 16:57:08 +0000 (19:57 +0300)]
aggregator: Assert if the sink/src pad type that is to be used is not a GstAggregatorPad or subclass thereof

5 years agoaggregator: Ensure that the source pad is created as a GstAggregatorPad if no type...
Sebastian Dröge [Tue, 13 Aug 2019 16:55:59 +0000 (19:55 +0300)]
aggregator: Ensure that the source pad is created as a GstAggregatorPad if no type is given in the pad template

Otherwise we would create a GstPad and that causes invalid memory
accesses later.

5 years agolatency: fix custom event leaks
Guillaume Desmottes [Tue, 6 Aug 2019 04:39:22 +0000 (10:09 +0530)]
latency: fix custom event leaks

If the element before the sink needs $n buffers to produce one output
buffer, we were reffing $n events and unreffing only one.
Prevent this by using g_object_set_qdata_full() to handle the event
unreffing so we're sure no ref will be lost.

5 years agoelement: Added gst_element_get_current_clock_time and gst_element_get_current_running...
Jan Alexander Steffens (heftig) [Mon, 12 Aug 2019 08:53:33 +0000 (11:53 +0300)]
element: Added gst_element_get_current_clock_time and gst_element_get_current_running_time

Helper functions for getting the element clock's time, and the clock
time minus base time, respectively.

5 years agoregistry: Use plugin directory from the build system for relocateable Windows builds
Sebastian Dröge [Thu, 8 Aug 2019 10:49:07 +0000 (13:49 +0300)]
registry: Use plugin directory from the build system for relocateable Windows builds

Instead of guessing something based on preprocessor defines and magic.

5 years agodevice-monitor: list hidden providers before listing devices
Thibault Saunier [Tue, 30 Apr 2019 21:24:50 +0000 (17:24 -0400)]
device-monitor: list hidden providers before listing devices

The way it was implemented could make the list updated after the
list of device was filled with supposdely hidden devices

5 years agofunnel: fix documentation
Mathieu Duponchelle [Tue, 6 Aug 2019 13:28:58 +0000 (15:28 +0200)]
funnel: fix documentation

funnel no longer sends its own segment since:

bbb26f875692a6cd84050c545ba85a7d2129cf5d

Update the documentation to reflect that

5 years agomessage: fix up enum value for GST_MESSAGE_DEVICE_CHANGED
Tim-Philipp Müller [Mon, 5 Aug 2019 23:05:22 +0000 (00:05 +0100)]
message: fix up enum value for GST_MESSAGE_DEVICE_CHANGED

This was added in 1.16 and accidentally duplicated the value of
the existing GST_MESSAGE_REDIRECT.

As the only known user of this message is GStreamer core itself,
and it is quite an obscure message, it seems best to just fix up
the enum value even if that technically breaks API.

Fixes #418

5 years agoRemoves unnecessary "Sissy" pejorative from configure.ac warning message.
Keri Henare [Tue, 6 Aug 2019 03:16:35 +0000 (03:16 +0000)]
Removes unnecessary "Sissy" pejorative from configure.ac warning message.

5 years agoinfo: Fix deadlock in gst_ring_buffer_logger_log
Doug Nazar [Wed, 31 Jul 2019 01:40:47 +0000 (21:40 -0400)]
info: Fix deadlock in gst_ring_buffer_logger_log

gst_ring_buffer_logger_log calls several functions while formatting
the message which may in turn log a message while we already hold
the mutex. Do all formatting first before acquiring the mutex to
avoid this and reduce the time we hold the mutex.

5 years agotracers: set MAY_BE_LEAKED on tracer records
Guillaume Desmottes [Fri, 2 Aug 2019 07:37:58 +0000 (13:07 +0530)]
tracers: set MAY_BE_LEAKED on tracer records

The records are static and so appear as false positives when using those
tracers with the leaks tracer as well.
The leaks tracer was already setting this flag on its record so let's
set it on the other ones as well.

5 years agodownloadbuffer: Check for flush after seek
Alicia Boya García [Mon, 22 Jul 2019 15:06:20 +0000 (15:06 +0000)]
downloadbuffer: Check for flush after seek

In gst_download_buffer_wait_for_data(), when a seek is made with
perform_seek_to_offset() the `qlock` is released temporarily. Therefore,
the flushing condition can be set during this period and should be
checked.

This was not being checked before, causing occasional deadlocks when
GST_DOWNLOAD_BUFFER_WAIT_ADD_CHECK() was called.

GST_DOWNLOAD_BUFFER_WAIT_ADD_CHECK() assumes that the caller has already
checked that we're not flushing before, since this is done when
acquiring the lock; so if we release it temporarily somewhere, we need
to check for flush again.

Without that check, the function would keep waiting for the condition
variable to be notified before checking for flushing condition again,
and that may very well never happen. This was reproduced when during pad
deactivation when running WebKit in gdb.

5 years agoidentity: Non-live upstream have no max latency
Nicolas Dufresne [Sat, 20 Jul 2019 01:57:09 +0000 (21:57 -0400)]
identity: Non-live upstream have no max latency

sync=TRUE implementation changes the latency query of a non-live
upstream into live, though it wrongly set the upstream max latency to 0.
As non-live sources won't loose data if we wait longer, this should have
been reported as have no max latency limite (-1).

5 years agoaggregator: drop duplicated SEEK events
Mathieu Duponchelle [Fri, 19 Jul 2019 15:28:25 +0000 (17:28 +0200)]
aggregator: drop duplicated SEEK events

This is similar to what demuxers do, and necessary when multiple
sinks get seeked downstream of the aggregator: if we forward
duplicated seeks upstream, elements such as demuxers may drop
the flushing seeks, but return TRUE, aggregator then waits forever
for the flushing events.

Fixes #276

5 years agobasesrc: fix g-i warnings
Tim-Philipp Müller [Fri, 19 Jul 2019 10:09:22 +0000 (11:09 +0100)]
basesrc: fix g-i warnings

5 years agoinfo: Free some more memory on gst_deinit()
Sebastian Dröge [Sun, 14 Jul 2019 19:41:56 +0000 (22:41 +0300)]
info: Free some more memory on gst_deinit()