Commit graph

119285 commits

Author SHA1 Message Date
Mikhail Rudenko 05ef1bbc06 rtsp-stream: clear sockets when leaving bin
Since commit 4d86f994, when setting an RTSP media both shared and
reusable, streaming cannot be restarted after the first time all the
clients disconnect. That happens because the sockets (unlike
addresses) of GstRTSPStream are not cleared in
gst_rtsp_stream_leave_bin, and on restart sockets and addresses are
not allocated in gst_rtsp_stream_allocate_udp_sockets, and then the
check in create_sender_part fails. Fix this by clearing sockets in
gst_rtsp_stream_leave_bin.

Fixes gstreamer/gst-rtsp-server#113

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6325>
2024-03-11 18:22:38 +03:00
He Junyan 861c1a44be va: av1enc: Init the output_frame_num when resetting gf group
Fixes: #3359
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6308>
2024-03-11 12:38:57 +00:00
Edward Hervey 5f7062136d decodebin3: Handle race switching on pending streams
find_slot_for_stream_id() will return a slot which has the request stream-id as
active_stream *or* pending_stream (i.e. the slot on which that stream is
currently being outputted or will be outputted).

When figuring out which slot to use (if any) we want to consider stream-id
which *will* appear on a given slot which isn't outputting anything yet the same
way as if we didn't find a slot yet.

Fixes races when doing intensive state changes

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6270>
2024-03-11 11:13:59 +00:00
Edward Hervey e03e2308d7 decodebin3: Clear select streams seqnum when resetting
At this point there's definitely no pending select streams

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6270>
2024-03-11 11:13:59 +00:00
Edward Hervey 344acfe4e8 decodebin3: Only post collection message on actual updates
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6270>
2024-03-11 11:13:59 +00:00
Edward Hervey 33fe063f50 decodebin3: Clear the global collection when resetting
This avoids having stray collections when re-using decodebin3

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6270>
2024-03-11 11:13:59 +00:00
Edward Hervey 086ecb008f avviddec: Fix how we get back the codec frame
With the new copy_opaque system, the corresponding frame is stored in the
picture opaque ref.

This also handles the case where the "regular" opaque might be empty in the
case of "DECODE_ONLY" frames, since it that field is set in `get_buffer2()`
which might not be called for those frames

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6301>
2024-03-11 10:17:41 +00:00
Edward Hervey eacd5c1cb1 avviddec: Improve debug statements
Add SFN to better track what is going on

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6301>
2024-03-11 10:17:41 +00:00
Nirbheek Chauhan 3bed35c342 rtspsrc: Don't invoke close when stopping if we've started cleanup
When we're doing a state change from PLAYING to NULL, first we invoke
gst_rtspsrc_loop_send_cmd_and_wait (..., CMD_CLOSE, ...) during
PAUSED_TO_READY which will schedule a TEARDOWN to happen async on the
task thread.

The task thread will call gst_rtspsrc_close(), which will send the
TEARDOWN and once it's complete, it will call gst_rtspsrc_cleanup()
without taking any locks, which frees src->streams.

At the same time however, the state change in the app thread will
progress further and in READY_TO_NULL it will call gst_rtspsrc_stop()
which calls gst_rtspsrc_close() a second time, which accesses
src->streams (without a lock again), which leads to simultaneous
access of src->streams, and a segfault.

So the state change and the cleanup are racing, but they almost always
complete sequentially. Either the cleanup sets src->streams to NULL or
_stop() completes first. Very rarely, _stop() can start while
src->streams is being freed in a for loop. That causes the segfault.

This is unlocked access is unfixable with more locking, it just leads
to deadlocks. This pattern has been observed in rtspsrc a lot: state
changes and cleanup in the element are unfixably racy, and that
foundational issue is being addressed separately via a rewrite.

The bandage fix here is to prevent gst_rtspsrc_stop() from accessing
src->streams after it has already been freed by setting src->state to
INVALID.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6302>
2024-03-11 09:15:50 +00:00
Edward Hervey 73152b53ff decodebin3: Provide clear error message if no decoders present
If we don't do this we will end up with a more cryptic error message (not-linked
error from some upstream component).

