Commit graph

1271 commits

Author SHA1 Message Date
Stian Selnes
95579a00c0 rtpvp9depay: Improve SVC parsing, aggregate all layers
- Fix start and end of picture to support multiple layers. Start of
  picture is the first packet of the base layer, while end of picture
  is when the marker bit is set (last packet of the enhancement
  layers).
- All "layers" (aka "frames") of a picture are pushed downstream in a
  single buffer when picture is complete.
- Forgive SID=0 for enhancement layers (invalid, but Chrome and
  Firefox sends it)

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/773>
2020-10-30 17:46:30 +01:00
Stian Selnes
d77fcf251b rtpvp8depay: Send lost events when marker bit is missing
This means the previous frame was incomplete.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/796>
2020-10-30 03:43:19 +01:00
Knut Saastad
fa505867a9 rtpvp9depay: detect incomplete frames and bail out
If a packet with the B bit set arrives but we haven't received
a packet with the marker or E bits set to end the previous frame,
we know the current frame was incomplete.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/795>
2020-10-30 01:31:19 +00:00
Knut Saastad
b22514d469 rtpvp9depay: detect incomplete frames and bail out
If a packet with the B bit set arrives but we haven't received
a packet with the marker or E bits set to end the previous frame,
we know the current frame was incomplete.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/769>
2020-10-29 19:56:07 +01:00
Mikhail Fludkov
346b077ae0 rtpvp*depay: possibly forward might-have-been-fec PacketLost events
This is ad adaptation of a Pexip patch for dealing with spurious
GstRTPPacketLost events caused by lost ulpfec packets: as FEC packets
under that scheme are spliced in the same sequence domain as the media
packets, it is not generally possible to determine whether a lost packet
was a FEC packet or a media packet.

When upstreaming pexip's ulpfec patches, we decided to drop all lost
events at the base depayloader level, and where the original patch
from pexip was making use of picture ids and marker bits to determine
whether a packet should be forwarded, this patch makes use of those
to determine whether they should be dropped instead (by removing their
might-have-been-fec field).

Spurious lost events coming out of the depayloader can cause the
decoder to stop decoding until the next keyframe and / or request a new
keyframe, and while this is not desirable it makes sense to forward
that information when we have other means to determine whether a lost
packet was indeed a FEC packet, as is the case with VP8 / VP9 payloads
when they carry a picture id.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/769>
2020-10-29 19:56:07 +01:00
Jan Schmidt
b066441e21 rtph264depay: Preserve SPS/PPS arrival order.
Even if SPS/PPS haven't changed, make sure to move them to the
end of the tracking array if needed, so we always know what the
most recent entries are, in case we need to discard the oldest
when generating codec_data.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/775>
2020-10-29 14:09:21 +00:00
Jan Schmidt
2623404744 rtph264depay: Warn when max SPS/PPS are collected in AVC mode.
The AVC codec_data has a flaw that it can only accomodate
31 SPS headers, even though H.264 can have 32, and 255 PPS,
when there can be 256 in H.264. When streaming RTP some
clients like to cycle through SPS/PPS ids when changing
configuration and can eventually accumulate a full set.

In that case, we have no choice but to discard one (oldest)
entry, or else the count written into the codec_data is wrong
and downstream decoding failures ensue.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/775>
2020-10-29 14:09:21 +00:00
Arun Raghavan
b4a713ff2d rtputils: Count metas with an empty tag list for copying/keeping
The GstMetaInfos registered in core do not set their tags to NULL, but
instead use an empty list (non-NULL list with a single NULL value).
Let's check explicitly for that so as to not miss some metas.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/779>
2020-10-22 09:19:53 -04:00
John-Mark Bell
3348c5ceae rtpvp8pay: payload temporally scaled bitstreams.
Co-Authored-By: Vincent Sanders <vince@pexip.com>
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/728>
2020-10-16 09:25:10 +00:00
Stian Selnes
29d5936749 rtpvp8pay: Add picture-id-offset property
Add property to set the initial value for picture-id. RFC7741 says
that picture-id MAY be initialized to a random value, thus it's also
valid to simply set it to a fixed initial value. A fixed value is very
useful for testing.

