Commit graph

176 commits

Author SHA1 Message Date
Göran Jönsson
16bc937ed9 Use complete streams for scale and speed.
Without this patch it's always stream0 that is used to get segment event
that is used to set scale and speed. This even if client not doing SETUP
for stream0. At least in suspend mode reset this not working since then
it's just random if send_rtp_sink have got any segment event. There are
no check if send_rtp_sink for stream0 got any data before media is
prerolled after PLAY request.
2019-08-29 07:15:37 +02:00
Mathieu Duponchelle
507e6f1db2 client test: expect any port in transport
setup_multicast_client sets a 5000-5010 range for the client
ports, it is incorrect to expect the transport to always use
5000-5001

Fixes #73
2019-07-20 16:16:22 +00:00
Mathieu Duponchelle
571f119fea onvif tests: use g_cond_wait() correctly
g_cond_wait() has to be called in a loop until required conditions
are met

Fixes #71
2019-07-17 15:39:45 +02:00
Mathieu Duponchelle
0f498eabf4 onvif: Implement and test the Streaming Specification
https://www.onvif.org/specs/stream/ONVIF-Streaming-Spec.pdf
2019-06-06 18:45:17 +02:00
Nikita Bobkov
f31f79f60e Reverse playback support
GStreamer plays segment from stop to start when doing reverse playback.
RTSP implies that media should be played from start of Range header to
its stop. Hence we swap start and stop times before passing them to
gst_element_seek.

Also make gst_rtsp_stream_query_stop always return value that can be
used as stop time of Range header.
2019-06-04 14:32:51 +02:00
Branko Subasic
bc74589601 rtsp-client: add support for Scale and Speed header
Add support for the RTSP Scale and Speed headers by setting the rate in
the seek to (scale*speed). We then check the resulting segment for rate
and applied rate, and use them as values for the Speed and Scale headers
respectively.

https://bugzilla.gnome.org/show_bug.cgi?id=754575
2019-06-04 14:32:51 +02:00
Branko Subasic
421ac85150 rtsp-media: allow specifying rate when seeking
Add new function gst_rtsp_media_seek_full_with_rate() which allows the
caller to specify the rate for the seek. Also added functions in
rtsp-stream and rtsp-media for retreiving current rate and applied rate.

https://bugzilla.gnome.org/show_bug.cgi?id=754575
2019-06-04 14:32:51 +02:00
Göran Jönsson
1fd49d36d1 rtsp-media: Handle set state when preparing.
Handle the situation when  a call to gst_rtsp_media_set_state is done
when media status is preparing.

Also add unit test for this scenario.

The unit test simulate on a media level when two clients share a (live)
media.
Both clients have done SETUP and got responses. Now client 1 is doing
play and client 2 is just closing the connection.

Then without patch there are a problem when
client1 is calling gst_rtsp_media_unsuspend in handle_play_request.
And client2 is doing closing connection we can end up in a call
to gst_rtsp_media_set_state when
priv->status == GST_RTSP_MEDIA_STATUS_PREPARING and all the logic for
shut down media is jumped over .

With this patch and this scenario we wait until
priv->status == GST_RTSP_MEDIA_STATUS_PREPARED and then continue to
execute after that and now we will execute the logic for
shut down media.
2019-03-20 12:26:50 +01:00
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
Tim-Philipp Müller
ffebe3dd84 meson: add option to disable build of rtspclientsink plugin 2018-09-19 12:17:57 +01:00
Nirbheek Chauhan
517757791e meson: Use feature option for tests option
This was somehow missed the last time around.
2018-09-01 11:23:54 +05:30
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
Nirbheek Chauhan
f0e1c6ad80 meson: There is no gstreamer-plugins-good-1.0.pc
There is no installed version of that, only an uninstalled version.
2018-08-15 18:57:27 +05:30
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
Tim-Philipp Müller
90d006141a configure: check for -good and -bad plugins only in uninstalled setup
Avoids confusing configure messages looking or a -good .pc file
that doesn't exist.

Also use plugindir variables that common macros set while at it.

https://bugzilla.gnome.org/show_bug.cgi?id=795466
2018-04-22 20:10:15 +01: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
Thibault Saunier
fe8a9bc6d5 meson: Fix building tests and activate them again 2017-06-07 15:36:12 -04:00