Commit graph

3271 commits

Author SHA1 Message Date
Matthew Waters
4154baedb1 basetransform: allow not passthrough if generate_output is implemented
This allows an element to not require implementing transform or
transform_ip.
2020-03-11 23:00:20 +11:00
Mathieu Duponchelle
26ffe05ccd gstaggregator: fix the prototype of sink_event_pre_queue
This is not an API breakage, as implementors are already
expected to return a GstFlowReturn
2020-03-05 07:50:42 +00:00
Olivier Crête
19f414c0d1 basesink: Improve clarity of latency query maths debug message
Add the equation to the debug message to make it easier for non-GStreamer
experts to understand why their pipeline has latency.
2020-02-27 16:53:18 +00:00
Matus Gajdos
826230ba1b baseparse: fix memory leak
A buffer to be skipped wasn't unref'd in gst_base_parse_chain().

Fixes #406
2020-02-15 17:58:23 +00:00
Zebediah Figura
d28e0b4147 baseparse: Set the private duration before posting a duration-changed message
Otherwise an application cannot rely on a subsequent call to e.g. gst_pad_query_duration() succeeding.
2020-02-14 18:17:38 +00:00
Sebastian Dröge
6ab1cdf51d basetransform: Make gst_base_transform_reconfigure() public
This has the same function as the negotiate() functions in various other
base classes and is required to be able to completely re-implement
submit_input_buffer() in subclasses.
2020-02-10 13:19:26 +02:00
Thibault Saunier
baa5aae24b baseparse: Don't set meaningless buffer dts from segment->start
When we do not have any information about DTSs we shouldn't try to make
them up, moreover after seeking `segment->start` has nothing to do with
the next buffer timing (and is probably after the actual buffer timestamp)
and since, since fa8312472f
we do:

```
if (buffer->dts > buffer->dts)
    buffer->pts = buffer->dts
```

we end up setting `buffer->pts = segment->start` which is plain
broken and leads to downstream decoder accept the first buffer
as it will be inside the segment (its pts==segment->start) which
basically means accurate seeking behaves mostly the same way as
keyframe seeks.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/492
2020-02-04 18:14:05 +00:00
Sebastian Dröge
48f14c5e5e aggregator: Initialize source pad segment position to -1 when resetting
This allows start-time selection in gst_aggregator_pad_chain_internal()
to actually work as that code assumes it to be -1 for actually
overriding the value.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/500
2020-01-23 19:27:14 +02: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
Olivier Crête
0a8d14acc9 Remove deprecated GTimeVal
GTimeVal won't work past 2038
2019-12-10 19:18:32 -05: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
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
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
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
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
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
Tim-Philipp Müller
10d9e18f02 Remove autotools build system 2019-10-13 16:10:42 +01:00
Xavier Claessens
e17bde51b3 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.
2019-10-07 17:47:47 +00:00
Xavier Claessens
fe9e49da87 harness: Add gst_harness_pull_until_eos() 2019-10-07 17:47:47 +00:00
Aaron Boxer
509f6201e1 documentation: fix a number of typos 2019-10-06 11:12:11 -04:00
Jordan Petridis
e2a70cb90f
gstdirectcontrolbinding: Fix integer comparison
i is declared as gint but then compared against `n_values` guint
in the for loop below.
2019-10-04 20:06:49 +03:00
Sebastiano Barrera
89dfda56e3 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.
2019-09-11 11:13:38 +02:00
Niels De Graef
4812c4087f 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.
2019-09-09 12:16:24 +00:00
Matthew Waters
83e0da2061 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) {
      ~~~~~~~ ^  ~~
2019-08-30 12:05:40 +10:00
Matthew Waters
5c3ae3893a 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);
                            ^~~
2019-08-26 12:42:37 +00:00
Sebastian Dröge
74797e962f 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
2019-08-19 18:55:07 +03:00
Tim-Philipp Müller
d90d771a9a 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
2019-08-15 12:56:06 +01:00
Sebastian Dröge
d7d79f2c54 aggregator: Add sink_event_pre_queue() and sink_query_pre_queue() vfuncs
These allow subclasses catching serialized events/queries before they're
queued up.
2019-08-14 18:34:31 +03:00
Sebastian Dröge
aebff1fcaa aggregator: Add GstAggregator::negotiate()
For consistency with other base classes and for allowing to completely
override the negotiation behaviour.
2019-08-14 18:34:13 +03:00
Sebastian Dröge
e024926636 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.
2019-08-14 09:53:44 +03:00
Sebastian Dröge
21798184a0 aggregator: Assert if the sink/src pad type that is to be used is not a GstAggregatorPad or subclass thereof 2019-08-13 17:11:51 +00:00
Sebastian Dröge
b8455445c5 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.
2019-08-13 17:11:51 +00:00
Mathieu Duponchelle
9ec55072d2 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
2019-07-19 17:31:11 +02:00
Tim-Philipp Müller
214fe0f230 basesrc: fix g-i warnings 2019-07-19 11:09:22 +01:00
Sebastian Dröge
09909d37bd aggregator: Make parsing of explicit sink pad names more robust
When passing "sink_%d" twice to aggregator before it would create two
pads called "sink_0", because it failed to parse "%d" as integer and
used 0 instead then.

