Commit graph

192 commits

Author SHA1 Message Date
Sebastian Dröge
29ae15f6f1 Revert "stream: Choose the maximum ttl value provided by multicast clients"
This reverts commit 499e437e50.

Commits where accidentially squashed together
2018-08-14 14:25:14 +03:00
Patricia Muscalu
499e437e50 stream: Choose the maximum ttl value provided by multicast clients
The maximum ttl value provided so far by the multicast clients
will be chosen and reported in the response to the current
client request.

https://bugzilla.gnome.org/show_bug.cgi?id=793441
2018-08-14 14:10:41 +03:00
Patricia Muscalu
a9db3e7f09 rtsp-stream: Don't require address pool in the transport specific case
If "transport.client-settings" parameter is set to true, the client is
allowed to specify destination, ports and ttl.
There is no need for pre-configured address pool.

https://bugzilla.gnome.org/show_bug.cgi?id=793441
2018-08-14 14:10:23 +03:00
Patricia Muscalu
7f0ae77e40 Add new API for setting/getting maximum multicast ttl value
https://bugzilla.gnome.org/show_bug.cgi?id=793441
2018-08-14 14:10:20 +03:00
Mathieu Duponchelle
3357094440 rtsp-stream: avoid duplicating the first multicast client
In dcb4533fed , we made it so
clients were dynamically added and removed to the multicast
udp sinks, as such we should no longer add a first client in
set_multicast_socket_for_udpsink

https://bugzilla.gnome.org/show_bug.cgi?id=793441
2018-08-14 14:10:02 +03:00
Mathieu Duponchelle
12f8abb549 rtsp-client: always allocate both IPV4 and IPV6 sockets
multiudpsink does not support setting the socket* properties
after it has started, which meant that rtsp-server could no
longer serve on both IPV4 and IPV6 sockets since the patches
from https://bugzilla.gnome.org/show_bug.cgi?id=757488 were
merged.

When first connecting an IPV6 client then an IPV4 client,
multiudpsink fell back to using the IPV6 socket.

When first connecting an IPV4 client, then an IPV6 client,
multiudpsink errored out, released the IPV4 socket, then
crashed when trying to send a message on NULL nevertheless,
that is however a separate issue.

This could probably be fixed by handling the setting of
sockets in multiudpsink after it has started, that will
however be a much more significant effort.

For now, this commit simply partially reverts the behaviour
of rtsp-stream: it will continue to only create the udpsinks
when needed, as was the case since the patches were merged,
it will however when creating them, always allocate both
sockets and set them on the sink before it starts, as was
the case prior to the patches.

Transport configuration will only error out if the allocation
of UDP sockets fails for the actual client's family, this
also downgrades the GST_ERRORs in alloc_ports_one_family
to GST_WARNINGs, as failing to allocate is no longer
necessarily fatal.

https://bugzilla.gnome.org/show_bug.cgi?id=796875
2018-08-01 20:42:34 +02:00
Sebastian Dröge
37e75cb8ea rtsp-stream: Slightly simplify locking 2018-07-23 18:03:51 +03:00
David Svensson Fors
12169f1e84 Limit queued TCP data messages to one per stream
Before, the watch backlog size in GstRTSPClient was changed
dynamically between unlimited and a fixed size, trying to avoid both
unlimited memory usage and deadlocks while waiting for place in the
queue. (Some of the deadlocks were described in a long comment in
handle_request().)

In the previous commit, we changed to a fixed backlog size of 100.
This is possible, because we now handle RTP/RTCP data messages differently
from RTSP request/response messages.

The data messages are messages tunneled over TCP. We allow at most one
queued data message per stream in GstRTSPClient at a time, and
successfully sent data messages are acked by sending a "message-sent"
callback from the GstStreamTransport. Until that ack comes, the
GstRTSPStream does not call pull_sample() on its appsink, and
therefore the streaming thread in the pipeline will not be blocked
inside GstRTSPClient, waiting for a place in the queue.

pull_sample() is called when we have both an ack and a "new-sample"
signal from the appsink. Then, we know there is a buffer to write.

RTSP request/response messages are not acked in the same way as data
messages. The rest of the 100 places in the queue are used for
them. If the queue becomes full of request/response messages, we
return an error and close the connection to the client.