Fixes #3198

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6317>
2024-03-11 09:17:09 +01:00
Chris Spencer 1032d58187 vkmemory: invalidate non-coherent memory when mapping for read
Mapping non-coherent memory does not implicitly invalidate the host caches.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6310>
2024-03-11 01:55:44 +00:00
Chris Spencer 9412565221 vulkan/operation: use timeline semaphore fallback if sync2 not supported
gst_vulkan_operation_add_dependency_frame does not fall back to the
timeline semaphore implementation if VK_KHR_synchronization2 is compiled
in, but not supported by the driver.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6309>
2024-03-11 00:58:40 +00:00
Chris Spencer 7701e9ffeb vulkan/operation: add missing unlock
gst_vulkan_operation_add_dependency_frame does not release its lock if
support for VK_KHR_timeline_semaphore/VK_KHR_synchronization2 is compiled
in, but not supported by the driver.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6309>
2024-03-11 00:58:40 +00:00
Jordan Petridis 95bafc4934 rsvg: Add direct dependency on cairo
We include cairo.h in the element so we should also
declare it in meson.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6306>
2024-03-08 19:01:30 +02:00
Seungha Yang 2e1eaaec5e ges: Fix critical warning
GStreamer-CRITICAL **: 20:44:38.256: gst_debug_log_full_valist:
assertion 'category != NULL' failed

Make sure debug category initialized.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6304>
2024-03-08 21:00:51 +09:00
François Laignel 7d5bb1ea7a webrtc: add all SSRC attributes getting CAPS for a PT
The transport stream only returned the CAPS for the first matching PT entry
from the `ptmap`. Other SSRC with the same PT where not included. For a stream
which bundled multiple audio streams for instance, only the first SSRC was
knowed to the SSRC demux and downstream elements.

This commit adds all the `ssrc-` attributes from the matching PT entries.

The RTP jitter buffer can now find the CNAME corresponding its SSRC even if it
was not the first to be registered for a particular PT.

The RTP PT demux removes `ssrc-*` attributes cooresponding to other SSRCs
before pushing SSRC specific CAPS to downstream elements.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6119>
2024-03-08 10:28:15 +00:00
François Laignel d83184cf9a sdp: accept empty attribute value represented as a NULL pointer
Some empty media attribute values are set to an empty string, others as a NULL
pointer. It seems that code is able to deal with both, except for the UTF8
validation.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6119>
2024-03-08 10:28:15 +00:00
François Laignel aeaef7a7f0 webrtcbin: RFC5576 - early CNAME support
See RFC5576: have CNAME available to the rtpjitterbuffer before the the first
RTCP SR is received, for rapid synchronization. Similar to what was done for
RTSP (last 2 commits) of [MR 2132].

[RFC5576]: https://www.rfc-editor.org/rfc/rfc5576
[MR 2132]: https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2132

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6119>
2024-03-08 10:28:15 +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
Michael Tretter 5b3082257e meson: Fix description in qt options
The qt-x11 description contains a copy/paste error from the qt-wayland option.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6292>
2024-03-08 02:14:11 +00:00
Seungha Yang 4db7eb0290 d3d12screencapturesrc: Add support for WGC API
Adding support for window and monitor capturing by using
Windows Graphics Capture API.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6256>
2024-03-08 01:05:24 +09:00
Seungha Yang 63ef405131 d3d12memory: Implement NT handle caching and custom user data support
Same as the d3d11 memory implementation.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6256>
2024-03-08 01:03:28 +09:00
Mathieu Duponchelle 04077ce906 onvif: tests: check for T flag on all packets
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5173>
2024-03-07 14:02:33 +00:00
Mathieu Duponchelle 519546aea3 rtpgstpay: flush on EOS
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5173>
2024-03-07 14:02:33 +00:00
Mathieu Duponchelle 0631a59803 rtponviftimestamp: make sure to set E and T bits on last buffer of lists
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5173>
2024-03-07 14:02:33 +00:00
Sebastian Dröge b88d69b722 rtpgstpay: Delay pushing of event packets until the next buffer
And also re-timestamp them with the current buffer's PTS.

