Commit graph

511 commits

Author SHA1 Message Date
Miguel Paris
f265e5cbd5 rtpbuffer: add_extension_onebyte_header: fix the proper wordlen
The wordlen ("length") MUST represent the total "number of 32-bit words
in the extension, excluding the four-octet extension header" (rfc3550).
There are cases where already existent padding is reused for adding
the new extension. So the new wordlen should be updated if the new
added extension makes it to increase.
2020-03-19 14:18:20 +01:00
Miguel Paris
2d4d28d662 rtpbuffer: get_onebyte_header_end_offset: allow 0 offset
There are some cases where the full extension data could be padding.
In order to make the GstRtpBuffer robust enough, this change supports
this case.
2020-03-19 14:18:20 +01:00
Tobias Ronge
f1b3ed37c6 gstrtpbasepayloader: Add property for scaling RTP timestamp
This patch introduces a property which, if set to FALSE, prevents RTP
basepayloader from scaling the RTP time when a segment's rate is not
equal to 1.0. The specification is ambiguous on this subject and some
clients expect the timestamps not to be scaled.
2020-03-16 10:25:44 +00:00
Håvard Graff
85e201fe30 rtpbasepayload: add property for embedding twcc sequencenumbers
By setting the extension-ID for TWCC (Transport Wide Congestion Control),
the payloader will embed sequencenumbers as a RTP header-extension
according to https://tools.ietf.org/html/draft-holmer-rmcat-transport-wide-cc-extensions-01#section-2

The negotiation of this being enabled with downstream elements
is done with caps reflecting the way this is communicated using SDP.
2020-02-14 09:40:59 +00:00
Kristofer Björkström
4152b0c840 rtpbasepayload: timestamp bug, if rate control=no
With commit "basepayload: Expose onvif-no-rate-control property" the rtp
timestamp changed behaviour when rate control is disabled.

When disabling rate control, we must take care of the stream time to
avoid the timestamps to begin from zero again.
2020-02-11 12:30:49 +00:00
Havard Graff
19e4d1a93c rtpbuffer: add gst_rtp_buffer_get_extension_onebyte_header_from_bytes
So that one can parse the GBytes returned by gst_rtp_buffer_get_extension_bytes
2020-02-04 08:44:43 +00:00
Nicolas Dufresne
8b2afcf56a rtpbasepayload: Save and forward the push flow return
Save push/push_list helper flow return and in case of failure, return it
in the process function. This allow forwarding downstream flow return
even if the subclass is using the push/push_list helper.
2020-01-11 19:39:55 -05:00
Havard Graff
daea137c9d rtcpbuffer: add RTPFB_TYPE_TWCC for Transport-Wide Congestion Control 2019-11-05 12:42:52 +00:00
Tim-Philipp Müller
289d8e53e2 Remove autotools build system 2019-10-13 14:15:43 +01:00
Thibault Saunier
909baa2360 Pass the code through codespell 2019-08-30 13:05:36 +00:00
Mathieu Duponchelle
c854c270be basedepayload: do not create segment in onvif mode
basedepayload generates its own segment in a pretty unconventional
manner, relying on information in the caps such as npt-start or
npt-stop, usually set by rtspsrc.

In ONVIF mode, rtspsrc will generate the correct segment and this
logic in rtpbasedepayload will not be needed, this commit allows
rtspsrc to signal that through the caps.
2019-07-18 17:54:04 +02:00
Stian Selnes
eaade96409 rtpbasedepayload: Add max-reorder property
Add max-reorder property to make the old hard coded reordering limit of
100 configurable. It's particularly useful in some scenarios to set
max-reorder=0 to disable the behavior that the depayloader will drop
packets.