Change-Id: I275310bc90a219ceb2473c098261acc78be84c97
2018-07-23 17:45:00 +03:00
Göran Jönsson
c1fab570d8 rtsp-stream: avoid pushing data on unlinked udpsrc pad during setup
Fix race when setting up source elements.

Since we set the source element(s) to PLAYING state before hooking
them up to the downstream funnel, it's possible for the source element
to receive packets before we actually get to linking it to the funnel,
in which case buffers would be pushed out on an unlinked pad, causing
it to error out and stop receiving more data.

We fix this by blocking the source's srcpad until we have linked it.

https://bugzilla.gnome.org/show_bug.cgi?id=796160
2018-06-27 12:25:45 +02:00
Ognyan Tonchev
f110016ac6 rtsp-stream: Fix mismatch between allowed and configured protocols
https://bugzilla.gnome.org/show_bug.cgi?id=796679
2018-06-26 15:41:07 +02:00
Ulf Olsson
4d25e04bd7 rtsp-stream: Emit a signal when the SRTP decoder is created
https://bugzilla.gnome.org/show_bug.cgi?id=778080
2018-06-26 15:38:33 +02:00
Patricia Muscalu
4007050335 rtsp-stream: Don't require presence of sinks in _get_*_socket()
Transport specific sink elements are added to the pipeline
in PLAY request and sockets are already created in SETUP so
it's actually wrong to require the presence of sinks in
_get_*_socket() functions.

https://bugzilla.gnome.org/show_bug.cgi?id=793441
2018-06-26 14:01:02 +02:00
Patricia Muscalu
dcb4533fed rtsp-stream: Update transport for multicast clients as well
If a multicast client requests different transport settings
than the existing one make sure that this new transport
configuruation is propagated to the multicast udp sink.

https://bugzilla.gnome.org/show_bug.cgi?id=793441
2018-06-26 11:08:45 +02:00
Patricia Muscalu
1a38de2b17 rtsp-stream: Set the multicast TTL parameter on multicast udp sinks
And not on unicast udp sinks

https://bugzilla.gnome.org/show_bug.cgi?id=793441
2018-06-26 10:59:25 +02:00
Tim-Philipp Müller
2eb4d1b810 Update for g_type_class_add_private() deprecation in recent GLib 2018-06-24 12:48:11 +02:00
Tim-Philipp Müller
e82ba1e52f Fix indentation 2018-06-24 12:45:49 +02:00
Mathieu Duponchelle
3b70c68e6e rtsp-stream: only create funnel if it didn't exist already.
This precented using multiple protocols for the same stream.

https://bugzilla.gnome.org/show_bug.cgi?id=796634
2018-06-20 01:36:57 +02:00
Mathieu Duponchelle
bfc35ae1ae Implement support for ULP Forward Error Correction
In this initial commit, interface is only exposed for RECORD,
further work will be needed in rtspsrc to support this for
PLAY.

https://bugzilla.gnome.org/show_bug.cgi?id=794911
2018-04-19 18:25:31 +02:00
Sebastian Dröge
ef878da703 gst: Run everything through gst-indent again 2018-04-04 10:06:06 +03:00
Mathieu Duponchelle
8bf341ad02 rtsp-stream: do not take lock in request_aux_receiver
Added it right before pushing the previous commit, it is
incorrect and deadlocks because this function gets called
from the join_bin thread, which already holds the lock,
that's the reason why request_aux_sender didn't take the
lock either.
2018-03-30 23:10:10 +02:00
Mathieu Duponchelle
988db52016 rtsp-server: add API to enable retransmission requests
"do-retransmission" was previously set when rtx-time != 0,
which made no sense as do-retransmission is used to enable
the sending of retransmission requests, where as rtx-time
is used by the peer to enable storing of buffers in order
to respond to retransmission requests.

rtsp-media now also provides a callback for the
request-aux-receiver signal.

https://bugzilla.gnome.org/show_bug.cgi?id=794822
2018-03-30 17:55:32 +02:00
Mathieu Duponchelle
a093f4442b rtsp-stream: extract handle_keymgmt from rtsp-client
rtspclientsink will also need to parse KeyMgmt headers
sent by the server to decrypt the RTCP backchannel stream

