Commit graph

51 commits

Author SHA1 Message Date
Stéphane Cerveau
80f8780e92 rtp: allow per feature registration
Split plugin into features including
dynamic types which can be indiviually
registered during a static build.

More details here:

https://gitlab.freedesktop.org/gstreamer/gst-build/-/merge_requests/199
https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/661

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/876>
2021-03-29 12:45:22 +02: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
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
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
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
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
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
Olivier Crête
f5765ccf05 rtph265pay: Extract sending fragments into _payload_nal_fragment
Align with rtph264pay
2019-07-03 19:05:29 +00:00
Olivier Crête
378c422e0c rtph265pay: Extract sending a single packet into _payload_nal_single
Align with rtph264pay
2019-07-03 19:05:29 +00:00
Olivier Crête
b841fd4c8a rtph265pay: Define and use FU_A_TYPE_ID
Align with rtph264pay
2019-07-03 19:05:29 +00:00
Olivier Crête
a6d50889af rtph265pay: Use snake_case variables
Align with rtph264pay
2019-07-03 19:05:29 +00:00
Olivier Crête
d4268ab2bf rtph265pay: Clean up whitespace and syntax
Align with rtph264pay
2019-07-03 19:05:29 +00:00
Thibault Saunier
0a6a62aa76 docs: Port all docstring to gtk-doc markdown 2019-05-13 10:24:40 -04:00
Jan Alexander Steffens (heftig)
06b2bbd8c7 rtph265pay: Only mark the last fragment of an AU
Commit e721071dca removed the check for
the end of fragmentation. As a result, all fragments of an AU's last
NALU were marked.
2019-01-09 15:36:40 +00:00
Nicolas Dufresne
05059ce16b rtph264pay/rtph265pay: Fix use after free
We can't assume a buffer that has been pushed in the adapter is still
valid. This fixes a use after free detect when running test on jenkins.
2018-12-19 13:54:57 -05:00
Nicolas Dufresne
d397cf6d1f rtph265pay: Don't wait for next nal when input is aligned
This is the same as what was done on rtph264pay in the patch
d5d28055c1
2018-12-18 13:39:54 -05:00
Nicolas Dufresne
5e8cab71ea rtph26xpay: Remove unused IS_ACCESS_UNIT macro
This macro is not longer used. It was secretly checking if that nal was
a slice, and confusingly name to that one may think it was checking if
the nal is an AUD.
2018-12-18 13:39:46 -05:00
Nicolas Dufresne
0a6e5e439c rtph265pay: Fix reading timestamps from adapter
The code was reading the timestamp from the adapter before pushing the
new buffer into it. As a side effect, if the adapter was empty, we'd end
up using an older timestamp. In alignment=au, it means that all
timestamp was likely one frame in the past, while in alignment=nal, with
multiple slices per frame, the first slice would have the timestamp of
the previous one.
2018-12-18 13:30:05 -05:00
Nicolas Dufresne
e721071dca rtph265pay: Properly set the marker bit
The marker bit is used for efficient decoding. The assumption that
it should be set on the AUD is wrong, since the AUD is conceptually
starts the frame, while the marker is to indicate the end.

So properly set the marker bit as soon as we know we are ending an
AU and also whenever upstream have set the GST_BUFFER_FLAG_MARKER
flag.
2018-12-18 13:30:05 -05:00
Jan Alexander Steffens (heftig)
20758215b5 rtph26*pay: Update param set timestamp even if parameters unchanged
rtph264pay and rtph265pay skip updating the parameter set timestamp if
the units they see contain no new configuration. This can result in
them injecting duplicate parameters.

https://bugzilla.gnome.org/show_bug.cgi?id=796748
2018-08-16 16:49:16 +03:00
Sebastian Dröge
f3631e6837 rtp: Use running_time instead of PTS for config-interval calculations
PTS can start again from a different offset while the running time is
increasing. The only thing that matters here is the running time.

