Commit graph

3324 commits

Author SHA1 Message Date
Matthew Waters
fdf6a793dc gst: don't use volatile to mean atomic
volatile is not sufficient to provide atomic guarantees and real atomics
should be used instead.  GCC 11 has started warning about using volatile
with atomic operations.

https://gitlab.gnome.org/GNOME/glib/-/merge_requests/1719

Discovered in https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/issues/868

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/793>
2021-04-13 01:58:54 +01:00
Sebastian Dröge
934e6bb114 aggregator: Release pads' peeked buffer when removing the pad or finalizing it
The peeked buffer was always reset after calling ::aggregate() but under
no other circumstances. If a pad was removed after peeking and before
::aggregate() returned then the peeked buffer would be leaked.

This can easily happen if pads are removed from the aggregator from a
pad probe downstream of the source pad but still in the source pad's
streaming thread.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/785>
2021-04-06 20:02:43 +01:00
Marijn Suijten
8922fc6436 gst,base: Take GstAllocationParams parameter by const ptr
This parameter is only informational and should not be modified. Enforce
this at compile-time and to get the right signature in G-IR.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/740>
2021-01-28 17:55:50 +00:00
Jakub Adam
16178d46c8 harness: don't use GST_DEBUG_OBJECT with GstHarness
GstHarness is not a GObject. Fixes assert on recently added check in
gst_debug_log_valist() if GST_ENABLE_EXTRA_CHECKS is enabled.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/721>
2020-12-11 16:03:10 +00:00
Marijn Suijten
865cfb8ea2 check: gst_test_clock_process_next_clock_id returns nullable
It is possible there are no more pending clocks in the chain, in which
case this function returns null.

See also tests like test_single_shot_async_future that validate NULL
returns.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/716>
2020-12-04 16:13:26 +00:00
Sebastian Dröge
2334f5451f Add some missing nullable annotations
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/699>
2020-11-05 15:48:50 +00:00
Jan Schmidt
34b4a03f01 harness: Handle element not being set cleanly.
If a harness is created with gst_harness_new_empty(), there
might not be an internal element to unref on cleanup.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/687>
2020-10-30 15:01:25 +00:00
Nicolas Dufresne
c983df161c aggregator: Include min-upstream-latency in buffering time
While we can fixe the upstream latency using the min-upstream-latency, we
are now forced to use queues (hence more thread) in order to store the pending
data whenever we have an upstream source that has lower latency.

This fixes the issue by allowing to buffer the fixed upstream latency. This is
particularly handy on single core systems were having too many threads can
cause serious performance issues.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/684>
2020-10-29 17:53:53 +00:00
Mathieu Duponchelle
6ae7d4ec91 aggregator: make peek() has() pop() drop() buffer API threadsafe
Enforce that the last buffer that was peeked (or had its existence
checked) on a pad is the one that gets popped / dropped, resetting
at the end of each aggregation cycle.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/603

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/675>
2020-10-14 14:06:54 +01:00
Jan Alexander Steffens (heftig)
33f2263a0b basetransform: Fix in/outbuf confusion of _default_transform_meta
The default implementation doesn't actually use its buffer parameters,
but this error might have been the cause of some actual confusion in
the plugins code.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/666>
2020-10-10 11:44:59 +01:00
Sebastian Dröge
b2b1610907 aggregator: Hold SRC_LOCK while unblocking via SRC_BROADCAST()
Otherwise the clock id we access might not be a valid pointer anymore.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/656>
2020-10-02 23:57:48 +00:00
Tom Schoonjans
30151e6f40 ptp_helper_post_install.sh: deal with none
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/655>
2020-10-03 00:00:06 +01:00
Sebastian Dröge
56d696200a aggregator: Wake up source pad in PAUSED<->PLAYING transitions
When going to PLAYING we will now have a clock and can stop waiting on
the condition variable and instead start waiting on the clock if
necessary for the current configuration.

