Commit graph

151 commits

Author SHA1 Message Date
Göran Jönsson
7e01dfd151 rtsp-media: Fix multicast use case with common media
Use case
client 1: SETUP
client 1: PLAY
client 2: SETUP
client 1: TEARDOWN
client 2: PLAY
client 2: TEARDOWN
2019-02-19 12:12:34 +01:00
Patricia Muscalu
d4a8834ffe tests: rtspserver: Add shared media test case for TCP 2018-11-17 16:16:34 +01:00
Patricia Muscalu
982efec468 tests: client: Avoid bind() failures in tests
https://bugzilla.gnome.org/show_bug.cgi?id=797059
2018-09-28 13:27:48 +03:00
Patricia Muscalu
c394de2348 New property for socket binding to mcast addresses
By default the multicast sockets are bound to INADDR_ANY,
as it's not allowed to bind sockets to multicast addresses
in Windows. This default behaviour can be changed by setting
bind-mcast-address property on the media-factory object.

https://bugzilla.gnome.org/show_bug.cgi?id=797059
2018-09-28 13:27:48 +03:00
David Svensson Fors
a2e182c3b4 rtsp-client: Avoid reuse of channel numbers for interleaved
If a (strange) client would reuse interleaved channel numbers in
multiple SETUP requests, we should not accept them. The channel
numbers are used for looking up stream transports in the
priv->transports hash table, and transports disappear from the table
if channel numbers are reused.

RFC 7826 (RTSP 2.0), Section 18.54, clarifies that it is OK for the
server to change the channel numbers suggested by the client.

https://bugzilla.gnome.org/show_bug.cgi?id=796988
2018-08-29 14:46:01 +03:00
David Svensson Fors
990d5dde86 rtsp-client: Add unit test of SETUP for RTSP/RTP/TCP
Allow regex for matching transport header against expected pattern.