Instead validate that parsing was actually successful and also don't
even try to parse if the requested pad name contains a '%'.
2019-07-09 08:09:29 +00:00
Nirbheek Chauhan
7cfdb23387 gstcheck: Document strcmp used in string cmp macros
strcmp() does not allow the arguments to be NULL, but g_strcmp0()
does, so document that we use g_strcmp0() so that people don't need to
worry about that.
2019-07-01 11:51:46 +00:00
Carlos Rafael Giani
6412988975 basesrc: Add public gst_base_src_negotiate () function
This is useful for when format changes occur mid-stream.
2019-07-01 11:16:09 +02:00
Nicolas Dufresne
91543bd78d testclock: Allow calling crank with a past entry
At the moment, we can only use crank if the pending entry is in the
future. This patch leaves the clock time to the same point if the
pending entry was in the past. This still execute a single entry. This
will be needed for the jitterbuffer, since as soon as we stop waking up
the jitterbuffer when the timer is reschedule later, we may endup with
such case in the unit tests.

Related to #608
2019-06-27 20:09:43 +00:00
Michael Bunk
4bc68bb3fe Fixing various typos 2019-06-20 15:20:27 +00:00
Havard Graff
229b4776ea harness: move creating of buffer and event queues to harness itself
By only having it on sinkpad-creation, it is racy to write a test
with a sometimes-pad (like a demuxer) that you want to pull from, having
the pull wait until the pad arrives and the buffer can be produced.
2019-06-13 09:45:03 +02:00
Stian Selnes
604ea0e711 harness: Fix race when forwarding event while tearing down harness 2019-06-13 09:45:03 +02:00
Stian Selnes
69430dd7ba harness: Make sure pad functions are not called after teardown
For the query function there's a risk that the function may be called
after the harness has been teared down. Since the function accesses a
pointer to the harness via the pad's data, the harness must protect
itself against this.

Event and chain function is also handled for constistency, although
they don't have the same problem since the gstpad.c checks whether the
pad is flushing before calling these.
2019-06-13 09:45:03 +02:00
Mathieu Duponchelle
6d16615093 aggregator: don't try to take STREAM_LOCK on sink pad flush
This was a misguided effort to try and guarantee the buffers of
the sink pads would not change during aggregate, when an upstream
branch is seeked independently, however this is simply incorrect
as downstream has not necessarily been flushed, or the aggregate
function might be waiting to receive buffers on other pads.
2019-06-11 22:09:33 +02:00
Mathieu Duponchelle
4087361da3 aggregator: send flush_stop ourselves if needed
In !159 , we switched to sending flush_start ourselves from the
do_seek implementation. If no flushing seek successfully made its
way upstream, we need to send flush_stop ourselves as well.
2019-06-11 15:20:18 +02:00
Mathieu Duponchelle
c55c61eb84 aggregator: don't hold stream lock when flushing
Releasing a GRecMutex from a different thread is undefined
behaviour.

There should be no reason to hold the stream lock from the
moment aggregator receives a flush_start until it receives
the last flush_stop: the source pad task is stopped, and can
only be restarted once the last flush_stop has arrived.

I can only speculate as to the reason why this was done,
as it was that way since the original commit. My best
guess is that aggregator originally didn't marshall events
and queries to the aggregate thread, and this somehow
helped work around this.
2019-06-10 23:04:31 +02:00
Mathieu Duponchelle
25383eaa5c aggregator: refactor flushing logic
Instead of tracking "pending_flush_*" on the pads and the
aggregator, we now simply track the last seqnum for flush start
and flush stop events on the pads, and use it to determine whether
we should enter or exit our flushing state.

See https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/977
2019-06-10 23:04:31 +02:00
Niels De Graef
09141c6e1f Use G_DEFINE_AUTOPTR_CLEANUP_FUNC unconditionally
Since we started depending on GLib 2.44, we can be sure this macro is
defined (it will be a no-op on compilers that don't support it). For
plugins we should just start using `G_DECLARE_FINAL_TYPE` which means
we no longer need the macro there, but for most types in core we don't
want to break ABI, which means it's better to just keep it like it is
(and use the `#ifdef` instead).
2019-06-04 08:50:59 +02:00