Default behavior is not changed.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/728>
2020-10-16 09:25:10 +00:00
Mikhail Fludkov
543b7e5024 rtpvp8pay: move duplicate code to separate functions
Two new functions to modify picture id:
gst_rtp_vp8_pay_picture_id_reset - picks random picture id of
appropriate bitsize
gst_rtp_vp8_pay_picture_id_increment - increments picture id taking
care of wrapping

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/728>
2020-10-16 09:25:10 +00:00
Mathieu Duponchelle
ed2b5e6cfc rtpulpfec: fix potential alignment issue in xor function
https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/753#note_646453
for context

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/753>
2020-10-08 22:22:18 +00:00
Sebastian Dröge
f95dde512c rtp: Fix allocations to support source-info property
Use gst_rtp_base_payload_allocate_output_buffer() instead of
gst_rtp_buffer_new_allocate() in order to allocate RTP buffer with
correct number of CSRCs according to the meta.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/612>
2020-09-28 15:27:17 +00:00
Stian Selnes
d494be9916 rtpvp8pay: Fix allocation to support source-info property
Use gst_rtp_base_payload_allocate_output_buffer() in order to allocate
RTP buffer with correct number of CSRCs according to the meta.

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/612>
2020-09-28 15:27:17 +00:00
Matthew Waters
ea61714c70 rtph26*depay: drop FU's without a corresponding start bit
If we have not received a FU with a start bit set, any subsequent FU
data is not useful at all and would result in an invalid stream.

This case is constructed from multiple requirements in
RFC 3984 Section 5.8 and RFC 7798 Section 4.4.3.  Following are excerpts
from RFC 3984 but RFC 7798 contains similar language.

The FU in a single FU case is forbidden:

   A fragmented NAL unit MUST NOT be transmitted in one FU; i.e., the
   Start bit and End bit MUST NOT both be set to one in the same FU
   header.

and dropping is possible:

   If a fragmentation unit is lost, the receiver SHOULD discard all
   following fragmentation units in transmission order corresponding to
   the same fragmented NAL unit.

The jump in seqnum case is supported by this from the specification
instead of implementing the forbidden_zero_bit mangling:

   If a fragmentation unit is lost, the receiver SHOULD discard all
   following fragmentation units in transmission order corresponding to
   the same fragmented NAL unit.

   A receiver in an endpoint or in a MANE MAY aggregate the first n-1
   fragments of a NAL unit to an (incomplete) NAL unit, even if fragment
   n of that NAL unit is not received.  In this case, the
   forbidden_zero_bit of the NAL unit MUST be set to one to indicate a
   syntax violation.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/730>
2020-09-21 08:08:38 +00:00
Sebastian Dröge
c90af726ab rtpmp4gdepay: Allow lower-case "aac-hbr" instead of correct "AAC-hbr"
Various live555 based products are using the wrong "mode" string or
seem to assume case-insensitive matching, which is wrong.

Examples for this are the Yuan SC6C0N1 mini and the Kiloview E2.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/727>
2020-09-18 10:02:44 +03:00
Camilo Celis Guzman
5340de5c33 rtp/vrawpay: use alloc_output_buffer from base class
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/726>
2020-09-13 23:16:10 +02:00
Zeid Bekli
3211c65a5e rtpL16depay: unref buffer on error
gst_rtp_L16_depay_process to unref buffer on wrong payload size or
reorder failure.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/702>
2020-08-24 19:43:15 +00:00
Sebastian Dröge
85a6e95c7d rtputils: Don't call NULL GstMeta transform function
It's optional and if it does not exist then no transformation is
possible.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/701>
2020-08-18 10:27:52 +03:00
Julian Bouzas
91972c91aa rtp: Do not register rtpreddec and rtpredenc twice
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/699>
2020-08-13 15:27:25 -04:00
Sebastian Dröge
e9a0307b94 rtph26[45]pay: Change default aggregate-mode to "none" for backwards compatibility
We didn't aggregate at all in previous versions and there are apparently
various RTP implementations that don't handle aggregation well at all.

