Commit graph

53 commits

Author SHA1 Message Date
Marc Leeman
102c60f82c rtpmanagerbad: allow setting caps on rtpsrc
rtpsrc tries to do a lookup of the caps based on the encoding-name. For
not so standard encodings, the caps can be set, avoiding the lookup.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1406>
2020-12-04 14:51:38 +00:00
Nicolas Dufresne
dcb3044478 rtpsrc: Cleanup on BYE, timeout or when pad is reused
In this patch, we enabled 'autoremove' feature of rtpbin and also call
'clear-ssrc' on the rtpssrcdemux element when a pad is being reused. This
ensure that the jitterbuffer is removed and no threads accumulates.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1575>
2020-10-16 17:23:46 +00:00
George Kiagiadakis
2fcbb4386b rtpsrc: re-use the same src pad for streams that have the same payload type
Also use payload type when naming pads, this will make it easier to identify
pads and simplify the code.

Fixes #1395

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1575>
2020-10-16 17:23:46 +00:00
Marc Leeman
0be59181d7 rtpmanagerbad: remove duplicate parent declaration
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1689>
2020-10-12 13:56:50 +02:00
George Kiagiadakis
914161f902 rtpsrc: drop stream-start & eos messages posted from the internal udp sink(s)
See #1368

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1472>
2020-07-29 13:20:28 +00:00
Nicolas Dufresne
782dc857e0 rtpsrc: Add domain name support
This add domain name resolution (similar to udpsrc does) to the rtpsrc
element.

Fixes 1352

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1433>
2020-07-14 20:48:04 +00:00
Nicolas Dufresne
f6ac2e44bb rtpsrc: Always set rtcp socket address
Regardless if it's multicast or not, set the address property to match
the element address. This is the address of the interface to listen to,
which is expected to be ANY in most cases, but should be honnored even
for RTCP non-multicast case.

This also fixes an assertion if the address is not a parsable IPv4 or
IPv6 string.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1433>
2020-07-14 20:48:04 +00:00
Nicolas Dufresne
82fe23f212 rtpsink: Fix error handling on bad DNS
This will properly print the DNS being attempted to resolved and avoid
trying to unref a NULL pointer.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1433>
2020-07-14 20:48:04 +00:00
Sebastian Dröge
b812d1c743 rtpsrc/sink: Use g_signal_connect_object()
rtpbin can still emit signals when it is being disposed, and while
rtpbin is inside rtpsrc/rtpsink it can still live longer.

So we either have disconnect all signals at some point, or let GObject
take care of that automatically.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1412>
2020-07-07 12:42:36 +00:00
Marc Leeman
6da6b6f3f0 rtpmanagerbad: fix two minor memory leaks 2020-02-21 12:16:28 +01:00
Marc Leeman
a710fbc12b rtpmanagerbad: reduce lock in rtpsink 2020-02-21 12:16:21 +01:00
Marc Leeman
61b062a12e rtpmanagerbad: documentation comment fix 2020-02-21 12:16:17 +01:00
Marc Leeman
31861b095a rtpmanagerbad: allow setting multicast-iface
Allowing the UDP elements to bind on an interface is needed in more
complex networks where there are mutiple networks interfaces without
default gateway
2019-11-19 12:39:59 +00:00
Marc Leeman
1569c33f24 rtpmanagerbad: name the element children
As discussed with RIST, it is best to name the children of the elements
since these are now created at the element initialisation.
2019-11-17 16:00:19 +00:00
Aaron Boxer
6d3429af34 documentation: fixed a heap o' typos 2019-11-05 09:11:25 -05:00
Tim-Philipp Müller
f218ec2794 Remove autotools build system 2019-10-14 13:54:27 +01:00
Matthew Waters
67e4684932 build: fix werror build with newer gcc
In file included from ../../../../dist/linux_x86_64/include/gstreamer-1.0/gst/gstbin.h:27,
                 from ../../../../dist/linux_x86_64/include/gstreamer-1.0/gst/gst.h:35,
                 from ../gst/rtp/gstrtpsink.h:23,
                 from ../gst/rtp/gstrtpsink.c:49:
In function ‘gst_rtp_sink_start’,
    inlined from ‘gst_rtp_sink_change_state’ at ../gst/rtp/gstrtpsink.c:509:11:
../../../../dist/linux_x86_64/include/gstreamer-1.0/gst/gstelement.h:422:18: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
  422 |   gchar *__txt = _gst_element_error_printf text;                        \