https://bugzilla.gnome.org/show_bug.cgi?id=794813
2018-03-30 17:55:32 +02:00
Ognyan Tonchev
14c511ae62 stream: Add functions for checking if stream is receiver or sender
...and replace all checks for RECORD in GstRTSPMedia which are really
for "sender-only". This way the code becomes more generic and introducing
support for onvif-backchannel later on will require no changes in
GstRTSPMedia.
2018-02-16 11:04:53 +02:00
Mathieu Duponchelle
c725ef01a4 All around: add annotations and API guards 2018-02-12 19:16:11 +01:00
Sebastian Dröge
4ec17b1975 rtsp-stream: Set multicast TTL on the multicast sockets
And not if we do unicast UDP.

https://bugzilla.gnome.org/show_bug.cgi?id=791743
2017-12-19 11:34:37 +02:00
Sebastian Dröge
4d86f99449 rtsp-stream: Decide based on the sockets, not the addresses if we already allocated a socket
In the multicast case (as in test-multicast, not test-multicast2), the
address could be allocated/reserved (and thus set) already without
allocating the actual socket. We need to allocate the socket here still
instead of just claiming that it was already allocated.

See https://bugzilla.gnome.org/show_bug.cgi?id=791743#c2
2017-12-19 11:16:51 +02:00
Edward Hervey
64a46d47ba rtsp-server: Minor doc fixes
Mostly for g-i
2017-12-07 16:08:50 +01:00
Patricia Muscalu
caa3f1caac rtsp-stream: Do not reset 'blocking' if stream is already blocked
https://bugzilla.gnome.org/show_bug.cgi?id=790674
2017-11-27 07:58:42 +01:00
Edward Hervey
9514f2d354 rtsp-media: Enable seeking query before pipeline is complete
SDP are now provided *before* the pipeline is fully complete. In order
to know whether a media is seekable or not therefore requires asking
the invididual streams.

API: gst_rtsp_stream_seekable

https://bugzilla.gnome.org/show_bug.cgi?id=790674
2017-11-25 07:53:11 +01:00
Edward Hervey
4d98bc5e55 Run gst-indent 2017-11-21 09:53:08 +01:00
Sebastian Dröge
d51f8abe56 rtsp-stream: Only update the RTP udpsink if it actually exists
For send-only streams it does not exist, but the RTCP udpsink might.
2017-11-15 19:56:26 +02:00
Patricia Muscalu
efdb795c86 rtsp-media: seek on media pipelines that are complete
Make sure that a seek is performed on pipelines that
contain at least one sink element.

Change-Id: Icf398e10add3191d104b1289de612412da326819

https://bugzilla.gnome.org/show_bug.cgi?id=788340
2017-11-15 19:56:26 +02:00
Patricia Muscalu
a7732a68e8 Dynamically reconfigure pipeline in PLAY based on transports
The initial pipeline does not contain specific transport
elements. The receiver and the sender parts are added
after PLAY.
If the media is shared, the streams are dynamically
reconfigured after each PLAY.

https://bugzilla.gnome.org/show_bug.cgi?id=788340
2017-11-15 19:56:15 +02:00
Patricia Muscalu
930a602e17 rtsp-stream: obtain stream position from pad
If no sinks have been added yet, obtain the current and
the stop position of the stream from the send_src pad.

Change-Id: Iacd4ab4bdc69f6b49370d06012880ce48a7d595a

https://bugzilla.gnome.org/show_bug.cgi?id=788340
2017-11-15 17:46:00 +02:00
Patricia Muscalu
51d670f73b rtsp-stream: add functions to get rtp and rtcp multicast sockets
Change-Id: Iddfe6e0bd250cb0159096d5eba9e4202d22b56db

https://bugzilla.gnome.org/show_bug.cgi?id=788340
2017-11-15 17:46:00 +02:00
Patricia Muscalu
c9605cc5e1 stream: set async=sync=false only for RTCP appsink
Change-Id: I929a218a9adf4759f61322b6f2063aacc5595f90

https://bugzilla.gnome.org/show_bug.cgi?id=788340
2017-11-15 17:46:00 +02:00
Thibault Saunier
8b38aa9c46 stream: Use stream duration as stream-stop if segment was not configured with a stop
Allowing client to know stream duration when no seeking happened.

https://bugzilla.gnome.org/show_bug.cgi?id=783435
2017-10-05 12:07:13 -03:00
Julien Isorce
d72284bdf8 rtsp-stream: fix connection delay due to wrong assumption on last-sample
Commit 852cc09f54 assumed that
multiudpsink's last-sample always comes from the payloader. Which
is wrong if auxiliary streams are multiplexed in the same stream.