As part of this also document that for RTSP it is recommended to keep it
set to "none" while for WebRTC it should be set to "zero-latency".

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/692>
2020-08-08 10:08:31 +03:00
Olivier Crête
7effe918d1 rtp*pay: Allocate using the base class for audio codecs
This is required to add RTP header extensions from the
meta automatically.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/674>
2020-07-17 16:53:40 -04:00
Mathieu Duponchelle
f63299ff2f plugins: uddate gst_type_mark_as_plugin_api() calls 2020-06-06 00:42:25 +02:00
Mathieu Duponchelle
37c619f995 plugins: Use gst_type_mark_as_plugin_api() for all non-element plugin types 2020-06-03 22:44:09 -04:00
Sebastian Dröge
db69f02dd8 rtpLXXdepay: Set the UNPOSITIONED flag on the audio-info when configuring an unpositioned layout
Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/issues/688
2020-04-03 17:57:23 +00:00
Kristofer Björkström
586fc57e55 rtpjpeg: Use gst_memory_map() instead of gst_buffer_map()
gst_buffer_map () results in memcopying when a GstBuffer contains
more than one GstMemory.
This has quite an impact on performance on systems with limited amount
of resources. With this patch the whole GstBuffer will not be mapped at
once, instead each individual GstMemory will be iterated and mapped
separately.
2020-04-03 17:01:24 +02:00
Kristofer Björkström
54b6ee0c55 buffermemory: keep track of buffer size and current offset
Added the possibility to get current offset and the total size of the
buffer.
2020-04-03 17:01:24 +02:00
Havard Graff
d9aaa15a30 rtpopuspay: make depay ! pay work
There is a use-case for a server to re-payload opus going through it.

Problem was that the payloader requires channels in the caps, but
this is not something the depayloader can parse out of the stream, meaning
caps-negotiation would fail.

Removing the requirement of channels in the template-caps fixes this.
2020-04-03 09:04:32 +00:00
Stian Selnes
81a87c26f9 rtpvp8pay, rtpvp9pay: fix caps leak in set_caps() 2020-03-12 16:49:58 +00:00
Ognyan Tonchev
a78a74bff0 rtph26x: Use gst_memory_map() instead of gst_buffer_map() in avc mode
gst_buffer_map () results in memcopying when a GstBuffer contains
more than one GstMemory and when AVC (length-prefixed) alignment is used.
This has quite an impact on performance on systems with limited amount of
resources. With this patch the whole GstBuffer will not be mapped at once,
instead each individual GstMemory will be iterated and mapped separately.
2020-03-06 10:44:16 +00:00
Kristofer Björkström
9c86414279 rtph265pay: TID for NALU type 48 was always set to 7
A typo bug: | instead of & resulted in TID alwasy being set to 7
for the aggregated NALU of type 48
2020-01-13 15:41:30 +01:00
Tim-Philipp Müller
1df530eaa7 rtpjpegdepay: outputs framed jpeg
Add parsed=true to output caps, as we always output
whole frames, timestamped and all. Means also that
the output can be decoded by avdec_mjpeg wihout
plugging an extra parser (which has no rank).
2019-12-04 13:02:54 +00:00
Havard Graff
a7c887b197 rtpL16depay: don't crash if data is not modulo channels*width 2019-12-03 00:02:48 +00:00
Havard Graff
690c15bd78 rtpopuspay: use baseclass allocator for buffers
That way we get some of the meta -> rtp-extension goodies.
2019-12-02 13:05:12 +01:00
Niels De Graef
7cf4ab6229 Don't pass default GLib marshallers for signals
By passing `NULL` to `g_signal_new` instead of a marshaller, GLib will
actually internally optimize the signal (if the marshaller is available
in GLib itself) by also setting the valist marshaller. This makes the
signal emission a bit more performant than the regular marshalling,
which still needs to box into `GValue` and call libffi in case of a
generic marshaller.

