Commit graph

256 commits

Author SHA1 Message Date
Matt Crane ca7f66f9b5 rtpsession: Support disabling late adjustment of ntp-64 header ext
Currently in rtp_session_send_rtp(), the existing ntp-64 RTP header
extension timestamp is updated with the actual NTP time before sending
the packet. However, there are some circumstances where we would like
to preserve the original timestamp obtained from reference timestamp
buffer metadata.

This commit provides the ability to configure whether or not to update
the ntp-64 header extension timestamp with the actual NTP time via the
update-ntp64-header-ext boolean property. The property is also exposed
via rtpbin. Default property value of TRUE will preserve existing
behavior (update ntp-64 header ext with actual NTP time).

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1580

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3451>
2022-11-24 08:23:03 +00:00
Johan Sternerup 9794c9bfd0 Use the correct SSRC(s) when routing a RTCB FB FIR
Previously we tried to route an incoming RTCP FB FIR to the correct ssrc
using the "media source" component of the RTCP FB message. However,
according to RFC5104 (section 4.3.1.2) the "media source" SHALL be set
to 0. Instead the ssrc(s) in use are propagated via the FCI data. Now
a specific GstForceKeyUnit event is sent for every ssrc.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3292>
2022-11-23 11:31:23 +00:00
Jan Schmidt cb225b3682 rtpsource: Track the seqnum for senders
RTP source statistics are tracked for local senders by
treating them as a receiver of their own outbound packets.

Accordingly, track the highest packet seqnum so that the
packets-lost calculation generates a sensible number instead
of always reporting -$number_of_packets_sent

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3454>
2022-11-23 10:26:29 +00:00
Jan Alexander Steffens (heftig) 1d7c936db0 rtspsrc: Don't replace 404 errors with "no auth protocol found"
When getting a "404 Not Found" response from the DESCRIBE request, the
source produced a "No supported authentication protocol was found" error
instead of passing on the 404, which was confusing.

Only produce this error message when we're handling a response of "401
Unauthorized" without a compatible WWW-Authenticate header.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3414>
2022-11-22 13:07:17 +00:00
Edward Hervey f3c2f612ce rtspsrc: Don't leak sticky events
We have incremented the reference 2 lines above, and
gst_pad_store_sticky_event() does not take a reference, therefore release it

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3443>
2022-11-21 19:02:44 +00:00
Vivia Nikolaidou f29c19be58 splitmuxsink: Avoid assertion when WAITING_GOP_COLLECT on reference context
I have seen a backtrace out in the wild where this happened. Maybe after
receiving EOS and stream-start on the reference context.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3005>
2022-11-18 15:52:03 +00:00
Edward Hervey 845dcf7ec5 imagesequencesrc: Don't leak caps
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3428>
2022-11-18 07:22:23 +00:00
Matthew Waters 8e355d23a1 qtmux: use trun with multiple entries in more cases
The only case where we definitely need to write a new trun is when the
data_offset value does not match the end of the list of entries.
Needing multiple trun atoms is required when interleaving multiple
streams together.

All other cases can be covered by adding more entries to the existing
trun atom.

Fixes playback of fragemented mp4 in ffplay and chrome.

Using e.g. mp4mux fragment-duration=1000 fragment-mode=dash-or-mss
and
mp4mux fragment-duration=1000 fragment-mode=first-moov-then-finalise

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3426>
2022-11-17 21:04:57 +11:00
Nirbheek Chauhan 13723198a1 rtspsrc: Fix regression when using hostname in the location property
When the address can't be parsed as an IP address, it should just be
treated as a hostname and used as-is.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1576

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3420>
2022-11-16 11:30:26 +00:00
Sebastian Dröge 3d79402344 rtpjitterbuffer: Reschedule timers when updating their offset
As EXPECTED timers are skipped the order of the timers relative to each
other can change if there are EXPECTED timers and rescheduling needs to
happen.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1422

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3416>
2022-11-16 08:26:41 +00:00
Sanchayan Maity 02fd7fb777 wavparse: Do not run all typefinders for all output
In order to figure out if the "raw" audio contained within the wav
container is actually DTS, wavparse calls the typefinder helper
except that means it runs all typefinders.

Since it only cares about checking for DTS, we should only run the
audio/x-dts typefinder (if present). Commit 858e516 did not really
fix things.

