Commit graph

10380 commits

Author SHA1 Message Date
Nirbheek Chauhan
95f6c31c21 rtph265depay: update codec_data in caps regardless of format
Updating of codec_data in the caps is important to propagate changes
in sps/pps/vps via NALs. Without this, downstream does not renegotiate
when upstream changes resolution.

The comment referring to rtph264pay is from 2015 and is out of date.
rtph264pay stopped doing that in 2017 with commit
dabeed52a9

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/1011>
2021-06-16 16:35:07 +05:30
Tim-Philipp Müller
21c90afd92 qtdemux: use g_memdup2() as g_memdup() is deprecated
- atom nodes/bytereader sizes are already checked
- palettes: are fixed/known size

g_memdup() is deprecated since GLib 2.68 and we want to avoid
deprecation warnings with recent versions of GLib.

Also use gst_buffer_new_memdup() instead of _wrapped(g_memdup(),..).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/993>
2021-06-02 17:34:38 +01:00
Tim-Philipp Müller
05854f74c5 matroskademux: use g_memdup2() as g_memdup() is deprecated
- ebml-read: add some sanity checks when going from 64-bit
  to 32-bit length
- matroska-ids: codec_data_size has been checked via
  gst_ebml_read_binary(), is existing allocation.
- matroska-demux: alloc size is from existing allocations

g_memdup() is deprecated since GLib 2.68 and we want to avoid
deprecation warnings with recent versions of GLib.

Also use gst_buffer_new_memdup() instead of _wrapped(g_memdup(),..).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/993>
2021-06-02 17:34:38 +01:00
Tim-Philipp Müller
aa4448cdd6 rtpjpegpay: fix image corruption when compiled with MSVC on Windows
On Windows with MSVC, jpeg_header_size would end up 2 bytes larger
than it should be. This then leads to the first 2 bytes of the
actual jpeg image data to be dropped, because we think those
belong to the header, which results in an undecodable image when
reconstructed in the depayloader.

What happens is that when the compiler evaluates

  jpeg_header_size = mem.offset + read_u16_and_inc_offset_by_2(&mem);

it actually uses the mem.offset value after it has been increased
by the function call on the right hand size of the equation.

From section 6.5 of the C99 spec:

  3. The grouping of operators and operands is indicated by the syntax [74].
     Except as specified later (for the function-call (), &&, ||, ?:, and
     comma operators), the order of evaluation of subexpressions and the
     order in which side effects take place are both unspecified.

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/999>
2021-05-29 14:31:34 +01:00
Seungha Yang
80567ca939 deinterlace: Drop "field-order" field while transforming caps
Like other basetransform subclasses are doing, drop field
which can be converted by deinterlace.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/997>
2021-05-27 12:58:30 +00:00
Seungha Yang
9a8aea4a6a deinterlace: Drop field-order field if outputting progressive
Progressive with field-order doesn't make sense

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/997>
2021-05-27 12:58:30 +00:00
Havard Graff
26c94af2ea rtpssrcdemux: fix "data flow before segment event" crash
This crash could happen at any time a RTP and RTCP buffer arrived
simultaneously in ssrcdemux.

The problem was that sticky-event arriving while the rtp and rtcp pads
were being set up could arrive just too late to be included in the initial
forwarding.

The fix checks if the stickies have been sent on the srcpad about to be
pushed on, and if not sends them. It also blocks any stickes from
being forwarded *prior* to this happening, to avoid them arriving on
the srcpad multiple times.

