Commit graph

3208 commits

Author SHA1 Message Date
Sebastian Dröge
ba294415d7 basesink: Post a latency message whenever we're ready to answer the query
Usually the latency message is only posted whenever latency of an
element changes but that might be too early as the sinks might not be
able to query the latency at that point yet.

Similarly adding a new sink should cause latency reconfiguration once
that new sink is able to report its latency.

This fixes latency configuration in pipelines where webrtcbin is the
only "sink", i.e. it is used in a sendonly session. Before, the latency
would always be configured to 0.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/843>
2021-06-28 19:59:47 +03:00
Sebastian Dröge
81bd8913b5 basesrc: Print segments with GST_SEGMENT_FORMAT and not GST_PTR_FORMAT
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/842>
2021-06-24 07:01:38 +00:00
François Laignel
5230cab38d Check mandatory ClockTime arguments
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/837>
2021-06-16 12:33:28 +02:00
Doug Nazar
b16e96dd87 Use g_memdup2() where available and add fallback for older GLib versions
glib 2.68 deprecates g_memdup(). Replace with g_memdup2() and
add fallback if compiling against older versions, since we
want to avoid deprecation warnings.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/803>
2021-06-08 07:59:05 +00:00
Alba Mendez
4c75ec53e7 introspection: annotate ownership in more vfuncs
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/831>
2021-06-07 09:29:58 +00:00
Nicolas Dufresne
76cd3ff183 doc: base: Fix reference to virtual function
The hotdoc syntax is #ClassName::function, but the code was using
without anything before.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/808>
2021-05-12 13:17:00 +00:00
Doug Nazar
9efd519c81 gstcheck: Ensure unused threadpool threads are stopped
Ensures that all unused threads are exited before the atexit()
handlers run.

This prevents a race with any thread that used the OpenSSL library
between it's thread cleanup routine and it's atexit() cleanup routine
which can cause a SIGSEGV.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/812>
2021-05-12 03:08:30 +00:00
François Laignel
1a8dfdfc54 Introduce gst_element_request_pad_simple
The name `gst_element_get_request_pad()` is confusing to people
learning GStreamer. `gst_element_request_pad_simple()` aims at
providing the exact same functionality, while making it more
explicit it is a simplified `gst_element_request_pad()`.

`gst_element_request_pad_simple()` is consistent with other
functions such as `gst_element_seek_simple`.

This commit deprecates `gst_element_get_request_pad()` so that a
compilation warning is emitted when used and incite developers
to use the more explicit `gst_element_request_pad_simple()`.

See also https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/merge_requests/743#note_886586

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/802>
2021-05-04 15:49:32 +02:00
Doug Nazar
77ab7b42b3 harness: Fix object used to log caps warning.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/801>
2021-04-20 23:54:52 -04:00
Sebastian Dröge
defe732ae0 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/784>
2021-04-06 21:17:56 +03:00
Chris White
a38d06cb1c gst: Add missing G_GNUC_NULL_TERMINATED markers
Functions that require NULL as their last vararg are marked so the
compiler can warn on missing NULL.

Also, document the NULL terminator for gst_make_element_message_details()
and gst_tracer_record_new().

https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/669

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/774>
2021-04-01 20:53:26 -04:00
Matthew Waters
3d887c7f07 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/775>
2021-03-19 04:15:19 +00:00
Olivier Crête
c6a98609e5 aggregator: Release the SRC lock while querying latency
This is required because the query could be intercepted and the
application could send any other requests to the element from this
thread.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/771>
2021-03-17 14:13:27 +00:00
Mathieu Duponchelle
f1f226f811 Revert "baseparse: always use incoming DTS"
This reverts commit fc5cd9591a.
2021-02-16 17:13:02 +01:00
Marijn Suijten
c77136d63f 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/730>
2021-01-14 10:17:34 +01:00
Jakub Adam
a06dcc3e38 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/720>
2020-12-11 16:05:55 +01:00
Marijn Suijten
87ffe289aa 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/714>
2020-12-03 19:25:30 +01:00
Sebastian Dröge
20f6a2ece4 Add some missing nullable annotations
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/678>
2020-11-05 14:22:24 +02:00
Jan Schmidt
f6ce1686f1 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/686>
2020-10-30 23:46:07 +11:00
Mathieu Duponchelle
fc5cd9591a baseparse: always use incoming DTS
When parsing interlaced video streams, ignoring incoming DTS could
cause the parser to end up with PTS < DTS output buffers, for example
when increasing next_dts using the duration of the last pushed
buffer.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/681>
2020-10-27 01:58:32 +01:00
Xavier Claessens
6780dfd55a pkgconfig: Fix missing libcheck dependencies in gstreamer-check-1.0
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/676>
2020-10-16 18:14:38 +00:00
Nicolas Dufresne
e600c85aee 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/677>
2020-10-16 17:50:11 +00:00
Xavier Claessens
4095a4b4c5 Meson: Use pkg-config generator
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4>
2020-10-12 13:39:17 +00:00
Jan Alexander Steffens (heftig)
0f93889c7a 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/663>
2020-10-08 18:30:00 +02:00
Matthew Waters
9f17094cf3 aggregator: don't fail all sink pads when a caps event fails negotiation
If one pad returns not-negotiated from a caps event, then all other sink
pads were returning not-negotiated.

In our case, we can't reliably easily fail at all so just remove that
code.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/623>
2020-09-18 09:04:21 +00:00
Matthew Waters
4f95dec74a baseparse: prefer upstream caps rather than overriding
e.g. h264parse ! video/x-h264,stream-format=avc receives the following:
- caps: video/x-raw,stream-format=byte-stream
- gap event: baseparse tries to choose some default caps but would
  override the downstream chosen caps field with upstreams value.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/581>
2020-09-18 08:12:30 +00:00
Sebastian Dröge
46305b292f 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/630>
2020-09-18 07:01:14 +00:00
Sebastian Dröge
1a59eeedb4 harness: Add gst_harness_set_live()
By default each harness returns is_live=TRUE in latency queries. This is
often not desired and can now be overridden.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/599>
2020-09-10 14:18:42 +03:00
Sebastian Dröge
ca38070bdf aggregator: Reset latency values in start()
Some base classes like videoaggregator try retrieving the latency during
construction, which causes the latency values to be set already until
reconfiguration happens.

By resetting them the same way as in stop() we ensure that we always
start cleanly.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/599>
2020-09-10 14:18:34 +03:00
Tom Schoonjans
40c994cdde ptp_helper_post_install.sh: deal with none
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/620>
2020-09-09 19:27:19 +00:00
Sebastian Dröge
aa3e110a54 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/601>
2020-09-09 09:54:42 +00:00
Mathieu Duponchelle
52aa6a9dda 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/608>
2020-09-09 01:39:27 +00:00
Sebastian Dröge
347fff4ec1 ptp: Also handle gnu/kfreebsd
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/619>
2020-09-08 22:22:58 +00: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