Use the new type helper with the caps to fix this.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3417>
2022-11-16 10:32:25 +05:30
Sebastian Dröge 424e208170 rtspsrc: Consistently set seqnums on events
Set udpsrc seqnums on all events sent to the udpsrc's, and before
forwarding events out of rtspsrc set the latest seek seqnum on them if
any.

Also produce a consistent seqnum in rtspsrc from the very beginning.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3409>
2022-11-16 02:36:30 +00:00
Sebastian Dröge e6efd288c2 rtspsrc: Make segment event writable before overriding the seqnum and use the proper API to do so
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3409>
2022-11-16 02:36:30 +00:00
Sebastian Dröge 4099fd064b rtspsrc: Intercept and handle events when using no manager too
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3409>
2022-11-16 02:36:30 +00:00
Sebastian Dröge e6a2e41c06 rtspsrc: Don't blindly copy over sticky events from manager pad to external source pad
This would get around the code that modifies some events when they go
through the ghost pad's proxypad. Instead go via the event function.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3409>
2022-11-16 02:36:30 +00:00
Sebastian Dröge a4674a1e17 rtspsrc: Don't make udpsrc segment events writable just to retrieve their seqnum
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3409>
2022-11-16 02:36:30 +00:00
Sebastian Dröge b181686211 rtspsrc: Reset EOS flag also on FLUSH_STOP and not only on ssrc-active
Also don't bother not sending EOS if EOS was sent already:
gst_pad_push_event() takes care of that for us already.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3409>
2022-11-16 02:36:30 +00:00
Edward Hervey 30886fa9ea rtpjitterbuffer: Unlock timer waits on flushing
If there is a pending EOS wait for example, we would never unblock on flushing

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3401>
2022-11-15 18:30:43 +00:00
Víctor Manuel Jáquez Leal 64cb38685b matroskademux: Handle element's duration query.
This is small regression from commit f7abd81a.

When calling `gst_element_query()` no pad is associated with that query, but the
current code always forwards the query to the associated pad, which is NULL in
previous case. This patch checks for the pad before forwarding the query.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3404>
2022-11-14 15:10:44 +00:00
Colin Kinloch 99fc124f25 videocrop, videobox: Simplify navigation event handling and support touch events
Signed-off-by: Colin Kinloch <colin.kinloch@collabora.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3053>
2022-11-11 06:45:49 +00:00
Colin Kinloch d7aba91518 videoflip: Use gst_video_orientation_from_tag to parse orientation
Signed-off-by: Colin Kinloch <colin.kinloch@collabora.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3053>
2022-11-11 06:45:48 +00:00
Christian Wick 2498457b2f rtspsrc: Introduce new action signal push-backchannel-sample with correct ownership semantics
Signals are not supposed to take ownership of their arguments but only
borrow them for the scope of the signal emission.

The old action signal `push-backchannel-buffer` is now marked deprecated.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3363>
2022-11-10 13:04:04 +02:00
Justin Chadwell fd96fc23c5 qtdemux: use unsigned int types to store result of QT_UINT32
In a few cases throughout qtdemux, the results of QT_UINT32 were being
stored in a signed integer, which could cause subtle bugs in the case of
an integer overflow, even allowing the the result to equal a negative
number!

This patch prevents this by simply storing the results of this function
call properly in an unsigned integer type. Additionally, we fix up the
length checking with stsd parsing to prevent cases of child atoms
exceeding their parent atom sizes.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3344>
2022-11-06 12:00:31 +00:00
Sebastian Dröge b368a5fcd2 qtmux: Add durations to raw audio buffers from the raw audio adapter in prefill mode
This ensures that a duration can also be calculated and stored for the
last buffer at EOS.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3321>
2022-11-04 19:02:22 +00:00
Sebastian Dröge 7b60e48c8c qtmux: Release object lock before posting an error message
GST_ELEMENT_ERROR() also takes the object lock and this would then
deadlock.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3321>
2022-11-04 19:02:22 +00:00
Edward Hervey 97bfb8b6cb imagesequencesrc; Fix leaks
* The path was leaked
* The custom buffer was never freed

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3319>
2022-11-04 17:59:21 +00:00
Edward Hervey 6ffae88a9f qtdemux: Fix cenc-related leaks
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3319>
2022-11-04 17:59:21 +00:00
Edward Hervey aa61662632 deinterlace: Don't leak metas
There is no correlation between the frame being NULL and the metas not being
present.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3319>
2022-11-04 17:59:21 +00:00
Sanchayan Maity 858e516383 wavparse: Speed up type finding for DTS
In order to figure out if the "raw" audio contained within the wav
container is actually DTS, right now we call the typefinder helper
which runs all typefinders.