In the other direction when going to PAUSED the clock might have
disappeared and we might need to wait on the condition variable again
instead.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/653>
2020-10-01 01:12:04 +01:00
Sebastian Dröge
4b0bac94ec ptp: Also handle gnu/kfreebsd
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/651>
2020-09-30 10:33:35 +01:00
Sebastian Dröge
dccae68eaf aggregator: Document that samples_selected() must only be called from the aggregate() function
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/607>
2020-08-25 15:50:25 +03:00
Sebastian Dröge
070f663ae1 aggregator: Don't automatically adjust segment if subclass provided one
On the first buffer the base class would update the segment position
based on the start-time-selection. If the subclass provides its own
segment this will caused unexpected behaviour and override segment
information that was explicitly set by the subclass.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/600>
2020-08-24 18:19:21 +00:00
Mathieu Duponchelle
f0da248d37 aggregator: fix documentation for samples-selected and buffer-consumed
GI expects the instance parameter to be documented, omitting it
leads to a msismatched output in the gir.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/592>
2020-08-10 22:42:54 +02:00
Sebastian Dröge
84385bdd86 aggregator: Add optional GstStructure info parameter to "samples-selected" signal
Subclasses can use this to provide more information, for example
audioaggregator could provide the offset into the output buffer where
the next data is going to be filled.

See https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/issues/805

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/590>
2020-08-07 19:15:34 +03:00
Mathieu Duponchelle
e243e152f0 aggregator: add segment, pts, dts and duration to samples-selected
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/588>
2020-08-05 19:05:34 +02:00
Mathieu Duponchelle
ed90b5dc55 aggregator: fix iteration direction in skip_buffers
Subclasses use the pad segment to determine whether a buffer
should be skipped, we thus don't want to check if a buffer
needs to be skipped before processing the segment it's part
of.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/585>
2020-08-04 11:16:21 +02:00
Mathieu Duponchelle
d74efc1aed aggregator: expose sample selection API
See https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/issues/771
for context.

This exposes new API that subclasses must call from their
aggregate() implementation to signal that they have selected
the next samples they will aggregate: gst_aggregator_selected_samples()

GstAggregator will emit a new signal there, `samples-selected`,
handlers can then look up samples per pad with the newly-added
gst_aggregator_peek_next_sample.

In addition, a new FIXME is logged when subclasses haven't actually
called `selected_samples` from their aggregate() implementation.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/549>
2020-07-31 09:59:08 +03:00
Camilo Celis Guzman
edcbc7cc98 basetransform: handle invalid subclass implementation for fixate_caps
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/575>
2020-07-28 14:14:38 +00:00
Olivier Crête
18f27b1044 baseparse: Don't push pointless new segment events
In 1.0, there is no concept of segment update, so don't push new
identical segments.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/578>
2020-07-28 07:48:31 +00:00
Thibault Saunier
bc641acb9f baseparse: Fix seqnum handling in pull mode
After a seek in pull mode, we should use the seek seqnum for all
following operations, not some random seqnums

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/577>
2020-07-28 07:18:24 +00:00
Tim-Philipp Müller
58558bb90c check: suppress g-ir-scanner warnings
Make g-ir-scanner skip all those check macros that are
not useful for or usable from bindings.

