Commit graph

41 commits

Author SHA1 Message Date
Sebastian Dröge eb641af450 rtp: Fix constant for maximum two-byte RTP header extension length
The value is stored as an 8 bit integer, with 0 meaning that there is
not data for this extension. That means that the maximum length is 255
bytes and not 256 bytes.

On the other hand, the one-byte RTP header extensions are storing the
length as a 4 bit integer with an offset of 1 (i.e. 0 means 1 byte
extension length), so here 16 is the correct maximum length.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6180>
2024-02-23 02:18:28 +00:00
Sebastian Dröge 5ec73afe75 rtpbasedepayload: Add "extensions" property for the currently enabled extensions
This works the same way as the one from `rtpbasepayload`.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6163>
2024-02-21 12:17:24 +00:00
Sebastian Dröge 08d4527d22 rtpbasepayload: Use gst_value_array_append_and_take_value() as a micro optimization
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6163>
2024-02-21 12:17:24 +00:00
Sebastian Dröge ea261a58e0 rtpbasepayload: Also notify "extensions" property when changing list during negotiation
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6163>
2024-02-21 12:17:24 +00:00
Maksym Khomenko 20f48f0fd0 rtpbasepayload: add extensions property
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5694>
2023-11-28 15:05:24 +00:00
Maksym Khomenko 4eff26ee1c rtpbasepayload: fix documentation formatting
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5694>
2023-11-28 15:05:24 +00:00
Jochen Henneberg d9cd8b375e rtpbasedepayload: Fixes for cleanup of header ext. aggregation
* Free delayed buffer on _finalize()
* Reset header aggregation cache and delayed buffer on state change
  from READY_TO_PAUSE

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5278>
2023-09-27 11:49:11 +00:00
Jochen Henneberg 372709400f rtpbasedepayload: Only aggregate RTP header extensions if in use
Right now we split the RTP header from the current buffer into a new
buffer and aggregate those buffers for later processing if the
depayloader creates an output buffer.

This is cumbersome as it happens even if none of the incoming RTP
buffers carries RTP header extensions at all just because header
aggregation has been enabled in the depayloader class.

This commit will start aggregation only in case that there really are
RTP header extensions available on an incoming RTP buffer. The check
is trivial and cheap. Once activated we keep aggregation active for
all buffers. The active state is reset on state change READY_TO_PAUSE.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5278>
2023-09-27 11:49:10 +00:00
Jochen Henneberg d086491909 rtpbasedepayload: Fixed HdrExt handling for aggregated output buffer
If a depayloader aggregates multiple RTP buffers into one buffer only
the last RTP buffer was checked for header extensions. Now the
depayloader remembers all RTP packets pushed before a output buffer is
pushed and checks all RTP buffers for header extensions.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4979>
2023-08-15 07:12:03 +02:00
Thibault Saunier b14e675a27 gir: Checkout all .gir files and check that they are updated on the CI
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3010>
2023-04-22 09:32:32 -04:00
Matt Crane b11169bd32 rtpbasedepayload: Drop redundant reference timestamp buffer meta in RTP depayloaders
Currently, when rtspsrc property add-reference-timestamp-metadata=true,
a downstream rtph264depay element will attach multiple copies of the
same GstReferenceTimestampMeta to the depayloaded media buffers. This
can have signficant performance impacts further downstream in a pipeline
like the following:

    rtspsrc add-reference-timestamp-metadata=true ! rtph264depay ! h264parse ! ... ! rtph264pay ! ...