Speed up this type finding process by specifying the extension.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3294>
2022-10-28 19:01:26 +05:30
Matthew Waters e2081ce31e mp4mux: enable muxing VP9 streams
As specified in https://www.webmproject.org/vp9/mp4/

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3260>
2022-10-28 00:06:07 +00:00
Matthew Waters 5bed545113 qtmux: add support for writing vpcC box for VP9
Increases compatibility for VP9 in .mov in at least VLC.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3260>
2022-10-28 00:06:07 +00:00
Thibault Saunier f7abd81a45 matroskademux: Let upstream handle seeking/duration query in time if possible
So proper response are given for dash streams

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3159>
2022-10-27 19:45:44 +00:00
Thibault Saunier 8c7579e129 matroskademux: Start support for upstream segments in TIME format
So we can use matroskademux for dash webm dash streams.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3159>
2022-10-27 19:45:44 +00:00
Tim-Philipp Müller d132592423 xingmux: move from gst-plugins-ugly to gst-plugins-good
Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/issues/415

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3251>
2022-10-25 12:40:20 +00:00
Sebastian Dröge e392d9c597 rtspsrc: Only EOS on timeout if all streams are timed out/EOS
Otherwise a stream that is just temporarily inactive might time out and
then can never become active again because the EOS event was sent
already.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3238>
2022-10-24 09:19:12 +00:00
Matthew Waters 093e9c8c9d rtpulpfecdec: add property for passthrough
Support for enabling and disabling decoding of FEC data decoding on
packet loss events and unconditional seqnum rewriting of packets.

See
https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/issues/581
for background.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3212>
2022-10-23 23:44:07 +00:00
Devin Anderson 31b244271e wavparse: Avoid occasional crash due to referencing freed buffer.
We've seen occasional crashes in the `wavparse` module associated with
referencing a buffer in `gst_wavparse_chain` that's already been freed.  The
reference is stolen when the buffer is transferred to the adapter with
`gst_adapter_push` and, IIUC, assuming the source doesn't hold a reference to
the buffer, the buffer could be freed during interaction with the adapter in
`gst_wavparse_stream_headers`.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3179>
2022-10-14 07:54:03 +00:00
Devin Anderson 4e03c5f885 wavparse: Fix crash that occurs in push mode when header chunks are corrupted
in certain ways.

In the case that a test is provided for, the size of the `fmt ` chunk is
changed from 16 bytes to 18 bytes (bytes 17 - 20 below):
```
$ hexdump -C corruptheadertestsrc.wav
00000000  52 49 46 46 e4 fd 00 00  57 41 56 45 66 6d 74 20  |RIFF....WAVEfmt |
00000010  12 00 00 00 01 00 01 00  80 3e 00 00 00 7d 00 00  |.........>...}..|
00000020  02 00 10 00 64 61 74 61                           |....data|
00000028
```

(Note that the original file is much larger.  This was the smallest sub-file
I could find that would generate the crash.)

Note that, while the same issue doesn't cause a crash in pull mode, there's a
different issue in that the file is processed successfully as if it was a .wav
file with zero samples.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3173>
2022-10-13 08:56:49 +00:00
Mathieu Duponchelle cddb0e951f splitmuxsrc: don't queue data on unlinked pads
Once a pad has returned NOT_LINKED, the part reader shouldn't let its
corresponding data queue run full and eventually (after 20 seconds)
stall playback.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3145>
2022-10-10 18:11:12 +00:00
Sebastian Dröge bd5a4d321b rtpsource: Don't do probation for RTX sources
Disable probation for RTX sources as packets will arrive very
irregularly and waiting for a second packet usually exceeds the deadline
of the retransmission.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/issues/181

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3112>
2022-10-10 14:56:18 +00:00
Sebastian Dröge 72b6dabd32 rtpsession: Remember the corresponding media SSRC for RTX sources
This allows timing out the RTX source and sending BYE for it when the
actual media source belonging to it is timed out.

