Commit graph

71 commits

Author SHA1 Message Date
Seungha Yang e56d3d3e07 filesrc: Don't abort on _get_osfhandle()
_get_osfhandle() expects valid fd and CRT will abort program
if given paramerter is invalid. The fd can be invalidated
in various way, file was deleted by other process after
we open a file. To avoid it, our own exception
handler must be installed so that _get_osfhandle() can return
INVALID_HANDLE_VALUE if fd is invalid.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6877>
2024-05-20 08:32:43 +00:00
Sebastian Dröge 0ef396359c gst: Move GstQueueArray as GstVecDeque to core
And change lengths and indices from guint to gsize for a more correct type.

Also deprecate GstQueueArray and implement it in terms of GstVecDeque.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6779>
2024-05-06 18:25:42 +00:00
Xavier Claessens d129c8ebd3 clocksync: Proxy allocation queries
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6515>
2024-04-03 03:58:10 +00:00
Arnaud Vrac 258e9d2bca inputselector: fix possible clock leak on shutdown
Avoid leaking a GstClock object on shutdown, bail out before taking the ref when
not playing.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6442>
2024-03-27 10:10:14 +00:00
Jan Schmidt d3e79077dc identity: Don't refuse seeks unless single-segment=true
identity only needs to configure the internal seek segment if it's
aggregating upstream segments into 1. If it's not, don't break
other seek behaviour by refusing (for example) instant-rate change
seeks.

Fixes: #3363
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6299>
2024-03-08 17:07:25 +11:00
Arnaud Vrac 49fa99737b queue2: post 100% buffering message even when waiting for space to be freed
In the case where the queue shrinks due to a property change and the queue
becomes full, we would set the waiting_del flag, which would prevent posting the
100% buffering message on the bus. Since the pipeline is not aware of the new
buffering value, in the common case where the pipeline is paused during
buffering, it would never resume.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6165>
2024-02-26 18:53:08 +00:00
Arnaud Vrac 7293c313d4 queue2: move gst_queue2_get_buffering_message code to the only call site
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6165>
2024-02-26 18:53:08 +00:00
Arnaud Vrac 15a18281d7 queue2: remove redundant check to avoid posting the same buffering value twice
Remove the percent_changed check to determine whether a buffering message should
be posted. The check on the last posted buffering value is sufficient, and the
removal doesn't introduce additional complexity.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6165>
2024-02-26 18:53:08 +00:00
Arnaud Vrac 517498dd11 queue2: consolidate buffering message posting code
No need to copy paste the code, simply call the common gst_queue2_post_buffering
function.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6165>
2024-02-26 18:53:07 +00:00
Arnaud Vrac 54aa6b66d8 queue2: make sure update_buffering is called with the lock taken
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6165>
2024-02-26 18:53:07 +00:00
Vivia Nikolaidou e451908a27 multiqueue: Don't stop dropping when an internal queue is empty
It is racy and may cause us to accidentally keep forwarding data past
the EOS. The only reason to stop dropping would be when we encounter a
stream-start, segment, or segment-done event, either in push_one
(already queued) or in the sink pad's event function.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5766>
2023-12-13 20:36:47 +00:00
Jan Schmidt 37ba866d52 multiqueue: Ignore queue fullness for most events
Use gst_data_queue_push_force() for most events so they
are immediately enqueued. Only gap events and actual buffer
data will now block when the queue is full.

This fixes a problem with non-flushing seek handling
where events following a segment-done event would block
if they precede the SEGMENT event, since only SEGMENT
events would clear the 'eos' state of the multiqueue
queue.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5801>
2023-12-13 15:31:45 +00:00
Seungha Yang aa5f6b2376 multiqueue: Do not update time level on segment
Update time level decision logic to be identical to the queue/queue2

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5430>
2023-10-11 13:17:46 +00:00
Seungha Yang 96a758abdb queue, queue2: Fix current-level-time report
Do not update timelevel on segment. Segment itself does not tell
anything about the amount of buffered time duration in the element
but buffer timestamp/duration is required to measure actual bufferred time.
Moreover, at the time when new segment is applied to sink/srcpad,
segment.position would point to random value.
Therefore calculating running time using the random value does not
make sense and it will result in wrong timelevel report.

This patch updates queue/queue2's timelevel measuring logic so that
it can be updated only on buffer/buffer-list/gap-event flow.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5430>
2023-10-11 13:17:46 +00:00
Seungha Yang 8252ca0ef2 queue, queue2: Flush internal queue on flow error
This is to fix an infinitely blocked upstream streaming thread if
* upstream has fixed-size buffer pool, some H/W decoders for example
* downstream returned flow error without releasing buffer