Since the test loops 1000 times, this will make running under valgrind
take forever, so use the RUNNING_ON_VALGRIND variable to detect we
are running under valgrind, and reduce the loop-count to 2 in that case.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/992>
2021-05-25 22:04:41 +00:00
Havard Graff
de3a3882e9 rtpssrcdemux: refactor destruction of GstRtpSsrcDemuxPads
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/992>
2021-05-25 22:04:41 +00:00
Havard Graff
c721c6fe72 rtpssrcdemux: make naming consistent
Use plural for GstRtpSsrcDemuxPads, since it contains two pads, and
use the variable-name 'dpads' everywhere.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/992>
2021-05-25 22:04:41 +00:00
Tim-Philipp Müller
80966ed0a3 wavparse: use g_strndup() for copying text data
So we don't rely on NUL terminators inside the data.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/994>
2021-05-23 15:20:16 +01:00
Tim-Philipp Müller
5353ff355f wavparse: clean up adtl/note/labl chunk parsing
We were passing the size of the adtl chunk to the note/labl
sub-chunk parsing function, which means we may memdup lots of
data after the chunk string's NUL terminator that doesn't
really belong to it.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/994>
2021-05-23 15:19:41 +01:00
Tim-Philipp Müller
3dd8de1d7c wavparse: guard against overflow when comparing chunk sizes
Could be rewritten as lsize > (size - 8) a well, but the
extra check seems clearer. Doesn't look like it was problematic,
lsize wasn't actually used when parsing the sub-chunks.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/994>
2021-05-23 15:17:27 +01:00
Stéphane Cerveau
918d882021 matroskademux: fix decoder glitches with H264 content
To avoid decoder starvation causing glitches on screen,
the demuxer shall clip only when the buffer is a key frame
and the lace time is greater than the stop time.

Fixes gst-editing-services#128

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/973>
2021-05-20 15:07:07 +02:00
Nicolas Dufresne
d877f7f816 matroskademux: Advertise codec-alpha in caps
This will be used to select the appropriate decoders. We also only attach the
GstVideoCodecAlphaMeta if the AlphaMode element is set, this is to stay on the
safe side and mimic what browsers (verified in Firefox and Chromium code) do.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/968>
2021-05-11 16:52:22 -04:00
Nicolas Dufresne
b2e857efc6 matroskademux: Store alpha stream in VideoCodecAlphaMeta
This generalize the feature over using mini object quark data. If
that feature was Matroska specifc, using the new CustomMeta would have
been enough and arguably cleaner then QData, though it seems that
similar technique is use with AV1 Image Format (AVIF).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/968>
2021-05-11 16:06:44 -04:00
Tim-Philipp Müller
b84bad6ac3 matroska-demux: extract VP8 alpha from BlockAdditionals
And put it on buffers as qdata (which is easier in this
case than a private custom meta because it can be picked
up easily in other modules).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/968>
2021-05-11 16:06:44 -04:00
Jan Alexander Steffens (heftig)
0ff50d6723 udpsrc: Plug leaks of saddr in error cases
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/977>
2021-05-07 10:09:38 +00:00
Jan Alexander Steffens (heftig)
e425bcada5 udpsrc: Whitespace
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/977>
2021-05-07 10:09:38 +00:00
Jan Alexander Steffens (heftig)
fa1cc0a81f deinterlace: Plug a method subobject leak
Changing the method would leak the previous method.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/976>
2021-05-07 09:31:48 +00:00
David Fernandez
056f8ce6ca matroska-mux: Change accepted caps width and height from [16, MAX] to [1, MAX]
There are cases where the video size might be less than 16x16.
This change allows the Matroska muxer to accept this cases.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/539>
2021-05-05 16:31:33 -04:00
François Laignel
39f0905a7e Use gst_element_request_pad_simple
Instead of the deprecated gst_element_get_request_pad.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/958>
2021-05-05 06:17:20 +00:00
Jan Schmidt
7c5f2185a9 qtmux: Make sure to write 64-bit STCO table when needed.
qtmux attempts to choose between writing a 32-bit stco chunk offset table
when it can, but switch to a 64-bit co64 table when file offsets go over
4GB.

This patch fixes a problem where the atom handling code was checking
mdat-relative offsets instead of the final file offset (computed by
adding the mdat position plus the mdat-relative offset) - leading to
problems where files with a size between 4GB and 4GB+offset-of-the-mdat
would write incorrect STCO tables with some samples having truncated
32-bit offsets.

Smaller files write STCO correctly, larger files would switch to
co64 and also output correctly.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/970>
2021-04-30 08:12:47 +10:00
Guillaume Desmottes
5fa3325335 rtpopuspay: set MARKER flag
Set MARKER flag on first buffer after DTX.