https://bugzilla.gnome.org/show_bug.cgi?id=796807
2018-07-24 18:14:28 +03:00
Tim-Philipp Müller
b84201bf81 rtph265pay: don't add trailing zeros to VPS/PPS/SPS
This would happen if input is byte-stream with four-byte
sync markers instead of three-byte ones. The code that
scans for sync markers will place the start of the NALU
on the third-last byte of the NALU sync marker, which
means that any additional zeros may be counted as belonging
to the previous NALU instead of being part of the next sync
marker. Fix that so we don't send VPS/SPS/PPS with trailing
zeros in this case.

See https://bugzilla.gnome.org/show_bug.cgi?id=732758
2017-11-23 09:36:15 +01:00
Tim-Philipp Müller
4a28e649c3 rtp: cache meta tag quarks and add more utility functions for metas
Every g_quark_from_static_string() is a hash table lookup serialised
on the global quark lock in GLib. Let's just look up the two quarks
we need once and cache them locally for future use. While we're at it,
add new utility functions for the two most commonly used tags
(audio + video). Make first argument a gpointer so we don't have to
cast and make the code ugly. These are used for logging purposes
only anyway.
2017-05-24 13:32:10 +01:00
Jonas Holmberg
494246f75c rtph265pay: Fix handling of config-interval
Insert VPS/SPS/PPS before the first NAL unit containing an I-frame in an
access unit only. If an access unit consists of several such NAL units
(tiles) VPS/SPS/PPS should only be inserted before the first of them so
that parameters are only updated between frames.

Do not insert VPS/SPS/PPS before P-frames when config-interval is -1.

https://bugzilla.gnome.org/show_bug.cgi?id=775817
2017-01-23 12:59:15 +02:00
Jonas Holmberg
e43dcd9996 rtph265pay: Set RTP marker bit
Set the RTP marker bit on the last RTP packet of an H.265 access unit.

https://bugzilla.gnome.org/show_bug.cgi?id=770394
2016-08-25 17:22:58 +03:00
Sebastian Dröge
3010d1ec2d rtp: Filter with the filter caps in the payloader's getcaps 2016-07-25 13:35:18 +03:00
Jonas Holmberg
833c530553 rtph265pay: Accept array_completeness=1
When parsing NAL unit type in codec_data, check the 6bits of
NAL_unit_type only and do not require the array_completeness bit to be
0, since the default and mandatory value of array_completeness is 1 for
hvc1.

https://bugzilla.gnome.org/show_bug.cgi?id=768653
2016-07-11 11:49:41 +03:00
Jonas Holmberg
a06152c40a rtph265pay/depay: Sync against RFC 7798
Handle sprop-vps, sprop-sps and sprop-pps in caps instead of
sprop-parameter-sets.

rtph265pay works with byte-stream and hvc1 formats but not hev1 yet. It
handles profile-id, tier-flag and level-id in caps query.

https://bugzilla.gnome.org/show_bug.cgi?id=753760
2016-07-07 14:59:50 +03:00
Jonas Holmberg
83ec89abdd rtph265pay: Remove sprop-parameter-sets property
There is no valid use case when this property is needed since the values
must be in either codec_data or buffer data.

https://bugzilla.gnome.org/show_bug.cgi?id=753760
2016-06-17 15:25:57 +03:00
Jonas Holmberg
2039e0d881 rtph265pay: Read NALU type the same way everywhere
Cosmetic change to read NALU type in gst_rtp_h265_pay_decode_nal() the
same way as in other places.

https://bugzilla.gnome.org/show_bug.cgi?id=753760
2016-06-17 15:25:57 +03:00
Jürgen Slowack
98b62e397b rtph265: fix NAL unit type parsing and SPS/PPS/VPS detection
Fixes sps/pps/vps insertion via the config-interval property.