gstcheck.h:209: Warning: GstCheck: Unknown namespace for symbol 'fail_unless_message_error'
gstcheck.h:212: Warning: GstCheck: Unknown namespace for symbol 'assert_message_error'
gstcheck.h:251: Warning: GstCheck: Unknown namespace for symbol 'fail_unless_equals_int'
gstcheck.h:267: Warning: GstCheck: Unknown namespace for symbol 'assert_equals_int'
gstcheck.h:280: Warning: GstCheck: Unknown namespace for symbol 'fail_unless_equals_int_hex'
gstcheck.h:299: Warning: GstCheck: Unknown namespace for symbol 'assert_equals_int_hex'
gstcheck.h:310: Warning: GstCheck: Unknown namespace for symbol 'fail_unless_equals_int64'
gstcheck.h:327: Warning: GstCheck: Unknown namespace for symbol 'assert_equals_int64'
gstcheck.h:340: Warning: GstCheck: Unknown namespace for symbol 'fail_unless_equals_int64_hex'
gstcheck.h:358: Warning: GstCheck: Unknown namespace for symbol 'assert_equals_int64_hex'
gstcheck.h:369: Warning: GstCheck: Unknown namespace for symbol 'fail_unless_equals_uint64'
gstcheck.h:386: Warning: GstCheck: Unknown namespace for symbol 'assert_equals_uint64'
gstcheck.h:399: Warning: GstCheck: Unknown namespace for symbol 'fail_unless_equals_uint64_hex'
gstcheck.h:417: Warning: GstCheck: Unknown namespace for symbol 'assert_equals_uint64_hex'
gstcheck.h:428: Warning: GstCheck: Unknown namespace for symbol 'fail_unless_equals_string'
gstcheck.h:444: Warning: GstCheck: Unknown namespace for symbol 'assert_equals_string'
gstcheck.h:455: Warning: GstCheck: Unknown namespace for symbol 'fail_unless_equals_float'
gstcheck.h:474: Warning: GstCheck: Unknown namespace for symbol 'assert_equals_float'
gstcheck.h:487: Warning: GstCheck: Unknown namespace for symbol 'fail_unless_equals_pointer'
gstcheck.h:506: Warning: GstCheck: Unknown namespace for symbol 'assert_equals_pointer'
gstcheck.h:517: Warning: GstCheck: Unknown namespace for symbol 'fail_unless_equals_clocktime'
gstcheck.h:534: Warning: GstCheck: Unknown namespace for symbol 'MAIN_START_THREADS'
gstcheck.h:547: Warning: GstCheck: Unknown namespace for symbol 'MAIN_START_THREAD_FUNCTIONS'
gstcheck.h:555: Warning: GstCheck: Unknown namespace for symbol 'MAIN_START_THREAD_FUNCTION'
gstcheck.h:626: Warning: GstCheck: Unknown namespace for symbol 'ASSERT_CRITICAL'
gstcheck.h:628: Warning: GstCheck: Unknown namespace for symbol 'ASSERT_CRITICAL'
gstcheck.h:640: Warning: GstCheck: Unknown namespace for symbol 'ASSERT_WARNING'
gstcheck.h:652: Warning: GstCheck: Unknown namespace for symbol 'ASSERT_OBJECT_REFCOUNT'
gstcheck.h:661: Warning: GstCheck: Unknown namespace for symbol 'ASSERT_OBJECT_REFCOUNT_BETWEEN'
gstcheck.h:676: Warning: GstCheck: Unknown namespace for symbol 'ASSERT_CAPS_REFCOUNT'
gstcheck.h:679: Warning: GstCheck: Unknown namespace for symbol 'ASSERT_BUFFER_REFCOUNT'
gstcheck.h:682: Warning: GstCheck: Unknown namespace for symbol 'ASSERT_MINI_OBJECT_REFCOUNT'
gstcheck.h:690: Warning: GstCheck: Unknown namespace for symbol 'ASSERT_SET_STATE'
gstcheck.h:729: Warning: GstCheck: Unknown namespace for symbol 'tcase_skip_broken_test'
gstcheck.h:740: Warning: GstCheck: Unknown namespace for symbol 'tcase_skip_broken_loop_test'

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/579>
2020-07-26 15:34:54 +01:00
Matthew Waters
39aa702659 harness: unref sink/src caps after deactivating pads
Otherwise, access to the harness' sink/src caps is racy between any caps
query performed by an element and gst_harness_teardown().

Fixes: https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/issues/794
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/574>
2020-07-23 14:54:09 +10:00
Jan Alexander Steffens (heftig)
cd6bc944f9 check: Always mark _ck_assert_failed as noreturn
So that we can use `fail` like `g_assert_not_reached`.

The comment is apparently wrong or outdated, as GCC considers it legal
for noreturn-marked functions to return using longjmp.