Not doing so keeps the timestamps of event packets as
GST_CLOCK_TIME_NONE or the timestamp of the previous buffer, both of
which are bogus.

Making sure that (especially) the first packet has a valid timestamp
allows putting e.g. the NTP timestamp RTP header extension on it.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5173>
2024-03-07 14:02:33 +00:00
Seungha Yang 37578454b9 avviddec: Fix interlaced mode detection
Fixing regression introduced by the commit b46559102b

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6285>
2024-03-07 11:53:07 +00:00
Elizabeth Figura e2167867d5 qtdemux: Do not set channel-mask to zero
Leave it uninitialized, so that the downstream decoder will initialize it appropriately. Setting it to zero is wrong.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6225>
2024-03-07 12:52:30 +02:00
Jan Schmidt f53dbb28b2 rtspsrc: Parse Speed/Scale before Range in responses
Parse the speed and scale in the server's response
*before* the range, so that the range start/stop
are swapped (or not swapped) correctly based
on the server's actual chosen values. Otherwise,
the old rate from the segment is used - what the
last seek asked for, but not necessarily what
the server chooses.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6248>
2024-03-06 17:50:53 +00:00
Jan Schmidt 57013e1a7c rtspsrc: Handle queries and events with no manager
When doing direct output with no session manager, we still
want to respond to queries and events from downstream, so
install the handlers

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6248>
2024-03-06 17:50:53 +00:00
Jan Schmidt 4d2f000125 rtspsrc: return NO_PREROLL on PLAYING->PAUSED too
When transitioning back to PAUSED and rtspsrc is live, return
NO_PREROLL so the pipeline knows to skip preroll here too.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6248>
2024-03-06 17:50:53 +00:00
Jan Schmidt 8356bd04a8 rtponviftimestamp: Use gst_segment_to_stream_time_full()
In the situation where playback starts from a keyframe before
the target playback segment, then the first buffers will be
outside the configured segment and gst_segment_to_stream_time()
will return GST_CLOCK_TIME_NONE unconditionally.

If drop-out-of-segment is false, the RTP buffers will not be
dropped, but will be sent witout ONVIF extension timestamps
and given GST_CLOCK_TIME_NONE timestamps on the receiver.

Instead, use gst_segment_to_stream_time_full() to extrapolate
stream time outside the segment so that such buffers still
get assigned their correct timestamps on the receiver.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6248>
2024-03-06 17:50:53 +00:00
Jan Schmidt 4b107b60e7 dvbsubenc: Fix bottom field size calculation
Don't accidentally include the stuffing byte (if present)
into the bottom field size. It should only be included in the
total segment length.

Fixes problems with FFmpeg not rendering the subtitles
with a stuffing byte, giving a "Invalid object location!" error.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6250>
2024-03-06 16:47:38 +00:00
Piotr Brzeziński ca0d4dd6cc macos: Fix glimagesink not respecting preferred size
Cocoa version of glwindow only checks the preferred size upon window creation. glimagesink sets the size right before
calling gst_gl_window_show(), which might be way after the window is created in some cases. If the size was set too
late, glimagesink on macOS would remain 320x240 unless manually resized.

This change makes sure to resize the existing window when _show() is called.

Curiously, this has always been an issue, but went from manifesting every once in a while to being almost completely
broken once old event loop workarounds were removed and gst_macos_main() was introduced.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6185>
2024-03-06 15:48:03 +00:00
Jan Schmidt cca0bc31a7 gstsegment: Don't use g_return_val_if_fail()
Don't use g_return_val_if_fail() to catch the
open-ended segment or empty segment cases in
gst_segment_to_running_time_full()

g_return_val_if_fail() is for programmer errors,
and can be compiled out with a flag.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6219>
2024-03-06 14:48:50 +00:00
François Laignel 7b5a5afa3a ptp clock: fix annotations for gst_ptp_clock_new
* Set `name` as `nullable` same as for gst_ntp_clock_new.
* Set return value as nullable as the constructor can fail.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6251>
2024-03-06 12:17:17 +00:00
Sebastian Dröge df00962cb8 ajasink: Make logging between ajasrc and ajasink more consistent
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6208>
2024-03-06 11:09:58 +00:00
Sebastian Dröge 396aa55958 ajasrc: Improve clock handling
Provide a clock from the source that is a monotonic system clock with
the rate corrected based on the measured and ideal capture rate of the
frames.