../gst/rtp/gstrtpsink.c:476:3: note: in expansion of macro ‘GST_ELEMENT_ERROR’
  476 |   GST_ELEMENT_ERROR (self, RESOURCE, NOT_FOUND,
      |   ^~~~~~~~~~~~~~~~~
../gst/rtp/gstrtpsink.c: In function ‘gst_rtp_sink_change_state’:
../gst/rtp/gstrtpsink.c:477:37: note: format string is defined here
  477 |       ("Could not resolve hostname '%s'", remote_addr),
      |                                     ^~

In file included from ../../../../dist/linux_x86_64/include/gstreamer-1.0/gst/gstbin.h:27,
                 from ../../../../dist/linux_x86_64/include/gstreamer-1.0/gst/gst.h:35,
                 from ../../../../dist/linux_x86_64/include/gstreamer-1.0/gst/rtp/gstrtpdefs.h:27,
                 from ../../../../dist/linux_x86_64/include/gstreamer-1.0/gst/rtp/rtp.h:25,
                 from ../gst/rist/gstristsink.c:72:
In function ‘gst_rist_sink_setup_rtcp_socket’,
    inlined from ‘gst_rist_sink_start’ at ../gst/rist/gstristsink.c:658:10,
    inlined from ‘gst_rist_sink_change_state’ at ../gst/rist/gstristsink.c:801:13:
../../../../dist/linux_x86_64/include/gstreamer-1.0/gst/gstelement.h:422:18: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
  422 |   gchar *__txt = _gst_element_error_printf text;                        \
../gst/rist/gstristsink.c:595:3: note: in expansion of macro ‘GST_ELEMENT_ERROR’
  595 |   GST_ELEMENT_ERROR (sink, RESOURCE, NOT_FOUND,
      |   ^~~~~~~~~~~~~~~~~
../gst/rist/gstristsink.c: In function ‘gst_rist_sink_change_state’:
../gst/rist/gstristsink.c:596:37: note: format string is defined here
  596 |       ("Could not resolve hostname '%s'", remote_addr),
      |                                     ^~
2019-09-24 10:29:44 +10:00
Marc Leeman
f1aefb77e6 rtpmanagerbad: allow creation of elements at initialisation 2019-09-20 15:35:09 +00:00
Marc Leeman
efd155c4d9 rtp: do not overrule RtpInfo when non dynamic type
When looking up the Rtp information, do not overwrite information
already found with encoding-name by static information.
2019-08-08 18:47:05 +00:00
Seungha Yang
be25c988fd rtp: Fix incompatible type build warning
Use GstURIType instead of guint

../subprojects/gst-plugins-bad/gst/rtp/gstrtpsink.c(575):
    warning C4133: '=': incompatible types ...

../subprojects/gst-plugins-bad/gst/rtp/gstrtpsrc.c(725):
    warning C4133: '=': incompatible types ...
2019-06-26 19:56:09 +09:00
Marc Leeman
492603d723 rtpmanagerbad: fix the plugin registration
After compilation, the compiled library needs to be added to the list
of plugin libraries.
.
Also, fix for static builds
2019-06-07 14:12:25 +00:00
Tim-Philipp Müller
efa5c02636 rtp: fix autotools build some more 2019-06-05 17:00:51 +01:00
Nicolas Dufresne
2667081654 make: rtp: Remove spurious header file
This header file no longer exist.
2019-06-03 20:29:18 -04:00
Marc Leeman
3ef737605a rtpmanagerbad: add RTP streaming elements
This is a re-implementation of the RTP elements that are submitted in
2013 to handle RTP streams. The elements handle a correct connection
for the bi-directional use of the RTCP sockets.

https://bugzilla.gnome.org/show_bug.cgi?id=703111

The rtpsink and rtpsrc elements add an URI interface so that streams
can be decoded with decodebin using the rtp:// interface.

The code can be used as follows

```
gst-launch-1.0 videotestsrc ! x264enc ! rtph264pay config-interval=3 ! rtpsink uri=rtp://239.1.1.1:1234

gst-launch-1.0 videotestsrc ! x264enc ! rtph264pay config-interval=1 ! rtpsink uri=rtp://239.1.2.3:5000
gst-launch-1.0 rtpsrc uri=rtp://239.1.2.3:5000?encoding-name=H264 ! rtph264depay ! avdec_h264 ! videoconvert ! xvimagesink

gst-launch-1.0 videotestsrc ! avenc_mpeg4 ! rtpmp4vpay config-interval=1 ! rtpsink uri=rtp://239.1.2.3:5000
gst-launch-1.0 rtpsrc uri=rtp://239.1.2.3:5000?encoding-name=MP4V-ES ! rtpmp4vdepay ! avdec_mpeg4 ! videoconvert ! xvimagesink
```

rtpmanagerbad: add pkg-config
rtpmanagerbad: Rtp should be uppercase
rtpmanagerbad: add G_OS_WIN32 for shielding unix headers
rtpmanagerbad: remove Since from documentation
rtpmanagerbad: rename lib name from nrtp to rtpmanagerbad
rtpmanagerbad: sync meson.build with other modules
rtpmanagerbad: add Makefile.am
rtpmanagerbad: use GstElement to count pads
rtpmanagerbad: use gst_bin_set_suppressed_flags
rtpmanagerbad: check element creation
rtpmanagerbad: post message when trying to access missing rtpbin
rtpmanagerbad: return FALSE with g_return tests
rtpmanagerbad: use gsocket multicast check
rtpmanagerbad: use gst_caps_new_empty_simple iso gst_caps_from_string
rtpmanagerbad: sync with gstrtppayloads.h
rtpmanagerbad: correct media type X-GST
rtpmanagerbad: test if a compatible pad was found
rtpmanagerbad: remove evil copy of GstRTPPayloadInfo
rtpmanagerbad: add gio_dep to meson
rtpmanagerbad: revert to old glib boilerplate

GStreamer 1.16 does not yet support the newer GLib templates, so revert.

rtpmanagerbad: return GST_STATE_CHANGE_NO_PREROLL for live sources

for live sources, NO_PREROLL should be returned for PLAYING->PAUSED and
READY->PAUSED transitions.

rtpmanagerbad: use GstElement pad counting
rtpmanagerbad: just use template name to request pad
rtpmanagerbad: remove commented code
rtpmanagerbad: use funnel to send multiple streams on one socket
rtpmanagerbad: avoid beaches

beaches should only be used during the summer, so rewrite the code to
return explicitly and avoid beaches during the winter.

rtpmanagerbad: add copyright to test code
rtpmanagerbad: g_free is NULL safe
rtpmanagerbad: do not trace rtpbin
rtpmanagerbad: return NULL explitly
rtpmanagerbad: warn when data port is not even

According to RFC 3550, RTP data should be sent on even ports, while RTCP
is sent on the following odd port.

rtpmanagerbad: document port allocation in rtpsink/src
rtpmanagerbad: improve uri description
rtpmanagerbad: add comment re-use socket
rtpmanagerbad: rename gst_object_set_properties_from_uri_query
rtpmanagerbad: loan prop/val setter from rist
rtpmanagerbad: rtpsrc: fix unitialised pointer
rtpmanagerbad: fix silly typo
rtpmanagerbad: test for empty key/value
rtpmanagerbad: rtpsrc: deprecate ssrc collision to INFO
rtpmanagerbad: sync debug with rist
rtpmanagerbad: small strings allocated on stack
rtpmanagerbad: correct rename
rtpmanagerbad: add locking on prop setters/getters

Locking is added because the URI allows to access the properties too.

rtpmanagerbad: allow for RTCP through NAT
rtpmanagerbad: move gio to header file
rtpmanagerbad: free small strings too
rtpmanagerbad: ttl_mc for ttl on dynudpsink
rtpmanagerbad: add comments on the URI registered
rtpmanagerbad: correct macro after file rename
rtpmanagerbad: code style
rtpmanagerbad: handle wrong URIs in setter
rtpmanagerbad: nit URI notation correction

In an URI, the first key/value pair should not have an ampersand, the
parser did not die though.
2019-06-03 20:08:23 +00:00
Tim-Philipp Müller
f649e85bc9 rtp: move RTP H.265 payloader/depayloader to -good
https://bugzilla.gnome.org/show_bug.cgi?id=761606
2016-02-16 00:33:50 +00:00
Luis de Bethencourt
682bce33a5 gstrtph265depay: keep consistency with rtph264depay
Use gst_rtp_drop_meta() and the same function prototype for
gst_rtp_copy_meta() to keep consistency with the RTP elements in
gst-plugins-good
2016-02-05 17:53:30 +00:00
Luis de Bethencourt
463ea1a9c7 rtph265depay: fix termination of access unit
Only consider the access unit complete when the next-occurring VCL NAL unit
has the first bit after its NAL unit header equal to 1.
2016-02-05 14:04:50 +00:00
Luis de Bethencourt
63ffe374ab rtph265depay: fix unneeded sub-buffer creation
We create a sub-buffer just to copy over its metas and then throw it
away immediately, just use the original input buffer directly.
2016-01-15 16:10:04 +00:00
Luis de Bethencourt
6f8f82164a 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-01-15 15:57:41 +00:00
Luis de Bethencourt
31a7ad77b6 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-01-15 15:19:47 +00:00
Luis de Bethencourt
51dfa3b135 rtph265depay: make sure we call handle_nal for each NAL
Call handle_nal for each NAL in the STAP-A RTP packet. This makes sure
we correctly extract the SPS and PPS.

https://bugzilla.gnome.org/show_bug.cgi?id=730999
2015-08-15 16:22:22 +01:00
Luis de Bethencourt
4075b1112c 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
2015-08-15 14:45:37 +01:00
Luis de Bethencourt
5b2ddfb90c rtph265pay: Use GST_WARNING_OBJECT() instead of GST_WARNING()
https://bugzilla.gnome.org/show_bug.cgi?id=753228
2015-08-15 11:41:43 +01:00
Luis de Bethencourt
585e042fca 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
2015-08-15 11:34:31 +01:00
Luis de Bethencourt
b3418759d9 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
2015-08-14 15:08:10 +01:00
Luis de Bethencourt
fd665514ba rtph265depay: copy metadata in the depayloader, 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
2015-08-14 12:00:23 +01:00
Luis de Bethencourt
397b5d06ec rtph265depay: checking if depay has sps/pps nals before insertion
Related to: https://bugzilla.gnome.org/show_bug.cgi?id=753430

https://bugzilla.gnome.org/show_bug.cgi?id=753228
2015-08-12 17:54:55 +01:00
Luis de Bethencourt
ef9b7ef60a rtph265depay: only update the srcpad caps if something else than the codec_data changed
h264parse and gstrtph264depay do the same, let's keep the behaviour
consistent. As we now include the codec_data inside the stream, this causes
less caps renegotiation.

https://bugzilla.gnome.org/show_bug.cgi?id=753228
2015-08-12 17:22:44 +01:00
Luis de Bethencourt
4edf2ac1c5 rtph265depay: PPS replaces old PPS if it has the same id
https://bugzilla.gnome.org/show_bug.cgi?id=753228
2015-08-12 16:51:18 +01:00
Luis de Bethencourt
021333a9fc rtph265depay: Insert SPS/PPS NALs into the stream
rtph264depay does the same and this fixes decoding of some streams with 32
SPS (or 256 PPS). It is allowed to have SPS ID 0 to 31 (or PPS ID 0 to 255),
but the field in the codec_data for the number of SPS or PPS is only 5
(or 8) bit. As such, 32 SPS (or 256 PPS) are interpreted as 0 everywhere.

This looks like a mistake in the part of the spect about the codec_data.
2015-08-12 16:34:43 +01:00
Luis de Bethencourt
fee3129d49 rtph265depay: implement process_rtp_packet() vfunc
For more optimised RTP packet handling: means we don't need to map the
input buffer again but can just re-use the mapping the base class has
already done.

Based on: https://bugzilla.gnome.org/show_bug.cgi?id=750235

https://bugzilla.gnome.org/show_bug.cgi?id=753228
2015-08-12 15:53:23 +01:00
Luis de Bethencourt
2d3dc2caa6 rtph265depay: Use GST_BUFFER_PTS() instead of GST_BUFFER_TIMESTAMP()
Switching to GST_BUFFER_TIMESTAMP() to be consistent with other rtp code.
2015-08-12 15:14:52 +01:00
Luis de Bethencourt
9379933607 rtph265depay: prevent trying to get 0 bytes from adapter
This causes an assertion and would lead to getting a NULL instead
of a buffer. Without proper checking this would easily lead to a
segfault.

Related to rpth264depay: https://bugzilla.gnome.org/show_bug.cgi?id=737199
2015-08-12 15:05:02 +01:00
Luis de Bethencourt
0e29906a6f rtp: remove dead assignment
Value set to ret will be overwritten at least once at the end of the while
loop, removing assignment.
2015-07-29 17:33:27 +01:00
Tim-Philipp Müller
699452ef31 Remove obsolete Android build cruft
This is not needed any longer.
2015-04-26 18:59:32 +01:00
Luis de Bethencourt
c944093d08 remove unused enum items PROP_LAST
This were probably added to the enums due to cargo cult programming and are
unused.
2015-04-24 16:48:26 +01:00
Luis de Bethencourt
5f4b9a2819 rtp: donl_present variable unused
donl_present is not implemented, yet the value is set and checked a few times.
Cleaning this.

CID #1249687
2015-03-06 14:54:45 +00:00
Luis de Bethencourt
54ce23e0cb 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.
2015-01-08 15:36:04 +00:00
Luis de Bethencourt
66a08297c7 rtp: fix nal unit type check
After further investigation the previous commit is wrong. The code intended to
check if the type is 39 or the ranges 41-44 and 48-55. Just like gsth265parse.c
does. Type 40 would not be complete.
2015-01-08 15:27:44 +00:00
Luis de Bethencourt
20dc27f983 rtp: fix dead code and check for impossible values
nal_type is the index for a GstH265NalUnitType enum. There are two types of dead
code here:
First, after checking if nal_type is >= 39 there are two OR conditionals that
check if the value is in ranges higher than that number, so if nal_type >= 39
falls in the True branch those other conditions aren't checked and if it falls
in the False branch and they are checked, they will always also be False. They
are redundant.
Second, the enum has a range of 0 to 40. So the checks for ranges higher than 41
should never be True.
Removing this redundant checks.

CID 1249684
2015-01-08 13:58:13 +00:00