When the fixed-size buffer pool hits its configured max-buffers and
also downstream of queue returned flow error without releasing corresponding
buffer, upstream has no chance to run the next processing loop
because it will be blocked by acquire_buffer(), and therefore
downstream flow will not be propagated to upstream.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5023>
2023-09-04 17:47:02 +00:00
Théo Maillart 8f1524a592 inputselector: fix playing variable is never set
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4983>
2023-07-07 08:43:56 +00:00
Andoni Morales Alastruey 20c6d8c78f leaks: add unix signals documentation
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4973>
2023-07-06 10:26:18 +00:00
Seungha Yang cf60babf87 filesink: Fix buffered mode writing
Fixing miscalculated buffer index when a buffer holds multiple
memories and it's not aligned to the vector size 16

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4809>
2023-06-09 03:22:30 +09:00
Seungha Yang a1c2df830b clocksync: Fix deadlock because of taken stream lock on flush-start
Deadlock happens when streaming thread is already blocked by downstream
and clocksync is trying to take stream lock on flush-start.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4772>
2023-06-05 20:17:40 +09:00
Jan Alexander Steffens (heftig) cd827e790a multiqueue: Simplify gst_multi_queue_iterate_internal_links
We don't need to obtain the mutex to ensure that `sq` is non-NULL. `sq`
is assigned immediately after the pads are created and not destroyed
until the pads are finalized.

Use the pad direction to determine which internal peer we need.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/888>
2023-04-04 12:22:18 +00:00
Tim-Philipp Müller 574e6b7994 gstreamer: re-indent with GNU indent 2.2.12
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4182>
2023-03-17 03:18:53 +00:00
Vivia Nikolaidou e9faf63d2e inputselector: Wake up streaming thread before PLAYING_TO_PAUSED transition
Also take object lock before iterating the pads.

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4190>
2023-03-16 13:34:28 +00:00
Alicia Boya García 136b2e0eae tracers: Document the 'log' tracer
This patch adds documentation to the 'log' tracer and amends the design
document of Tracers to replace a misleading example of the 'log' tracer
with a different example that uses tracer arguments with tracers that do
actually handle said arguments.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4153>
2023-03-14 01:35:14 +00:00
Vivia Nikolaidou cf5b659bc6 inputselector: Avoid deadlock when shutting down
Transition from PLAYING to PAUSED unschedules any pending clock wait,
but there was no guard that prevented another input buffer then waiting
again while in PAUSED before dataflow stops. Use a new `playing` flag to
avoid this, and exit the chain function if instead of playing we're now
flushing. Basically the same as the clocksync element.

Closes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1772

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4098>
2023-03-02 16:52:35 +02:00
Thibault Saunier 35e2ecd48b clocksync: Add "QoS" support
When ClockSync synchronizes the data stream on the clock, it should also
push `QoS` events if the user wants to do it as, as stated in [the QoS
design doc] "Elements that synchronize buffers on the pipeline clock
will usually measure the current QoS".

The logic has been replicated from `GstBaseSink`.

[the QoS design doc]: https://gstreamer.freedesktop.org/documentation/plugin-development/advanced/qos.html

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2225>
2023-02-01 07:02:19 +00:00
Daniel Ulery befab7af72 filesink: Adds rb+ file mode
Adds rb+ file mode to filesink so that files can be pre-allocated. This
can be use to keep reduce fragmentation over time with splitmuxsink.

Fixes  #955

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1532>
2023-01-26 07:05:21 +00:00
Edward Hervey 21cad29bcd multiqueue: Handle use-interleave latency live pipelines
Due to the dynamic nature of multiqueue, when `use-interleave` is used we can't
report a maximum tolerated latency (when queried) since it is calculated
dynamically.

When in such live pipelines, we need to make sure multiqueue can handle the
lowest global latency (provided by this event). Failure to do that would
result in not providing enough buffering for a realtime pipeline.

Fixes #1732

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3772>
2023-01-24 19:42:49 +00:00
Tim-Philipp Müller 3dd12cb640 inputselector: drop use of GSlice
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3695>
2023-01-24 15:25:06 +00:00
Tim-Philipp Müller 78a941e873 multiqueue: drop use of GSlice
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3695>
2023-01-24 15:25:06 +00:00
Tim-Philipp Müller fa55d8302b queue2: drop use of GSlice
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3695>
2023-01-24 15:25:06 +00:00
Tim-Philipp Müller ed78e55bc7 tracers: drop use of GSlice
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3695>
2023-01-24 15:25:06 +00:00
Alicia Boya García 2c2767b94a Use automatic pad activation in elements that can take advantage of it
Pads are activated automatically when they are added if the element
state is >=PAUSED, so it's not necessary to activate them manually
anymore.

This patch removes manual pad activation from gstaggregator, gstconcat,
gstfunnel, and gstinputselector.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3636>
2023-01-24 14:42:35 +00:00
Jan Alexander Steffens (heftig) b0e55caf0d input-selector: Take the object lock while iterating sinkpads
Otherwise we can race with pad removal and crash from use-after-free.