For example, if there are 10 packet buffers for a frame of RTP H.264
video, each of those packet buffers will contain the same reference
timestamp meta. The rtph264depay element will then attach all 10
metadata to the depayloaded frame. And then later when we payload the
frame buffer again for proxying, we now have 10 more buffers each with
10 instance of the same metadata. Allocating/deallocating 100+ instances
of metadata @ 30fps for multiple streams has a pretty large performance
impact.

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3431>
2022-11-19 07:57:44 +00:00
Sebastian Dröge 47e4110a1b rtp: Add/fix various annotations
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3194>
2022-10-18 08:56:58 +00:00
Sebastian Dröge 4df3da3bab rtpbuffer: Initialize extended timestamp to the first wraparound period
This allows correct handling of wrapping around backwards during the
first wraparound period and avoids the infamous "Cannot unwrap, any
wrapping took place yet" error message.

It allows makes sure that for actual timestamp jumps a valid value is
returned instead of 0, which then allows the caller to handle it
properly. Not having this can have the caller see the same timestamp (0)
for a very long time, which for example can cause rtpjitterbuffer to
output the same timestamp for a very long time.

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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3202>
2022-10-18 06:09:08 +00:00
Thibault Saunier bc9c1e3956 meson: Namespace the plugins_doc_dep/libraries variables
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2970>
2022-09-01 21:17:35 +00:00
Thibault Saunier 3296c678b3 rtcpbuffer: Allow padding on first reduced size packets
It is valid to have the padding set to 1 on the first packet and it
happens very often from TWCC packets coming from libwebrtc. This means
that we were totally ignoring many TWCC packets.

Fix test that checked that a first packet with padding was not valid and
instead test a single twcc packet with padding to check precisely what
this patch was about.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2422>
2022-05-18 14:34:44 +00:00
Mathieu Duponchelle a03db32bbe rtpbasepayload: always store input buffer meta before negotiation
The decision to store the input buffer depends on whether extensions
are to be added to the output buffer, I assume as an optimization.

This creates an issue for subclasses that call negotiate(), where
header_exts is actually populated, from their handle_buffer()
implementation: at chain time, no header extension has been negotiated
yet, which means that we don't add extensions to the first batch of
buffers that comes out.

Keep track of whether negotiate has been called (this is different
from the negotiated field) and always store the input buffer until
then. This fixes the issue while largely preserving the optimization.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2304>
2022-04-27 08:43:30 +00:00
Sebastian Dröge fa070d20cf rtpbasepayload: Don't write header extensions if there's no corresponding input buffer for the packet
The GstRTPHeaderExtension API requires the input buffer to exist.

This can happen if the output packet is generated e.g. from a caps or
tags event like in the case for rtpgstpay.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2198>
2022-04-15 19:56:49 +03:00
Sebastian Dröge c1a3aaa3ec Fix transfer gobject-introspection annotation typos
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2160>
2022-04-12 12:43:08 +00:00
Mathieu Duponchelle 4c98e2d289 rtpbasepayload: fix transfer annotation for push and push_list
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2133>
2022-04-08 07:20:31 +00:00
Nirbheek Chauhan 1ae7ea508d rtpbuffer: The out args for rtp extension data are optional
The code checks that these are != NULL before dereferencing them.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1962>
2022-03-16 02:48:34 +00:00
Nirbheek Chauhan 146111d7c2 rtpbasepayload: Remove dead twcc code
This feature was removed in 7a53fbad68,
but this code was left behind.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1902>
2022-03-10 11:27:49 +00:00
Sebastian Dröge 2d134c0432 rtpbasepayload: Copy all buffer metadata instead of just GstMetas for the input meta buffer
This gives RTP header extensions some more metadata to work from.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1774>
2022-02-22 10:54:23 +02:00
Sebastian Dröge adf80ad1a7 rtphdrext: Return non-floating references from gst_rtp_header_extension_create_from_uri()
The header extension objects are never getting a parent object and using
floating references only complicates usage, especially via dynamic API
like signals.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1582>
2022-01-27 14:43:41 +00:00
Sebastian Dröge 2584cd90e3 rtphdrext: Use set_metadata() instead of set_static_metadata()
The latter needs a static string.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1583>
2022-01-27 14:27:16 +02:00
Tim-Philipp Müller b53ea86ab0 rtphdrext: increase GstRTPHeaderExtensionClass padding to LARGE
https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/748#note_1223253

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1537>
2022-01-19 05:41:40 +00:00
Matthew Waters 49af6a831d tests/rtp/payload: add test for shrinking extension data
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1146>
2021-10-19 03:26:57 +00:00
Matthew Waters b7d4d371f9 rtp: also support shrinking the extension data
Currently the extension data length specified in the RTP header would
say it was shorter then the data serialised to a packet. When
combining the resulting buffer, the underlying memory would still
contain the extra (now 0-filled) padding data.