Note that for custom marshallers, one would use
`g_signal_set_va_marshaller()` with the valist marshaller instead.
2019-11-17 15:32:30 +00:00
Tim-Philipp Müller
c9a47c0c8d Remove autotools build system 2019-10-14 11:04:18 +01:00
Aaron Boxer
46989dca96 documentation: fix a number of typos 2019-10-05 22:38:11 +00:00
Sebastian Dröge
2a4d0a9b09 rtpvp8depay: Add property for waiting until the next keyframe after packet loss
If VP8 is not encoded with error resilience enabled then any packet loss
causes very bad artefacts when decoding and waiting for the next
keyframe instead improves user experience considerably.
2019-08-12 17:10:20 +00:00
Marc Leeman
d365c4fdf9 rtpmp4vpay: config-interval -1 send at idr
adjust/port from rtph264pay and allow sending the configuration data at
every IDR

The payloader was stripping the configuration data when the
config-interval was set to 0. The code was written in such a way !(a >
0) that it stripped the config when it was set at -1 (send config_data
as soon as possible).

This resulted in some MPEG4 streams where no GOP/VOP-I was detected to
be sent out without configuration.
2019-08-01 14:28:04 +00:00
Knut Andre Tidemann
dbd7234191 rtp: opuspay: fix memory leak in gst_rtp_opus_pay_setcaps.
The src caps were never dereferenced, causing a memory leak.
2019-07-22 10:33:41 +02:00
Olivier Crête
061afa33ee rtph265pay: Also immediately send packet if it is a suffix NAL
Immediately send packet if it contains any suffix NAL, this is required
in case they come after the VCL nal to not have to wait until the next frame.
2019-07-03 19:05:29 +00:00
Olivier Crête
43e83695fd rtph265pay: Don't drop second byte of NAL header
At least keep 2 bytes per NAL even if the second one is 0, the
second byte of the NAL header could very well be 0.
2019-07-03 19:05:29 +00:00
Olivier Crête
6fed30c48e rtph26xpay: Avoid print when there is no bundle at end of packet 2019-07-03 19:05:29 +00:00
Olivier Crête
97f2fb4cc8 rtph26xpay: Wait until there is a VCL or suffix NAL to send
With unit tests.
2019-07-03 19:05:29 +00:00
Olivier Crête
1b32cb1eae rtph265pay: Implement Aggregation packets
Align with rtph264pay
2019-07-03 19:05:29 +00:00
Olivier Crête
5a9b602c9e rtph264pay: Report latency when in maximal aggregation mode 2019-07-03 19:05:29 +00:00
Olivier Crête
cede4f993d rtph264pay: Default to not adding latency when aggregating
Send the bundle as soon as there is one VCL unit in the packet at
the end of an incoming buffer.

The DELTA_UNIT flag is not reliable, so ignore it.
2019-07-03 19:05:29 +00:00
Olivier Crête
13d25583db rtph265pay: Replace fragmentation while-loop with for-loop
Align with rtph264pay
2019-07-03 19:05:29 +00:00
Olivier Crête
9be70dc360 rtph265pay: Rename payload_len to max_fragment_size
Align to rtph264pay
2019-07-03 19:05:29 +00:00
Olivier Crête
34c23bdc5d rtph265pay: Clean up _payload_nal
Move determining whether we need to fragment at all into the
fragmenter.

Align with rtph264pay
2019-07-03 19:05:29 +00:00