If this clock is selected as pipeline clock, then provide perfect
timestamps to downstream.

Otherwise, if the pipeline clock is the monotonic system clock, use the
internal clock for converting back to the monotonic system clock.

Otherwise, use the monotonic system clock time calculated in the above
case and convert that to the pipeline clock.

In all cases this will give a smoother time than the previous code,
which simply took the difference between the driver provided capture
time and the current real-time clock time, and applied that to the
current pipeline clock time.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6208>
2024-03-06 11:09:58 +00:00
Sebastian Dröge 86e3009448 ajasrc: Move frame drop detection after the frame transfer
Otherwise there's a small window between querying the state and doing
the transfer in which a frame could be dropped, and we would then output
the frame right after the dropped one as if it was the dropped frame.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6208>
2024-03-06 11:09:58 +00:00
Sebastian Dröge 170bf0cc8e ajasrc: Improve debug output related to frame transfers
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6208>
2024-03-06 11:09:58 +00:00
Sebastian Dröge 9ab9ceb964 ptp-helper: Fix clippy warning and simplify code a bit
warning: you seem to be trying to use `match` for an equality check. Consider using `if`
   --> ../subprojects/gstreamer/libs/gst/helpers/ptp/main.rs:246:17
    |
246 | /                 match ptp_message.message_type {
247 | |                     PtpMessageType::DELAY_REQ => {
248 | |                         if args.verbose {
249 | |                             trace!("Ignoring our own PTP message");
...   |
253 | |                     _ => (),
254 | |                 }
    | |_________________^

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6245>
2024-03-06 09:17:53 +00:00
He Junyan a5a1944db4 MSDK: Set the job type when create context from external handle
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6221>
2024-03-06 05:22:23 +00:00
He Junyan 1a78d61b9f vah265enc: Set backward_num to 1 in low delay mode
In low delay B mode, the P frame is converted as B frame with forward
references. For example, One P frame may refers to P-1, P-2 and P-3 in
list0 and refers to P-3, P-2 and P-1 in list1.
So the num in list0 and list1 does not reflect the forward_num and
backward_num. The vaapi does not provide ref num for forward or backward
so far. In this case, we just consider the backward_num to be 1 conservatively.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6249>
2024-03-05 23:39:43 +00:00
He Junyan b9c28920e0 vah265enc: Improve B pyramid mode in HEVC
If the reference frame number is bigger than 2, we can enable the
pyramid B mode. We do not need to assign a reference frame to each
pyramid level.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6249>
2024-03-05 23:39:43 +00:00
He Junyan 196de61035 vah265enc: Expand log2_max_pic_order_cnt if needed
In b_pyramid mode, B frames can be ref and prevPicOrderCntLsb can
be the B frame POC which is smaller than the P frame. This can cause
POC diff bigger than MaxPicOrderCntLsb/2 and generate wrong POC value.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6249>
2024-03-05 23:39:43 +00:00
Xi Ruoyao 7e8873c100 gst-plugins-base: meson: Fix the condition to skip theoradec test
Due to operator priority "not a and b" is interpreted "(not a) and b".

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6260>
2024-03-05 20:13:39 +00:00
Sebastian Dröge 8859f257c2 ptp: Don't install test executable
And handle it like all our other test executables.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6262>
2024-03-05 18:55:00 +00:00
Tim-Philipp Müller 4db25f1500 rtspsrc: Consider 503 Service Not Available when handling broken control urls
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6213>
2024-03-05 17:45:18 +00:00
Tim-Philipp Müller a827c7e2b4 subprojects: track orc main branch again
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6261>
2024-03-05 13:25:19 +00:00
Tim-Philipp Müller 756064b9c3 Back to development
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6261>
2024-03-05 12:58:57 +00:00