So check the buffer's ssrc against the caps'ssrc before to use its
seqnum. If not the same ssrc just use the payloader as done prior
the commit above or when there is no last-sample yet.

https://bugzilla.gnome.org/show_bug.cgi?id=784094
2017-06-29 14:52:09 +01:00
Thibault Saunier
b56930704f gi: Fix some annotations and docstrings 2017-04-13 14:20:10 -03:00
Patricia Muscalu
fb7833245d rtsp-stream: corrected if-statement in _get_server_port()
This bug was accidentally introduced while fixing a segfault
in _get_server_port() function.

https://bugzilla.gnome.org/show_bug.cgi?id=776345
2017-01-10 10:38:13 +00:00
Patricia Muscalu
f47e6ab9f6 rtsp-stream: fixed segmenation fault in _get_server_port()
Calling function gst_rtsp_stream_get_server_port() results in
segmenation fault in the RTP/RTSP/TCP case.
Port that the server will use to receive RTCP makes only
sense in the UDP case, however the function should handle
the TCP case in a nicer way.

https://bugzilla.gnome.org/show_bug.cgi?id=776345
2017-01-09 15:27:40 +02:00
Patricia Muscalu
42f270e7f2 rtsp-stream: Fixed TCP transport case
Make sure that the appsink element is actually added to
the bin before trying to link it with the elements in it.

https://bugzilla.gnome.org/show_bug.cgi?id=776343
2016-12-22 14:21:54 +02:00
Matthew Waters
b38eb8e99e stream: block the output of rtpbin instead of the source pipeline
85c52e194b introduced a more correct
detection of the srtp rollover counter to add to the SDP.

Unfortunately, it was incomplete for live pipelines where the logic
blocks the source bin before creating the SDP and thus would never have
the necessary informaiton to create a correct SDP with srtp encryption.

Move the pad blocks to rtpbin's output pads instead so that the
necessary information can be created before we need the information for
the SDP.

https://bugzilla.gnome.org/show_bug.cgi?id=770239
2016-11-23 23:08:16 +11:00
Göran Jönsson
335d279a96 rtsp-stream: Set close-socket FALSE on UDP src:es
With this RTSP server can use the sockets independent on the udpsrc
state.
When the udp src is finalized it will unref socket and when g_socket
is finalized the socket will be closed.

https://bugzilla.gnome.org/show_bug.cgi?id=765673
2016-11-22 13:59:30 +02:00
Xavier Claessens
c0f24fea83 stream: Fix randomly missing streams from SDP with dynamic elements
When using dynamic elements, gst_rtsp_stream_join_bin() is called from
"pad-added" signal. In that case priv->srcpad could already have its caps,
and they'll be sent to priv->send_src[0] pad. That means that when it
connects "notify::caps" signal, that pad could already have received its
caps and the signal won't be emitted anymore.

In that case priv->caps stay to NULL and when building the SDP that stream
gets ignored. Leading to missing video or audio when playing in client side.

https://bugzilla.gnome.org/show_bug.cgi?id=772478
2016-10-06 19:05:36 +03:00
Ian Jamison
34389831cb rtsp-server: Hint that set_multicast_iface expects the name of the interface
To prevent any possibly confusion with IPs or anything else.

https://bugzilla.gnome.org/show_bug.cgi?id=771530
2016-09-18 10:00:29 -04:00
Sebastian Dröge
74c8a9f4cf rtsp-stream: Remove unused _locked() variant of a function
It was added during refactoring.
2016-09-07 18:44:34 +03:00
Xavier Claessens
e882fe9e06 stream: cosmetic cleanup
https://bugzilla.gnome.org/show_bug.cgi?id=766612
2016-09-07 18:40:57 +03:00
Xavier Claessens
f5f350645a stream: Compare IP addresses case insensitive in more places
https://bugzilla.gnome.org/show_bug.cgi?id=766612
2016-09-07 18:40:57 +03:00
Xavier Claessens
f90ab92547 stream: Fix leaked joined_bin
There is no need to keep a strong ref on it, and _leave_bin() was
setting it to NULL before calling g_clear_object() so it was leaked.

https://bugzilla.gnome.org/show_bug.cgi?id=766612
2016-09-07 18:40:57 +03:00