See the thread at
https://gitlab.freedesktop.org/gstreamer/gst-plugins-ugly/-/merge_requests/59#note_576422

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/573>
2020-07-22 13:45:54 +00:00
Thibault Saunier
aaa95cfef7 directcontrolbinding: Properly initialize default last_value
It was zero and in some condition it means that the control binding
values where ignored (as shown in the test). Setting it to MAXDOUBLE
so that the first time we sync the values from a a timestamp in the
right range the proper value is computed.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/564>
2020-07-18 20:47:29 +00:00
Mathieu Duponchelle
bb22b7d79c aggregator: expose gst_aggregator_finish_buffer_list API
See https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/issues/1276

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/562>
2020-07-10 18:11:55 +02:00
Seungha Yang
e2dc90273e basesrc: Deprecate gst_base_src_new_seamless_segment()
It can be replaced by gst_base_src_new_segment()

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/490>
2020-07-10 16:53:40 +09:00
Seungha Yang
a78a9cf0c3 basesrc: Add new API for handling GstSegment update by subclass
Add API gst_base_src_new_segment() for subclass to be able to
signalling new GstSegment which should be applied to following
buffers.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/490>
2020-07-09 13:50:25 +00:00
Seungha Yang
4b6245597c check: Use g_thread_yield instead of g_usleep(1)
Since the commit
01c02ac08b,
g_usleep(1) will be translated to Sleep(1) on Windows which means
sleep in 1 millisecond. But GLib provides g_thread_yield() API
which is exactly what we required here for thread context switching.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/559>
2020-07-08 05:16:28 +09:00
Sebastian Dröge
eea1ac156c ptp: Add GNU Hurd to the list of supported platforms and fix the Solaris name
https://mesonbuild.com/Reference-tables.html#operating-system-names has
the table of all supported names right now.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/583

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/554>
2020-07-03 11:45:36 +03:00
Sebastian Dröge
f88b59f49a Fix up and add various "Since" markers and other related docs fixes
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/536>
2020-06-19 13:10:53 +01:00
Sebastian Dröge
44d73efc49 aggregator: Fix StartTimeSelection enum type registration
Make it thread-safe and use the actual C identifiers for the "name"
field, as otherwise gobject-introspection will fall apart.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/527>
2020-06-10 11:23:42 +03:00
Sebastian Dröge
ea32d1741c aggregator: Export GstAggregatorStartTimeSelection in the header and document it
It is used by one of the aggregator properties and was private in the
source file before.
2020-06-04 15:49:24 -04:00
Thibault Saunier
1c97dac2b1 gdb: Print event seqnums, object pointers and structures
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/482>
2020-05-15 06:33:22 +00:00
Thibault Saunier
ab4821630a gdb: Add support for queries and buffers
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/482>
2020-05-15 06:33:22 +00:00
Edward Hervey
8076051a19 basetransform: Minor refactoring
Move checks related to peerfilter in one place. No impact except for logic.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/484>
2020-05-14 12:19:58 +02:00
Thibault Saunier
7a7cd9de6c gdb: Fix iterating GstStructure fields
This broke with 1b568fa01f where we inlined the array

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/479>
2020-05-12 16:42:42 -04:00
Thibault Saunier
39b9cc554c basesink: Fix clock synchronization running time in reverse playback
In reverse playback, buffers have to be displayed at buffer.stop running
time, otherwise a same set of buffer can't be displayed in the exact opposite
order to forward playback.

For example, seeking a video stream at 1fps with start=0, stop=5s, rate=1.0

will display the following buffers:

  b0.pts = 0s, b0.duration = 1s - at running time = 0s
  b1.pts = 1s, b1.duration = 1s - at running time = 1s
  b2.pts = 2s, b2.duration = 1s - at running time = 2s
  b3.pts = 3s, b3.duration = 1s - at running time = 3s
  b4.pts = 4s, b4.duration = 1s - at running time = 4s
  <wait at EOS for 1second>

Now, playing that reverse with start=0, stop=5s, rate=1.0 has to display
the following buffers:

  b0.pts = 4s, b0.duration = 1s - at running time = 0s
  b1.pts = 3s, b1.duration = 1s - at running time = 1s
  b2.pts = 2s, b2.duration = 1s - at running time = 2s
  b3.pts = 1s, b3.duration = 1s - at running time = 3s
  b4.pts = 0s, b4.duration = 1s - at running time = 4s
  <wait at EOS for 1second>

With the previous code, it reproduced the following:

  b0.pts = 4s, b0.duration = 1s - at running time = 1s
  b1.pts = 3s, b1.duration = 1s - at running time = 2s
  b2.pts = 2s, b2.duration = 1s - at running time = 3s
  b3.pts = 1s, b3.duration = 1s - at running time = 4s
  b4.pts = 0s, b4.duration = 1s - at running time = 5s
  <NO WAIT AT EOS AND POST EOS RIGHT AWAY>

This is being tested with the `validate.launch_pipeline.sink.reverse_playback_clock_waits.*`
set of tests

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/450>
2020-05-06 14:24:36 +00:00
Thibault Saunier
4a025d77ac basesrc: Fix the way position is computed in reverse playback
In reverse playback, buffers are played back from buffer.stop
(buffer.pts + buffer.duration) to buffer.pts, which means that the
position after the buffer is consumed is buffer.pts, not buffer.pts -
buffer.duration.

Without that change, and when `automatic_eos` feature is on,
we were dropping the last buffers as marking the stream EOS one buffer
too soon.

This is now being tested extensively by GstValidate in the
`validate.test.clock_sync.*` set of tests.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/450>
2020-05-06 14:24:36 +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
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
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
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
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
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
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