Commit graph

18722 commits

Author SHA1 Message Date
Mathieu Duponchelle
8140da74ba 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>
2019-12-20 16:46:39 +00:00
Thibault Saunier
767e0e46e9 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>
2019-12-20 15:51:45 +00:00
Niels De Graef
0cb3940c94 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"`).
2019-12-20 14:29:19 +01:00
Stéphane Cerveau
1d549ea324 gstreamer: use of g_value_dup_string
Use helper method to get string from GValue.
2019-12-18 15:57:54 +01:00
Mathieu Duponchelle
25d7914395 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>
2019-12-14 11:25:20 +00:00
Peter Seiderer
4a827e11b4 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>
2019-12-12 20:49:36 +01:00
Peter Seiderer
96aa27910a 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>
2019-12-12 20:49:36 +01:00
Peter Seiderer
afa802e4aa 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>
2019-12-12 20:49:36 +01:00
Olivier Crête
0a8d14acc9 Remove deprecated GTimeVal
GTimeVal won't work past 2038
2019-12-10 19:18:32 -05:00
Mathieu Duponchelle
e79def14a5 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()
2019-12-10 13:31:50 +01:00
Mathieu Duponchelle
9861ad2e12 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.
2019-12-10 09:42:37 +01:00
Mathieu Duponchelle
4af103d124 aggregator: fix logging in new update_segment API 2019-12-06 11:40:44 +01:00
Mathieu Duponchelle
88999d3b0e aggregator: add method to update srcpad segment 2019-12-05 13:44:33 +01:00
Sebastian Dröge
020eb2c346 bus: Clean up #ifdefs to compile with debugging enabled in all combinations
Thanks to Roland Jon for finding this.
2019-12-05 08:21:54 +00:00
Mathieu Duponchelle
a90220cce1 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
2019-12-05 01:44:35 +00:00
Tulio Beloqui
f05ba0aea7 testclock: added single clock id process function
Co-authored-by: Havard Graff <hgr@pexip.com>
2019-12-04 16:02:59 +00:00
Sebastian Dröge
7af50da2c9 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.
2019-12-04 08:24:04 +00:00
Xavier Claessens
4a554a2a68 Meson: Add 'coretracers' feature option
This was the only plugin still built when using
-Dauto_features=disabled, besides coreelements.
2019-12-03 19:01:38 -05:00
Håvard Graff
a9162fc2ed 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.
2019-12-03 11:23:01 +00:00
Vivia Nikolaidou
1375c53f04 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
2019-11-28 13:12:50 +02:00
Edward Hervey
f590a861be tracers: Don't leak temporary GstStructure
CID: 1455462
2019-11-28 08:03:51 +00:00
Edward Hervey
3b71c4a4e7 GstBuffer: size-related optimization
Avoid calling generic function when it's possible to directly
return/get sizes
2019-11-27 14:25:19 +00:00
Edward Hervey
e3d2eb1f16 GstBuffer: Inline fast-path for merged memory 2019-11-27 14:25:19 +00:00
Tim-Philipp Müller
6c2dfe5ebe docs: mention gst_parse_bin_from_description() in gst_parse_launch() docs 2019-11-27 09:41:36 +00:00
Linus Svensson
47c50b086e datetime: Add constructor for timestamps in microseconds 2019-11-25 13:31:11 +01:00
Vivia Nikolaidou
fa8312472f 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.
2019-11-18 14:09:22 +02:00
Stéphane Cerveau
8a20d66b10 gstbuffer: update documentation
remove unclear documentation about GST_BUFFER_FLAG_MARKER
2019-11-18 00:15:31 +00:00
Seungha Yang
c05cb9504d 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.
2019-11-14 12:15:20 +00:00
Havard Graff
7b38def8e0 structure: add gst_structure_take
(╯°□°)╯︵ ┻━┻
2019-11-14 10:08:38 +00:00
Tulio Beloqui
a11f53e131 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>
2019-11-13 20:33:51 +00:00
Thibault Saunier
06e54399ba hotdoc: Add missing json escaping
Fixes https://gitlab.freedesktop.org/gstreamer/gst-docs/issues/50
2019-11-13 11:37:22 +00:00
Wonchul Lee
5c6314d68b 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'
2019-11-12 15:19:28 +09:00
Víctor Manuel Jáquez Leal
78041a7748 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.
2019-11-05 12:55:08 +01:00
Nayana Topolsky
e8c782d119 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
2019-11-04 12:01:47 +00:00
Seungha Yang
d8b8a13285 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.
2019-11-03 19:06:58 +00:00
Seungha Yang
0505bd76a1 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.
2019-11-03 09:12:26 +00:00
Seungha Yang
15423723fe 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.
2019-11-03 09:12:26 +00:00
Seungha Yang
966d013bf0 gst-launch: Remove meaningless global variable 2019-11-03 09:12:26 +00:00
Jan Schmidt
acf66273f5 pipeline: Instant rate change handling
Implement aggregation of INSTANT_RATE_REQUEST messages and sending of
INSTANT_RATE_SYNC_TIME events.
2019-11-03 19:47:40 +11:00
Sebastian Dröge
f72c89b159 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.
2019-11-03 19:47:40 +11:00
Sebastian Dröge
74412496cf event/message: Add new instant-rate-sync-time event and instant-rate-request message 2019-11-03 19:47:40 +11:00
Sebastian Dröge
be3c4d00cf 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.
2019-11-03 19:47:40 +11:00
Víctor Manuel Jáquez Leal
9707db909d elementfactory: add GST_ELEMENT_FACTORY_TYPE_HARDWARE
This new symbol matches with the elements within "Hardware" class.
2019-11-02 15:11:12 +01:00
Niels De Graef
0ca0a9d982 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.
2019-10-31 11:06:48 +01:00
Sebastian Dröge
d25a88e3a1 tee: First deactivate the pad and then remove it when releasing pads
This reverts a96002bb28, 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.
2019-10-24 22:49:41 +00:00
Sebastian Dröge
7f7da6a0d0 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 a3c4a3201a and
resulted in a different (and wrong) workaround in
a96002bb28.
2019-10-24 22:49:41 +00:00
Sebastian Dröge
aa29864317 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.
2019-10-24 22:49:41 +00:00
Sebastian Dröge
487a3f9a30 bin: Drop need-context messages without source instead of crashing 2019-10-22 09:46:19 +03:00
Tim-Philipp Müller
35db4a2433 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.
2019-10-17 19:54:21 +01:00
Tim-Philipp Müller
10d9e18f02 Remove autotools build system 2019-10-13 16:10:42 +01:00