According to RFC 3551 section 4.1 the marker bit needs to be set on
"the first packet after a silence period during which packets have
not been transmitted contiguously".

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/967>
2021-04-26 15:25:56 +02:00
Guillaume Desmottes
41ba8c1b00 rtpopuspay: add DTX support
If enabled, the payloader won't transmit empty frames.

Can be tested using:
  opusenc dtx=true bitrate-type=vbr ! rtpopuspay dtx=true

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/967>
2021-04-26 15:25:56 +02:00
Havard Graff
d75c678479 rtpjitterbuffer: fix divide-by-zero
The estimated packet-duration can sometimes end up as zero, and dividing
by that is never a good idea...

The test reproduces the scenario, and the fix is easy.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/966>
2021-04-25 02:21:04 +02:00
Havard Graff
1368b4214b rtpjitterbuffer: clean up and improve missing packets handling
* Try to make variable and function names more clear.
* Add plenty of comments describing the logic step-by-step.
* Improve the logging around this, making the logs easier to read and
  understand when debugging these issues.

* Revise the logic of packets that are actually beyond saving in doing
  the following:
1. Do an optimistic estimation of which packets can still arrive.
2. Based on this, find which packets (and duration) are now hopelessly
   lost.
3. Issue an immediate lost-event for the hopelessly lost and then add
   lost/rtx timers for the ones we still hope to save, meaning that if
   they are to arrive, they will not be discarded.

* Revise the use of rtx-delay:
  Earlier the rtx-delay would vary, depending on the pts of the latest
  packet and the estimated pts of the packet it being issued a RTX for,
  but now that we aim to estimate the PTS of the missing packet accurately,
  the RTX delay should remain the same for all packets.
  Meaning: If the packet have a PTS of X, the delay in asked for a RTX
  for this packet is always a constant X + delay, not a variable one.

* Finally ensure that the chaotic "check-for-stall" tests uses timestamps
  that starts from 0 to make them easier to debug.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/952>
2021-04-24 13:53:58 +00:00
Guillaume Desmottes
309269a93b level: make properties thread-safe
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/962>
2021-04-23 15:14:44 +02:00
Guillaume Desmottes
f61bd6239a level: disable passthrough when audio-level-meta is enabled
Ensure we receive a writable buffer to add the meta.

Fix #878

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/962>
2021-04-23 11:41:36 +02:00
Sebastian Dröge
c0d68d03a6 matroskamux: Don't pass a non-GObject pointer to GST_DEBUG_OBJECT and similar
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/964>
2021-04-23 08:28:06 +03:00
Edward Hervey
4d3b8d1129 rtpjitterbuffer: Avoid generation of invalid timestamps
When updating timestamps and timer timeouts with a new offset, make sure that
the resulting value is valid (and not a negative (signed) value which ends up in
a massive (unsigned) value).

Fixes #571

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/960>
2021-04-22 15:23:13 +02:00
Doug Nazar
b705fb93be rtspsrc: Fix race saving seek event seqnum.
We need to save the seek seqnum before the flush stop event
since that will start the basesrc task which may send the segment
event before we're ready.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/954>
2021-04-20 06:03:22 +00:00
Doug Nazar
61d4dd0b9b rtpsbcpay: remove use of packed struct for payload
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/950>
2021-04-15 07:29:09 -04:00
Doug Nazar
850a6f5f6f dtmf: convert to bit accessors
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/949>
2021-04-14 11:13:45 -04:00
Nirbheek Chauhan
c071cbbe30 rtspsrc: Remove some dead code
stop is not used after this point, nor do we create a new segment
here since 84725d62b5

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/940>
2021-04-13 14:30:54 +00:00
Nirbheek Chauhan
fb97ca9458 rtspsrc: Do not overwrite the known duration after a seek
This breaks the duration query and also the seeking query.