Note that although the default value is 100, the default limit has
increased with one because of the changed if-test. This was done to
allow the max-reorder value to be more intuitive. See tests.
2019-06-13 19:41:11 +03:00
Havard Graff
f7408f9418 rtpbasepayload: don't use GINT_TO_POINTER with GType
GType can (and will) be 64bit. GINT_TO_POINTER is not.
This will result in the api-type checked for being a different one than
it actually is...
2019-06-12 12:38:26 +00:00
Havard Graff
2e342a16ce rtpbasedepayload: don't consider existing GstRTPSourceMeta
The meta should always be generated based on what is present in the
rtp-header.
2019-06-12 12:38:26 +00:00
Marc Leeman
a83859aaee gstrtppayloads: add vp8/vp9/opus encoding-name
Adding these encoding names allows easy lookup of the caps based on the
encoding-name.
2019-06-12 12:32:33 +00:00
Niels De Graef
93daa1435a Use G_DEFINE_AUTOPTR_CLEANUP_FUNC unconditionally
Since we started depending on GLib 2.44, we can be sure this macro is
defined (it will be a no-op on compilers that don't support it). For
plugins we should just start using `G_DECLARE_FINAL_TYPE` which means we
no longer need the macro there, but for most types in base/gst-libs we
don't want to break ABI, which means it's better to just keep it like it
is (and use the `#ifdef` instead).
2019-06-04 20:31:09 -04:00
Thibault Saunier
287897e465 doc: Fix some gtk-doc comments 2019-05-13 11:34:08 -04:00
Thibault Saunier
685731e989 meson: Add variables for gir files
And flatten list of sources for dependencies
2019-05-13 10:19:22 -04:00
Mathieu Duponchelle
3c4bef46b7 basepayload: Expose onvif-no-rate-control property
The ONVIF spec mandates that when Rate-Control=no, the RTP timestamps
match the original sampling times, as opposed to the intended playback
time.
2019-04-05 16:42:55 +00:00
Josep Torra
c1a5a36bba rtcpbuffer: test for len instead of type
The function rtcp_packet_min_length() returns a length for each known type
and -1 for unknown types. This change fixes the test accordingly and silences
the following warning.

gstrtcpbuffer.c:567:12: error: comparison of constant -1 with expression of type 'GstRTCPType' is always false
      [-Werror,-Wtautological-constant-out-of-range-compare]
  if (type == -1)
2019-03-21 19:27:28 +01:00
Nicolas Dufresne
3ee89d6e3c Remove some left over 0.10 references 2019-03-21 17:22:24 +00:00
Stian Selnes
eadeec791a rtpbasedepayload: Drop gap events before first buffer
Before a gap event is pushed downstream a segment event must be pushed
since the gap event can cause packet concealment downstream and hence
data flow. Since concealment before receiving any data packets usually
doesn't make any sense, the gap event is not sent downstream.

Alternatively one could generate a default caps and segment event, but
no need to complicate things until it's proven necessary.

https://bugzilla.gnome.org/show_bug.cgi?id=773104
https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/issues/301
2019-03-20 15:30:50 +00:00
Antonio Ospite
1eb9c5b309 rtpbasepayload: print list size in log output instead of -1
It is weird to see "Preparing to push packet with size 4294967295" in
the logs, so print the list length in case of a buffer list.
2019-03-15 17:38:58 +01:00
Marc Leeman
2e5f5e67ce rtp: add H265 to lookup for media info 2019-03-05 14:33:17 +01:00
Seungha Yang
c389dbf332 rtcpbuffer: Remove invalid sanity check
Checking the address distance between given begin/end sequence
doesn't make sense. They are output params.

This is to fix weird failure of libs_rtp on Windows
2018-12-30 23:25:14 +00:00
Tim-Philipp Müller
83806dc4e1 rtcpbuffer: fix typo 2018-12-30 18:06:58 +00:00
Tim-Philipp Müller
44b18ea2b6 rtcpbuffer: fix function guards with side effects
Code in g_return_*() must not have side effects, as it
might be compiled out if -DG_DISABLE_CHECKS is used, in
which case we would read garbage off the stack.
2018-12-30 17:28:38 +00:00
Tim-Philipp Müller
aa910c3cb7 rtp: fix g-i warnings
Use same variable name in function declaration as in function
definition and gtk-doc/g-i blurb.
2018-12-16 23:15:57 +00:00
Olivier Crête
01a25d81c1 rtcpbuffer: Validate the length of RTCP packets 2018-12-13 14:01:06 -05:00
Justin Kim
5303e2c32b rtcpbuffer: add support XR packet parsing
According to RFC3611, the extended report blocks in XR packet can
have variable length. To visit each block, the iterator should look
into block header. Once XR type is extracted, users can parse the
detailed information by given functions.

Loss/Duplicate RLE
The Loss RLE and the Duplicate RLE have same format so
they can share parsers. For unit test, randomly generated
pseudo packet is used.

Packet Receipt Times
The packet receipt times report block has a list of receipt
times which are in [begin_seq, end_seq).

Receiver Reference Time paser for XR packet
The receiver reference time has ntptime which is 64 bit type.

DLRR
The DLRR report block consists of sub-blocks which has ssrc, last RR,
and delay since last RR. The number of sub-blocks should be calculated
from block length.

Statistics Summary
The Statistics Summary report block provides fixed length
information.

VoIP Metrics
VoIP Metrics consists of several metrics even though they are in
a report block. Data retrieving functions are added per metrics.

https://bugzilla.gnome.org/show_bug.cgi?id=789822
2018-12-13 14:01:06 -05:00
Linus Svensson
72ecbe2aef rtpbasepayload: Update current seqnum for buffer lists
The current sequence number will be the one from the first RTP buffer
when a buffer list is pushed, but should be the last one.

Fixes #495
2018-11-14 12:30:06 +00:00
Stian Selnes
f766b85b96 rtpbasepayload: rtpbasedepayload: Add source-info property
Add a source-info property that will read/write meta to the buffers
about RTP source information. The GstRTPSourceMeta can be used to
transport information about the origin of a buffer, e.g. the sources
that is included in a mixed audio buffer.

A new function gst_rtp_base_payload_allocate_output_buffer() is added
for payloaders to use to allocate the output RTP buffer with the correct
number of CSRCs according to the meta and fill it.

RTPSourceMeta does not make sense on RTP buffers since the information
is in the RTP header. So the payloader will strip the meta from the
output buffer.

https://bugzilla.gnome.org/show_bug.cgi?id=761947
2018-10-10 14:38:01 -04:00
Tim-Philipp Müller
dc29bc4e13 libs: fix API export/import and 'inconsistent linkage' on MSVC
For each lib we build export its own API in headers when we're
building it, otherwise import the API from the headers.

This fixes linker warnings on Windows when building with MSVC.

The problem was that we had defined all GST_*_API decorators
unconditionally to GST_EXPORT. This was intentional and only
supposed to be temporary, but caused linker warnings because
we tell the linker that we want to export all symbols even
those from externall DLLs, and when the linker notices that
they were in external DLLS and not present locally it warns.

What we need to do when building each library is: export
the library's own symbols and import all other symbols. To
this end we define e.g. BUILDING_GST_FOO and then we define
the GST_FOO_API decorator either to export or to import
symbols depending on whether BUILDING_GST_FOO is set or not.
That way external users of each library API automatically
get the import.

While we're at it, add new GST_API_EXPORT in config.h and use
that for GST_*_API decorators instead of GST_EXPORT.

The right export define depends on the toolchain and whether
we're using -fvisibility=hidden or not, so it's better to set it
to the right thing directly than hard-coding a compiler whitelist
in the public header.

We put the export define into config.h instead of passing it via the
command line to the compiler because it might contain spaces and brackets
and in the autotools scenario we'd have to pass that through multiple
layers of plumbing and Makefile/shell escaping and we're just not going
to be *that* lucky.

The export define is only used if we're compiling our lib, not by external
users of the lib headers, so it's not a problem to put it into config.h

Also, this means all .c files of libs need to include config.h
to get the export marker defined, so fix up a few that didn't
include config.h.

This commit depends on a common submodule commit that makes gst-glib-gen.mak
add an #include "config.h" to generated enum/marshal .c files for the
autotools build.

https://bugzilla.gnome.org/show_bug.cgi?id=797185
2018-09-24 08:45:34 +01:00
Nirbheek Chauhan
a9cab426d0 meson: Maintain macOS ABI through dylib versioning
Requires Meson 0.48, but the feature will be ignored on older versions
so it's safe to add it without bumping the requirement.

Documentation:
https://github.com/mesonbuild/meson/blob/master/docs/markdown/Reference-manual.md#shared_library
2018-08-31 14:40:43 +05:30
Tim-Philipp Müller
ca15315565 gst-libs: include config.h in all source files
This will be needed later when we get our export define from config.h
2018-08-13 09:23:34 +01:00
Bastian Köcher
efa9bdccf9 meson: fix install dir for generated header files
Nixos installs into a non-standard includedir, so need
to take account of the 'includedir' option instead of
just hard-coding 'include' here.

https://bugzilla.gnome.org/show_bug.cgi?id=794856
2018-08-10 12:43:38 +01:00
Tim-Philipp Müller
7f9730ecf4 rtp: Update for g_type_class_add_private() deprecation in recent GLib
https://gitlab.gnome.org/GNOME/glib/merge_requests/7
2018-06-23 22:22:22 +02:00
Edward Hervey
924eb8d8a7 rtpbasedepayload: Properly propagate segment seqnum
This wasn't done previously and the outgoing SEGMENT events had
seqnums which weren't consistent with the upstream ones
2018-06-05 17:24:55 +02:00
Antoine Jacoutot
c765649505 libs: g-ir-scanner: do not hardcode libtool path
https://bugzilla.gnome.org/show_bug.cgi?id=726571
2018-05-18 13:41:25 +02:00
Mark Nauwelaerts
fe6f65b1c2 rtp: fix some GIR annotations
Mostly related to out and array parameters.
2018-04-23 19:33:12 +02:00
Mathieu Duponchelle
8467939538 rtpbasedepayload: condition the sending of gap events
The default implementation for packet loss handling previously
always sent a gap event.

While this is correct as long as we know the packet that was
lost was actually a media packet, with ULPFEC this becomes
a bit more complicated, as we do not know whether the packet
that was lost was a FEC packet, in which case it is better
to not actually send any gap events in the default implementation.

Some payloaders can be more clever about, for example VP8 can
use the picture-id, and the M and S bits to determine whether
the missing packet was inside an encoded frame or outside,
and thus whether if it was a media packet or a FEC packet,
which is why ulpfecdec still lets these lost events go through,
though stripping them of their seqnum, and appending a new
"might-have-been-fec" field to them.

This is all a bit terrible, but necessary to have ULPFEC
integrate properly with the rest of our RTP stack.

https://bugzilla.gnome.org/show_bug.cgi?id=794909
2018-04-19 16:39:06 +02:00
Edward Hervey
22c9e5f7c1 libs: Documentation cleanup
* Fix wrong naming, wrong types and typos
* Add missing sections
* Add missing documentation for entries
* Explicitely mark private structure entries
* Remove items that never existed
2018-04-02 08:53:28 +02:00
Alessandro Decina
345aa2cd9e meson: libs: use gnome.mkenums_simple() to generate enumtypes files
This way we no longer need custom wrapper scripts or template files.
2018-03-22 13:15:35 +00:00
Tim-Philipp Müller
363b790d38 rtp: GST_EXPORT -> GST_RTP_API
We need different export decorators for the different libs.
For now no actual change though, just rename before the release,
and add prelude headers to define the new decorator to GST_EXPORT.
2018-03-13 12:16:42 +00:00
Mikhail Fludkov
d7397f0235 rtpbuffer.h: Add new RTPBuffer flags
These flags will be used for Forward Error Correction purposes

https://bugzilla.gnome.org/show_bug.cgi?id=792695
2018-02-21 12:45:41 +01:00
Miguel Paris
bae3636197 rtp: fix gst_rtp_buffer_ext_timestamp taking into account backwards
If timestamp goes forwards more than allowed, we consider that the
timestamp belongs to the previous counting, so the extended timestamp
is unwrapped.

https://bugzilla.gnome.org/show_bug.cgi?id=783443
2017-12-21 17:27:42 -05:00
Sebastian Dröge
d33c407f6b rtp: Require gconstpointer instead of gpointer for gst_rt[c]p_buffer_new_copy_data() 2017-11-17 14:14:55 +02:00
Edward Hervey
ae865ec1d1 rtcpbuffer: fix left shift override
Needs to be cast to the target type
2017-11-04 16:56:10 +01:00
Justin Kim
33709106e9 rtcpbuffer: Add XR type
RTCP XR provides supplements information of the report blocks
from SR and RR. This patch is for downgrading warnings when
XR is detected before implementing entire block types of RFC3611.

https://bugzilla.gnome.org/show_bug.cgi?id=789743
2017-11-01 10:54:10 +02:00
Havard Graff
43985b363d meson: remove vs_module_defs
GST_EXPORT should handle it.
2017-10-05 13:53:14 +01:00