Fixes: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1717
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3745>
2023-01-18 16:21:12 +00:00
Mart Raudsepp 3fa4ff0562 multiqueue: Fix potential deadlock with parallel release_pad calls
Commit d3a66f9851 introduced a potential deadlock with two parallel release_pad
calls, where one could release the main multiqueue lock (qlock) while still
holding the reconf_lock and then calling other routines which in some conditions
may try to acquire qlock again. The second release_pad could already acquire the
qlock and then start waiting on reconf_lock, which may never be possible because
because the first one isn't releasing it until it can acquire qlock.

Fix it by holding reconf_lock for the whole durationg of qlock, making this
particular deadlock impossible.

Fixes #1642

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3571>
2022-12-23 13:08:54 +00:00
Hiero32 7050b00c10 fdsrc,fdsink: Set binary mode on FD
Default mode of STD handles on Windows is text mode, and OS will
insert CRLF sequence by default.

Co-authored-by: Seungha Yang <seungha@centricular.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3070>
2022-12-21 06:34:15 +00:00
Hiero32 a29a1b21c3 coreelements: Use G_OS_WIN32 macro
* HAVE_WIN32 is not defined elsewhere
* Enables fdsrc/fdsink for MinGW build as well

Co-authored-by: Seungha Yang <seungha@centricular.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3070>
2022-12-21 06:34:15 +00:00
Tim-Philipp Müller 8110ea6b1b multiqueue: update for renamed log id macros
See #1635.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3553>
2022-12-10 12:40:13 +00:00
Edward Hervey f84fe4710a multiqueue: Use new id-based debugging methods
Clarifies the debug logs

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3483>
2022-12-05 09:59:30 +00:00
Edward Hervey 90d4129301 multiqueue: Handle gapless with flushing
Don't reset the stream-start group-id when stop/pausing single queues. They are
only resetted when re-used (in READY->PAUSED).

Fixes #1586

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3487>
2022-12-02 09:22:41 +00:00
Vivia Nikolaidou c6af0a39e7 inputselector: Add drop-backwards property
When sync-streams=true, drop backwards buffers on pad switch.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3256>
2022-11-22 21:21:40 +02:00
Vivia Nikolaidou 5fb71dd55b inputselector: Fix waiting on sync-mode=clock
Basically copy over what clocksync does, but taking into account that we
have multiple upstream latencies.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3256>
2022-11-22 21:21:40 +02:00
Célestin Marot 9d829b85e4 fakesrc: avoid time overflow with datarate
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3433>
2022-11-19 11:13:33 +00:00
Jan Schmidt d3a66f9851 multiqueue: Protect reconfiguration with a lock
Add a lock to prevent overlapping of request and release
pads, to close a race where multiqueue might try and
add a slot with an id that hasn't quite finished being
removed yet by another thread.

Fix for https://gitlab.freedesktop.org/bilboed/gstreamer/-/issues/5
and https://gitlab.freedesktop.org/bilboed/gstreamer/-/issues/11

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2784>
2022-11-16 14:01:46 +00:00
Edward Hervey 4b8f411c5d multiqueue: Handle gapless input
When dealing with gapless input (i.e. streams with changing group-id in
GST_EVENT_STREAM_START), we need to take into account the elapsed
running-time (if applicable) in order to properly calculate levels and output
time. Without doing this all incoming data from future groups would be
considered as being "late" and would be consumed immediately.

This does **NOT** modify the actual segment and buffer times, and is only used
internally.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2784>
2022-11-16 14:01:46 +00:00
Guillaume Desmottes c624900a44 tracers: latency: document the 'reported' flag
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3359>
2022-11-08 10:10:09 +00:00
Tim-Philipp Müller 04581fad6a identity: fix "handoff" signal docs
The docs list an extra pad argument, which doesn't
match the actual signal function signature. Probably
a copy'n'paste mistake when copying things from fakesink.

Fixes #1546

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3337>
2022-11-05 11:58:34 +00:00
Edward Hervey cb1345ab77 concat: Properly propagate EOS seqnum
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3284>
2022-10-27 11:20:01 +02:00
Edward Hervey f08bdf1c4a queue2: Hold the lock when modifying sinkresult
As it's done elsewhere. Avoids a potential race of the field being modified in
the meantime.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3110>
2022-10-03 15:18:09 +00:00
Paweł Stawicki ccef26908e queue2: Fix deadlock when deactivate is called in pull mode
check is flush was called before waiting on condition

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2967>
2022-09-20 09:23:22 +00:00
Thibault Saunier 6a4425e46a meson: Call pkgconfig.generate in the loop where we declare plugins dependencies
Removing some copy pasted code

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2970>
2022-09-01 21:17:35 +00:00