Broke in 5f1a732bc7

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/940>
2021-04-13 14:30:54 +00:00
Nirbheek Chauhan
99ee5fb2d9 rtspsrc: Just assign the segment instead of memcpy
Assignments copy by value, we don't need to memcpy...

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/940>
2021-04-13 14:30:54 +00:00
Sebastian Dröge
52ead086d9 rtpjitterbuffer: Check srcresult before waiting on the condition variable too
It might've been set to FLUSHING between the last check and the waiting,
and in that case we'd be waiting here forever now.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/944>
2021-04-13 12:30:49 +00:00
Doug Nazar
b5deff7b64 rtp: fix rtptwcc to support big endian.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/942>
2021-04-13 11:35:15 +00:00
Doug Nazar
7918f80a43 rtp: fix rtphdrextrfc6464 to support big endian.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/942>
2021-04-13 11:35:15 +00:00
Jan Schmidt
fae29cb3c2 qtmux: Protect against writing absurd sample durations
If the input DTS goes backward or is missing, the calculated
sample duration goes negative and wraps around to a very big
number. In that case, just write a sample with a duration of
0 and hope the problem is transient.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/914>
2021-04-13 00:18:36 +10:00
Nirbheek Chauhan
590fbb4ddd rtspsrc: De-dup seek event seqnums to avoid multiple seeks
Seek events are sent upstream on each sink, so if we receive multiple
seeks with the same seqnum, we must only perform one seek, not N seeks
where N = the number of sinks in the pipeline connected to rtspsrc.

This is the same thing done by demuxers like qtdemux or matrsokademux.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/938>
2021-04-12 03:32:08 +00:00
Nirbheek Chauhan
57e4eab72d rtspsrc: Using multicast UDP has no relation to seekability
The transport has no relation to whether a media can be seeked. The
range response having a duration is the correct thing to check for.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/939>
2021-04-12 02:56:44 +00:00
Nirbheek Chauhan
b1dcbf393b rtspsrc: Add more logging for range parsing and seekable
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/939>
2021-04-12 02:56:44 +00:00
Markus Ebner
7276b0f9d1 videocrop: Add support for GBR* video formats
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/515>
2021-04-10 11:26:59 +00:00
Markus Ebner
e31cbce4d5 videocrop: Added support for planar pixel formats > 8bits
- Added support for planar pixel formats with depths greater than 8bits
  to transform_planar implementation
- Added a whole lot of new pixel formats to the support-list

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/515>
2021-04-10 11:26:59 +00:00
Markus Ebner
3ba8abb056 videocrop: Move supported format list into private header
- Moved declaration of supported pixel formats to private header, which
  can be shared between videocrop and aspectvideocrop

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/515>
2021-04-10 11:26:59 +00:00
Nirbheek Chauhan
c8827acb93 rtpjitterbuffer: More logging when calculating rfc7273 timestamps
This code can be fragile, since it is very exacting in the timestamps
that it will accept. Add more logging so it's easier to debug issues
and figure out whether it's a bug in the calculation or something
wrong in the incoming buffers.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/934>
2021-04-09 12:48:02 +05:30
Stéphane Cerveau
0935c7efbb rtp: missing debug init after element splitting
- h264depay
- h265depay
- sv3vdepay

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/936>
2021-04-08 14:02:46 +02:00
Michal Dzik
8e8b22174d rtp: rename gst_rtp_sbc_pay_flush_buffers()
gst_rtp_sbc_pay_flush_buffers() is a misleading name. A better name would
be gst_rtp_sbc_pay_drain_buffers(), because that's what it does, it drains
any leftover queued data and pushes it downstream. "Flushing" in GStreamer
typically means to throw away any queued data and not process/push it
downstream.

Signed-off-by: Michal Dzik <michal.dzik@streamunlimited.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/700>
2021-04-08 08:46:34 +00:00
Michal Dzik
680722bbfa rtp: fix adapter flushing in sbc payloader
GstAdapter must be flushed in some cases (flush, new segment, state change)
Without it, it may, for example, push some leftover buffer from old
segment in new segment. This, in general, breaks timestamps.
See GstAdapter documentation for more.

Signed-off-by: Michal Dzik <michal.dzik@streamunlimited.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/700>
2021-04-08 08:46:34 +00:00