This would mean that parsing the resulting RTP packet would potentially
start with a number of 0-filled bytes which many RTP formats are not
expecting.

Such usage is found by e.g. RTP header extension when allocating the
maximum buffer (which may be larger than the written size) and shrinking
to the required size the data once all the rtp header extension data has
been written.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1146>
2021-10-19 03:26:57 +00:00
Tim-Philipp Müller cf9be70946 gst-plugins-base: define G_LOG_DOMAIN for all libraries
Fixes #634

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1009>
2021-10-19 00:12:25 +00:00
Thibault Saunier 6e79932ad9 meson: List libraries and their corresponding gir definition
Introduces a `libraries` variable that contains all libraries in a
list with the following format:

``` meson
libraries = [
    [pkg_name, {
        'lib': library_object
        'gir': [ {full gir definition in a dict } ]
    ],
    ....
]
```

It therefore refactors the way we build the gir so that we can reuse the
same information to build them against 'gstreamer-full' in gst-build
when linking statically

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1093>
2021-10-15 19:27:30 -03:00
Thibault Saunier e2dd28a753 meson: Mark files as files()
Making it more robust and future proof

And fix issues that it creates

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1093>
2021-10-15 19:27:30 -03:00
Olivier Crête 7abd83dfea rtphdrext: Give "inherited" direction in set_attributes
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/906>
2021-09-28 20:04:55 +00:00
Olivier Crête 6cd483d17a rtphdrext: Use NULL-safe case insensitive comparison
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/906>
2021-09-28 20:04:55 +00:00
Olivier Crête 2dd740c0c3 rtphdrext: Print warnings when trying to parse caps
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/906>
2021-09-28 20:04:55 +00:00
Olivier Crête 5ec82c1c4e rtphdrext: Pass just the attributes to the subclass
Since the base class now does the parsing, there is no need
to reproduce that code in all the subclasses, just pass the attributes
which are the only relevant bit anyway.

Also, only store the direction if the subclass accepted the caps

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/906>
2021-09-28 20:04:55 +00:00
Olivier Crête 87a91d1387 rtphdrext: Add helper function to set fields in caps
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/906>
2021-09-28 20:04:55 +00:00
Olivier Crête e76dce3c6e rtphdrext: Parse direction from the caps
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/906>
2021-09-28 20:04:55 +00:00
Olivier Crête 34a6b2b890 rtphdrext: Set the direction in the caps from the property
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/906>
2021-09-28 20:04:55 +00:00
Olivier Crête 63d669e0bf rtphdrext: Store the direction in the base class
Store the direction associated wit the RTP header extension in the
base class so it can use it.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/906>
2021-09-28 20:04:55 +00:00
Olivier Crête ba328fb98d rtphdrext: Set caps without attributes as the default
Most subclasses just use the simple function, so just let the base class
do it. It makes less code in subclasses.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/906>
2021-09-28 20:04:55 +00:00
Olivier Crête 498740fe57 rtphdrext: Put simple caps generation as the base class default
Instead of having a helper function that gets called by almost every
subclass, just let the base class set the caps fields automatically.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/906>
2021-09-28 20:04:55 +00:00
Thibault Saunier 2fd28195ca Move files from gst-plugins-base into the "subprojects/gst-plugins-base/" subdir 2021-09-24 16:13:26 -03:00