This change only applies to sending sources from this session.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/issues/360

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3112>
2022-10-10 14:56:17 +00:00
Sebastian Dröge d5c072fadd rtpsource: Rename rtp_source_update_caps to rtp_source_update_send_caps
To make it clear that this is only used for sending RTP sources.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3112>
2022-10-10 14:56:17 +00:00
Sebastian Dröge 97a47341a7 rtpsession: Rename gst_rtp_session_sink_setcaps to gst_rtp_session_setcaps_recv_rtp
to make it clearer that this is for setting receiver caps and to make it
more consistent with gst_rtp_session_setcaps_send_rtp.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3112>
2022-10-10 14:56:17 +00:00
Sebastian Dröge bacd92274d rtspsrc: Retry SETUP with non-compliant URL resolution on "Bad Request" and "Not found"
Various RTSP servers/cameras assume base and control URL to be simply
appended instead of being resolved according to the relative URL
resolution algorithm as mandated by the RTSP specification.

To work around this, try using such a non-compliant control URL if the
server didn't like the URL used in the first SETUP request.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1447
Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/issues/922

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3127>
2022-10-07 09:12:00 +00:00
Edward Hervey f2a1769236 qtdemux: Don't stop task when resetting
This is a regression that was introduced in
cca2f555d1 (yes, 9 years ago).

The only place where a demuxer streaming thread should be stopped is when the
sinkpad is deactivated from pull mode (i.e. PAUSED->READY).

Attempting to stop the task in this function would cause this to happen when a
FLUSH_STOP or STREAM_START event is received... which can cause deadlocks.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3109>
2022-10-03 14:41:18 +02:00
Mathieu Duponchelle f8d8d67b8b splitmuxsrc: don't consider unlinked pads when deactivating part
If splitmuxsrc exposes multiple pads, but only one is linked, part pads
will never see an EOS event. This shouldn't prevent the part from being
eventually deactivated.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3099>
2022-10-01 02:33:08 +00:00
Nirbheek Chauhan 0aa9d8ade6 rtspsrc: Fix usage of IPv6 connections in SETUP
If the SETUP request returns an IPv6 server address in the Transport
field, we would generate an incorrect URI, and multiudpsink would fail
to initialize:

```
     rtspsrc gstrtspsrc.c:9780:dump_key_value:<source>    key: 'Transport', value: 'RTP/AVP;unicast;source=fe80::dc27:25ff:fe5e:bd13:8080;client_port=62696-62697;server_port=4000-4001'
...
     rtspsrc gstrtspsrc.c:4595:gst_rtspsrc_stream_configure_udp_sinks:<source> configure RTP UDP sink for fe80::dc27:25ff:fe5e:bd13:8080:4000
...
multiudpsink gstmultiudpsink.c:1229:gst_multiudpsink_configure_client:<udpsink0> error: Invalid address family (got 23)
```

We can't look at stream->is_ipv6 because we can't rely on the server
returning the right value there. In the issue reported about this,
server reported itself as `KuP RTSP Server/0.1`, and the SDP was:

```
c=IN IP4
m=video 54608 RTP/AVP 96
a=rtpmap:96 H264/90000
```

So we need to parse the string value and figure out the family
ourselves.

Fixes https://gitlab.freedesktop.org/gstreamer/gstreamer/-/issues/1058

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1819>
2022-09-27 18:59:59 +00:00
Tim-Philipp Müller 02a8f9973b qtdemux: guard against timestamp calculation overflow in gap event loop
Could possibly cause an endless loop.

Fixes #1400.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3084>
2022-09-27 13:07:15 +00:00
Matt Crane e64a5b9a85 rtpjitterbuffer: Fix calculation of reference timestamp metadata
Add support for RTCP SRs that contain RTP timestamps later than the
current timestamps in the RTP stream packet buffers.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3019>
2022-09-12 20:17:08 +00:00
Sebastian Dröge 648b8f3362 rtpjitterbuffer: Make it more explicit that update_rtx_timers() takes ownership of the passed in timer
It is not valid anymore afterwards and must not be used, otherwise an
already freed pointer might be used.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2973>
2022-09-03 09:26:24 +00:00