https://bugzilla.gnome.org//show_bug.cgi?id=767680
2016-06-15 13:10:50 +01:00
Vineeth TM
1071309870 good: use new gst_element_class_add_static_pad_template()
https://bugzilla.gnome.org/show_bug.cgi?id=763076
2016-03-24 14:32:20 +02:00
Tim-Philipp Müller
7f9f3d38b2 rtp: h265: use common meta utility functions
https://bugzilla.gnome.org/show_bug.cgi?id=761606
2016-02-16 00:25:46 +00:00
Luis de Bethencourt
4ee6c17edb rtph265pay: add "send VPS/SPS/PPS with every key frame" mode
It's not enough to have timeout or event based VPS/SPS/PPS information
sent in RTP packets. There are some scenarios when key frames may appear
more frequently than once a second, in which case the minimum timeout
for "config-interval" of 1 second for sending VPS/SPS/PPS isn't enough.
It might also be desirable in general to make sure the VPS/SPS/PPS is
available with every keyframe (packet loss aside), so receivers can
actually pick up decoding immediately from the first keyframe if
VPS/SPS/PPS is not signaled out of band.

This commit adds the possibility to send VPS/SPS/PPS with every key frame.
This mode can be enabled by setting "config-interval" property to -1. In
this case the payloader will add VPS, SPS and PPS before every key (IDR)
frame.

https://bugzilla.gnome.org/show_bug.cgi?id=757892
2016-02-16 00:24:41 +00:00
Luis de Bethencourt
64ca3b26d9 rtph265pay: change config-interval property type from uint to int
This way we can use -1 as special value, which is nicer than MAXUINT.

https://bugzilla.gnome.org/show_bug.cgi?id=757892
2016-02-16 00:24:41 +00:00
Luis de Bethencourt
1e55d0d725 rtph265pay: Copy metadata in the payloader, but only the relevant ones
The payloader didn't copy anything so far, the depayloader copied every
possible meta. Let's make it consistent and just copy all metas without
tags or with only the video tag.

https://bugzilla.gnome.org/show_bug.cgi?id=751774
2016-02-16 00:24:41 +00:00
Luis de Bethencourt
8611645af6 rtph265pay: Use GST_WARNING_OBJECT() instead of GST_WARNING()
https://bugzilla.gnome.org/show_bug.cgi?id=753228
2016-02-16 00:24:41 +00:00
Luis de Bethencourt
df724c410b rtph265pay: fix potential crash when shutting down
A race condition in the state change function may cause buffers to be
unreffed while they are still used by the streaming thread in
gst_rtp_h265_pay_send_vps_sps_pps() resulting in a crash. Chain up to the
parent class first in the state change function to make sure streaming
has stopped and only then free those buffers.

https://bugzilla.gnome.org/show_bug.cgi?id=741381
2016-02-16 00:24:41 +00:00
Luis de Bethencourt
f2bae3ab59 rtph265pay: fix buffer leak when using SPS/PPS
Fixes a buffer leak that would occur if the pipeline was shutdown while a
SPS/PPS header was being created.

https://bugzilla.gnome.org/show_bug.cgi?id=741271
2016-02-16 00:24:41 +00:00
Luis de Bethencourt
7ae49b46ff rtp: remove dead assignment
Value set to ret will be overwritten at least once at the end of the while
loop, removing assignment.
2016-02-16 00:24:40 +00:00
Luis de Bethencourt
693a924461 remove unused enum items PROP_LAST
This were probably added to the enums due to cargo cult programming and are
unused.
2016-02-16 00:24:40 +00:00
Luis de Bethencourt
e3d8d8cedb rtp: value truncated too short creates dead code
type is truncated to 0-31 with "& 0x1f", but right after that it is checks if
the value is equivalent to GST_H265_NAL_VPS, GST_H265_NAL_SPS, and
GST_H265_NAL_PPS (which are 32, 33, and 34 respectively). Obviously, this will
never be True if the value is maximum 31 after the truncation.
The intention of the code was to truncate to 0-63.
2016-02-16 00:24:40 +00:00