https://bugzilla.gnome.org/show_bug.cgi?id=796988
2018-08-29 14:46:01 +03:00
Sebastian Dröge
bd76c2f9c5 Fix indentation again 2018-08-14 14:31:55 +03:00
Patricia Muscalu
cbe6ae3c48 stream: Added a list of multicast client addresses
When media is shared, the same media stream can be sent
to multiple multicast groups. Currently, there is no API
to retrieve multicast addresses from the stream.
When calling gst_rtsp_stream_get_multicast_address() function,
only the first multicast address is returned.
With this patch, each multicast destination requested in SETUP
will be stored in an internal list (call to
gst_rtsp_stream_add_multicast_client_address()).
The list of multicast groups requested by the clients can be
retrieved by calling gst_rtsp_stream_get_multicast_client_addresses().
There still exist some problems with the current implementation
in the multicast case:
1) The receiving part is currently only configured with
regard to the first multicast client (see
https://bugzilla.gnome.org/show_bug.cgi?id=796917).
2) Secondly, of security reasons, some constraints should be
put on the requested multicast destinations (see
https://bugzilla.gnome.org/show_bug.cgi?id=796916).

Change-Id: I6b060746e472a0734cc2fd828ffe4ea2956733ea

https://bugzilla.gnome.org/show_bug.cgi?id=793441
2018-08-14 14:31:42 +03:00
Patricia Muscalu
4c6cecf5d6 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.

Change-Id: I5408646e3b5a0a224d907ae215bdea60c4f1905f

https://bugzilla.gnome.org/show_bug.cgi?id=793441
2018-08-14 14:31:42 +03:00
Patricia Muscalu
048e24a7c6 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.

Change-Id: I6ae578fb5164d78e8ec1e2ee82dc4eaacd0912d1

https://bugzilla.gnome.org/show_bug.cgi?id=793441
2018-08-14 14:31:42 +03:00
Patricia Muscalu
308480e762 client: Don't reserve multicast address in the client setting case
When two multicast clients request specific transport
configurations, and "transport.client-settings" parameter is
set to true, it's wrong to actually require that these two
clients request the same multicast group.
Removed test_client_multicast_invalid_transport_specific test
cases as they wrongly require that the requested destination
address is supposed to be present in the address pool, also in
the case when "transport.client-settings" parameter is set to true.

Change-Id: I4580182ef35996caf644686d6139f72ec599c9fa

https://bugzilla.gnome.org/show_bug.cgi?id=793441
2018-08-14 14:31:41 +03:00
Patricia Muscalu
a7bb684e9b Add new API for setting/getting maximum multicast ttl value
Change-Id: I5ef4758188c14785e17fb8fbf42a3dc0cb054233

https://bugzilla.gnome.org/show_bug.cgi?id=793441
2018-08-14 14:31:41 +03:00
Sebastian Dröge
443c2b73e5 Revert "Add new API for setting/getting maximum multicast ttl value"
This reverts commit 7f0ae77e40.

Commits where accidentially squashed together
2018-08-14 14:25:42 +03:00
Sebastian Dröge
17335e9906 Revert "rtsp-stream: Don't require address pool in the transport specific case"
This reverts commit a9db3e7f09.

Commits where accidentially squashed together
2018-08-14 14:25:37 +03:00
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
Sebastian Dröge
ef878da703 gst: Run everything through gst-indent again 2018-04-04 10:06:06 +03:00
Branko Subasic
48ad01beba rtsp-media: query the position on active streams if media is complete
If the media is complete, i.e. one or more streams have been configured
with sinks, then we want to query the position on those streams only.
A query on an incomplete stream may return a position that originates from
an earlier preroll.

https://bugzilla.gnome.org/show_bug.cgi?id=794964
2018-04-04 10:05:38 +03:00
Mathieu Duponchelle
7f9b8c2107 rtspclientsink: Fix client ports for the RTCP backchannel
This was broken since the work for delayed transport creation
was merged: the creation of the transports string depends on
calling stream_get_server_port, which only starts returning
something meaningful after a call to stream_allocate_udp_sockets
has been made, this function expects a transport that we parse
from the transport string ...

Significant refactoring is in order, but does not look entirely
trivial, for now we put a band aid on and create a second transport
string after the stream has been completed, to pass it in
the request headers instead of the previous, incomplete one.

https://bugzilla.gnome.org/show_bug.cgi?id=794789
2018-03-30 17:55:32 +02:00
Mathieu Duponchelle
e356cf33f2 permissions: more bindings-friendly API
https://bugzilla.gnome.org/show_bug.cgi?id=793975
2018-03-02 16:21:37 +01:00
Mathieu Duponchelle
ddb0d83844 rtsp-media: fix RECORD getting stuck
The test_record case was working because async=false had
been added in https://bugzilla.gnome.org/show_bug.cgi?id=757488
but that was incorrect, as it should not be needed.

Removing async=false made the test fail as expected, this is
fixed by not trying to preroll when preparing the media for
RECORD, as start_prepare is called upon receiving ANNOUNCE,
and our peer will not start sending media until it has received
a response to that request, and sent and received a response
to RECORD as well, thus obviously preventing preroll.

https://bugzilla.gnome.org/show_bug.cgi?id=793738
2018-02-23 16:13:56 +01:00
Tim-Philipp Müller
f5b99d8fce tests: mountpoints: add more checks for mount point path matching
https://bugzilla.gnome.org/show_bug.cgi?id=771555
2018-01-25 12:13:20 +00:00
Tim-Philipp Müller
b1f515178a permissions: add some new API to make this usable from bindings
https://bugzilla.gnome.org/show_bug.cgi?id=787073
2018-01-18 23:53:20 +00:00
Tim-Philipp Müller
54a8c6bddf rtsp-token: add some API to set fields from bindings
The existing functions are all vararg-based and as such
not usable from bindings.

https://bugzilla.gnome.org/show_bug.cgi?id=787073
2018-01-18 22:37:57 +00:00
Tim-Philipp Müller
4e048f7b8a tests: fix indentation
Fix and "fix".
2018-01-13 15:02:48 +00:00
Tim-Philipp Müller
d0a4ddc2bb tests: rtspserver: fix another ref leak
Even if this didn't show up in valgrind.
2018-01-13 14:58:55 +00:00
Tim-Philipp Müller
9238b7e19a tests: rtspclientsink: fix leak 2018-01-13 14:58:00 +00:00
Branko Subasic
3d860913c6 test: rtspserver: plug memory leak in test_no_session_timeout
In test_no_session_timeout, unref the rtsp session object when the
test is done.

https://bugzilla.gnome.org/show_bug.cgi?id=792127
2018-01-13 14:18:47 +00:00
Patricia Muscalu
abeb896232 check/media: Add seekability test case: not all streams are active
Media contains two streams but only one is complete and prepared
for playing.

https://bugzilla.gnome.org/show_bug.cgi?id=790674
2017-11-27 07:58:42 +01:00
Edward Hervey
bad6f5690a check: Add seekability testing on medias
Make sure that once GstRTSPMedia are prepared they returned
the expected seekability results

https://bugzilla.gnome.org/show_bug.cgi?id=790674
2017-11-25 07:54:29 +01:00
Patricia Muscalu
de930f2e4d check/media: Fix thread pool leak.
Change-Id: I0f92b1caca0ee518ae64a7dacfbd28a214c3eea1

https://bugzilla.gnome.org/show_bug.cgi?id=790674
2017-11-24 10:52:36 +01:00
Edward Hervey
90ca7f8b31 check/media: Check that prepared media can provide a SDP
Whenever a RTSPMedia is prepared, it should be able to provide a SDP
2017-11-22 12:24:38 +01:00
Edward Hervey
2386e91c36 rtsp-media: Handle multiple dynamic elements
If we have more than one dynamic payloader in the pipeline, we need
to wait until the *last* one emits 'no-more-pads' before switching
to PREPARED.

Failure to do so would result in a race where some of the streams
wouldn't properly be prepared

https://bugzilla.gnome.org/show_bug.cgi?id=769521
2017-11-20 09:38:49 +01: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
Jonathan Karlsson
0f87202a71 rtsp-session: Handle the case when timeout=0
According to the documentation, a timeout of value 0 means
that the session never timeouts. This adds handling of that.
If timeout=0 we just return with a -1 from
gst_rtsp_session_next_timeout_usec ().

https://bugzilla.gnome.org/show_bug.cgi?id=785058
2017-11-15 17:20:33 +02: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
Tim-Philipp Müller
7508442292 tests: try to avoid using the same ports in different tests
Causes problems with client multicast tests otherwise if
tests are run in parallel.

https://bugzilla.gnome.org/show_bug.cgi?id=773640
2016-10-31 12:05:25 +00:00
Tim-Philipp Müller
fd6beb871a tests: client: use fail_unless_equals_foo() for better failure reporting 2016-10-28 17:50:59 +01:00
Sebastian Dröge
958f4a47ec tests: Fix compilation 2016-09-05 13:40:59 +03:00
Xavier Claessens
8495c47a9d stream: revert back to create udpsrc/udpsink on DESCRIBE for unicast
This is basically reverting changes introduced in commit f62a9a7,
because it was introducing various regressions:

- It introduces a leak of udpsrc elements that got wrongly fixed by adding
  an hash table in commit cba045e. We should have at most 4 udpsrc for unicast:
  ipv4/ipv6, rtp/rtcp. They can be reused for all unicast clients.
- If a mcast client connects, it creates a new socket in SETUP to try to respect
  the destination/port given by the client in the transport, and overrides the
  socket already set on the udpsink element. That means that if we already had a
  client connected, the source address on the udp packets it receives suddenly
  changes.
- If a 2nd mcast client connects, the destination/port in its transport is
  ignored but its transport wasn't updated.

What this patch does:

- Revert back to create udpsrc/udpsink for unicast clients on DESCRIBE.
- Always have a tee+queue when udp is enabled. This could be optimized
  again in a later patch, but is more complicated. If no unicast clients
  connects then those elements are useless, this could be also optimized
  in a later patch.
- When mcast transport is added, it creates a new set of udpsrc/udpsink,
  seperated from those for unicast clients. Since we already support only
  one mcast address, we also create only one set of elements.

https://bugzilla.gnome.org/show_bug.cgi?id=766612
2016-09-05 13:36:17 +03:00
Jake Foytik
fe5f8077c1 rtsp-stream: Fix crash on cleanup with shared media and multiple udpsrc
- Unicast udpsrcs are now managed in a hash table. This allows for proper cleanup in with shared streams and fixes a memory leak.
 - Unicast udpsrcs are now properly cleaned up when shared connections exit. See the update_transport() function.
 - Create unit test for shared media.

https://bugzilla.gnome.org/show_bug.cgi?id=764744
2016-04-29 11:49:14 +03:00
Patricia Muscalu
422d3a3002 stream tests: added new tests
Test a case when the address pool only contains multicast addresses
and the client is requesting unicast udp.
Added tests for multicast ports allocation.

https://bugzilla.gnome.org/show_bug.cgi?id=757488
2016-03-05 10:08:40 +02:00
Jan Schmidt
b96e4e16a7 rtspsink: Fix some leaks in rtspclientsink and the unit test.
https://bugzilla.gnome.org/show_bug.cgi?id=762525
2016-02-24 02:12:08 +11:00
Patricia Muscalu
a6367c5971 tests: unit test fixes
Removed port allocation test from the media suite.
The port allocation failure is now in the stream suite.
rtspserver:
Make sure that the media is suspended after the DESCRIBE request
before reconfiguring the UDP sinks.
rtspclientsink:
In the RECORD case we have to set async property to false
for the appsink element in the test in order to make sure
that the media pipeline doesn't hang in start_preroll().

https://bugzilla.gnome.org/show_bug.cgi?id=757488
2016-02-23 17:05:15 +02:00
Jan Schmidt
f54dd50203 rtspsink: Add rtspclientsink element
Add an rtspclientsink element that accepts streams for which
there is a registered payloader and sends them to
an RTSP server using RECORD.

Sending is synchronised to the pipeline clock. Payload-types
are automatically selected. The 'new-payloader' signal is fired
for custom configuration of payloaders when they are created.

Can now stream a movie like this:

receiver:
  ./test-record "( decodebin name=depay0 ! videoconvert ! autovideosink \
       decodebin name=depay1 ! audioconvert ! autoaudiosink )"
sender:
  gst-launch-1.0 filesrc location=file-with-aac-and-h264.mp4 ! qtdemux name=d ! \
       queue ! aacparse ! rtspclientsink location=rtsp://127.0.0.1:8554/test name=s \

https://bugzilla.gnome.org/show_bug.cgi?id=758180
2016-01-29 01:44:26 +11:00
Jan Schmidt
9e92a0307c rtsp-client: Report RECORD and ANNOUNCE as supported in the OPTIONS 2015-11-17 01:12:28 +11:00
David Svensson Fors
2178a7c871 rtspserver: Add udp-mcast transport SETUP test
Refactor utility functions in the test file so they can handle
more than UDP and TCP as lower transport.

https://bugzilla.gnome.org/show_bug.cgi?id=756969
2015-10-22 19:31:59 +03:00