Commit graph

2275 commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
Jan Schmidt
35136dc91a baseparse: Fix typo 2020-04-01 18:36:19 +11:00
Jan Schmidt
1b92672e3b basesrc: Check the return value of gst_segment_do_seek()
Don't assume that a given seek succeeds - check the return result.
2020-03-26 13:51:41 +00:00
Matthew Waters
b3afd1a2fc flowcombiner: passthrough the flow return if there are no pads
What may happen is that during the course of processing a buffer,
all of the pads in a flow combiner may disappear.  In this case, we
would return NOT_LINKED.  Instead return whatever the input flow return
was.
2020-03-26 02:31:52 +00:00
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
Olivier Crête
0a8d14acc9 Remove deprecated GTimeVal
GTimeVal won't work past 2038
2019-12-10 19:18:32 -05: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
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
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