Commit graph

1196 commits

Author SHA1 Message Date
Mark Nauwelaerts
0ed32e0d53 rtsp-stream: check for NULL transports prior to ref'ing 2020-01-11 22:58:48 +01:00
Mathieu Duponchelle
e0a4355d6b rtsp-stream: fix checking of TCP backpressure
The internal index of our appsinks, while it can be used to
determine whether a message is RTP or RTCP, is not necessarily
the same as the interleaved channel. Let the stream-transport
determine the channel to check backpressure for, the same way
it determines the channel according to whether it is sending
RTP or RTCP.
2020-01-09 14:10:44 +01:00
Olivier Crête
73b4929803 rtsp-session: Butcher the file to please gst-indent in the CI
This should be reverted once the CI has an updated gst-indent.
2019-12-18 19:48:31 +00:00
Olivier Crête
75b03ddf5e rtsp-session & client: Remove deprecated GTimeVal
GTimeVal won't work past 2038
2019-12-18 19:48:31 +00:00
Nicola Murino
a547e2b3c8 rtsp-auth: fix default token leak 2019-12-12 17:56:18 +01:00
Adam x Nilsson
8d4a9f37e5 gstrtspclientsink: unref transports when closing bin
Fixes #91
2019-12-10 10:27:07 +01:00
Kristofer Bjorkstrom
faf8f87a02 rtsp-media: Force seek when flush flag is set
The commit "rtsp-client: define all seek accuracy flags from
setup_play_mode" changed the behaviour of when doing a seek.

Before that commit, having the flush flag set would result in a seek
(forced seek).
Even if no seek was needed. One reason to force seek is to flush old buffers
created in Describe requests.

Thus adding force seek also for flush flag will result in play request
with fresh buffers.
2019-12-06 14:52:23 +01:00
Edward Hervey
8de843733d rtsp-client: Revitalize dead code
Leftover from 65d9aa327c

CID: 1455379
2019-12-02 10:46:40 +01:00
Edward Hervey
5ceb2cf83f rtsp-sdp: Don't try to use non-initialized values
Only attempt to use the various timing values iif gst_rtsp_stream_get_info()
returns TRUE. Also avoid the whole clock signalling block if we're not
dealing with senders.

CID: 1439524
CID: 1439536
CID: 1439520
2019-11-27 15:27:36 +01:00
Adam x Nilsson
9c5ca231a6 rtsp-stream: Removing invalid transports returns false
When removing transports an assertion was that the transports passed in
for removal are present in the list, however that can't be assumed.
As an example if a transport was removed from a thread running
send_tcp_message, the main thread can try to remove the same transport
again if it gets a handle_pause_request. This will not effect the
transport list but it will effect n_tcp_transports as it will be
decrement and then have the wrong value.
2019-11-25 19:12:10 +01:00
Niels De Graef
45e77ecdd7 Don't pass default GLib marshallers for signals
By passing NULL to `g_signal_new` instead of a marshaller, GLib will
actually internally optimize the signal (if the marshaller is available
in GLib itself) by also setting the valist marshaller. This makes the
signal emission a bit more performant than the regular marshalling,
which still needs to box into `GValue` and call libffi in case of a
generic marshaller.

Note that for custom marshallers, one would use
`g_signal_set_va_marshaller()` with the valist marshaller instead.
2019-11-04 14:16:10 +00:00
Xavier Claessens
f7bbd9dd86 GstRTSPMountPoints: Remove any existing factory before adding a new one
The documentation of gst_rtsp_mount_points_add_factory() says "Any
previous mount point will be freed" which was true when it was
implemented using a GHashTable. But in 2012 it got rewrote using a
GSequence and since then it could have 2 factories for the same path.
Which one gets used is random, depending on the sorting order of 2
identical items.
2019-11-04 12:01:09 +00:00
Mathieu Duponchelle
dd32924eb0 stream: refactor TCP backpressure handling
The previous implementation stopped sending TCP messages to
all clients when a single one stopped consuming them, which
obviously created problems for shared media.

Instead, we now manage a backlog in stream-transport, and slow
clients are removed once this backlog exceeds a maximum duration,
currently hardcoded.

Fixes #80
2019-10-21 13:49:54 +02:00
Göran Jönsson
d519f47402 rtsp-session: clean up comment extra-timeout 2019-10-18 09:19:59 +02:00
Muhammet Ilendemli
d9a182c476 rtsp-client: Generate correct URI for MIKEY in ANNOUNCE responses
Instead of hardcoding the URI, take the actual URI (and especially the correct port)
from the RTSP context.

Fixes #84
2019-10-17 14:05:12 +03:00
Kristofer
1a01d20e40 rtsp-client: Lock shared media
For shared media we got race conditions. Concurrently rtsp clients might
suspend or unsuspend the shared media and thus change the state without
the clients expecting that.
By introducing a lock that can be taken by callers such as rtsp_client
one can force rtsp clients calling, eg. PLAY, SETUP and that uses shared media,
to handle the media sequentially thus allowing one client to finish its
rtsp call before another client calls on the same media.

https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/issues/86
Fixes #86
2019-10-16 13:20:54 +00:00
Göran Jönsson
74b19b3709 rtsp-session: add property extra-timeout
Extra time to add to the timeout, in seconds. This only
affects the time until a session is considered timed out
and is not signalled in the RTSP request responses.
Only the value of the timeout property is signalled in the
request responses.
2019-10-16 06:49:49 +00:00
Adam x Nilsson
0b1b6670c8 rtsp-stream : fix race condition in send_tcp_message
If one thread is inside the send_tcp_message function and are done
sending rtp or rtcp messages so the n_outstanding variable is zero
however have not exit the loop sending the messages. While sending its
messages, transports have been added or removed to the transport list,
so the cache should be updated. If now an additional thread comes to
the function send_tcp_message and trying to send rtp messages it will
first destroy the rtp cache that is still being iterated trough by the
first thread.

Fixes #81
2019-10-14 19:40:00 +00:00
Tim-Philipp Müller
6b3bd23e40 Remove autotools build
Replaced by Meson.

Maybe we can now use the meson pkgconfig module
for .pc files? (Does it support uninstalled now?)
2019-10-13 13:52:37 +01:00
Adam x Nilsson
f1d2a0cae9 rtsp-media: Use lock in gst_rtsp_media_is_receive_only 2019-10-04 07:59:02 +00:00
David Svensson Fors
e16867b161 rtsp-media: Unblock all streams
When unsuspending and going to PLAYING, unblock all streams instead of
only those that are linked (the linked streams are the ones for which
SETUP has been called). GST_FLOW_NOT_LINKED will be returned when
pushing buffers on unlinked streams.

This change is because playback using single-threaded demuxers like
matroska-demux could be blocked if SETUP was not called for all media.
Demuxers that use GstFlowCombiner (including gstoggdemux, gstavidemux,
gstflvdemux, qtdemux, and matroska-demux) will handle
GST_FLOW_NOT_LINKED automatically.

Fixes #39
2019-10-03 11:54:15 +00:00
Göran Jönsson
18f4f4e509 rtsp-media: Wait on async when needed.
Wait on asyn-done when needed in gst_rtsp_media_seek_trickmode.

In the unit test the pause from adjust_play_mode will cause a preroll
and after that async-done will be produced.
Without this patch there are no one consuming this async-done and when
later when seek fluch is done in gst_rtsp_media_seek_trickmode then it
wait for async-done. But then it wrongly find the async-done prodused by
adjus_play_mode and continue executing without waiting for the preroll
to finish.
2019-10-02 15:00:23 +00:00
Kristofer Bjorkstrom
7e1edcf1a4 rtsp-client: RTP Info when completed_sender
Change condition that should be fulfilled regarding RTPInfo.
Replace !gst_rtsp_media_is_receive_only with
gst_rtsp_media_has_completed_sender. It is more correct to actually look
for a sender pipeline that is complete. Only then a RTPInfo should
exist.

gst_rtsp_media_is_receive_only gives different answears depending on
state of server.
If Describe is called wth URL+options for backchannel SDP will give only
audio and only backchannel a=sendonly
If Describe is called on URL+options that gives both audio and video
direction from server to client, pipelines are created. Thus
receive_only will return false, even though Setup only would setup
backchannel.

RTP-Info is only for outgoing streams. Thus one should look if outgoing
streams are complete.
2019-10-01 12:01:26 +02:00
Kristofer
d7ae39657d rtsp-client: RTP Info exists conditionally in PLAY
If RTP Info is missing and it is not a receiver only, eg. audio
backchannel. Then return GST_RTSP_STS_INTERNAL_SERVER_ERROR.
In rfc2326 it says RTP-info is req. but in RFC7826 it is conditional.

Since 1.14 there is audio backchannel support. Thus RTP-info is
conditional now. When audio backchannel only mode, there is no RTP-info.

Fixes #82
2019-09-25 09:14:08 +00:00
Kristofer Björkström
f834700eff rtsp-client: RTP Info must exist in PLAY response
If RTP Info is missing. Then return GST_RTSP_STS_INTERNAL_SERVER_ERROR

Fixes #76
2019-09-04 07:34:37 +00:00
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
7073ade1a6 rtsp-media: add missing Since tag 2019-08-12 16:09:02 +00:00
Mathieu Duponchelle
72504eee99 rtsp-client: define all seek accuracy flags from setup_play_mode
We then pass those to adjust_play_mode, which needs to operate
on the "final" seek flags, as previously the code in rtsp-media
was assuming that accuracy seek flags (accurate / key_unit) should
not be set if the flags passed to the seek method were already set.
2019-08-07 18:04:03 +02:00
Sebastian Dröge
446315b36c rtsp-media: Try to get dynamic payloaders by name from their bin first
First try "pay", then "pay_%s" (where %s == pad name). And only then
fall back to the code that simply takes the first payloader that is
found.

The current code usually works (but is racy) because it will always take
the payloader that was last added (due to g_list_prepend() when adding
elements) in pad-added and that's usually the correct one. But if a new
payloader is added between pad-added and us trying to get it, we would
get the wrong payloader.
2019-07-22 19:44:28 +03:00
Göran Jönsson
d1d404912e rtsp-stream: Not wait on receiver streams when pre-rolling
Without this patch there are problem pre-rolling when using audio back
channel.

Without this patch a probe will be created for all streams including
the stream for audio backchannel. To pre-roll all this pads have to
receive data. Since the stream for audio backchannel is a receiver this
will never happen.

The solution is to never create any probes for streams that are for
incomming data and instead set them as blocking already from beginning.
2019-06-28 13:31:34 +02:00
Tim-Philipp Müller
7b2adb015d onvif-media: fix "void function returning a value" compiler warning 2019-06-25 13:19:44 +01:00
Mathieu Duponchelle
ab37286300 rtsp-media: make sure streams are blocked when sending seek
The recent ONVIF work exposed a race condition when dealing with
multiple streams: one of the sinks may preroll before other streams
have started flushing. This led to the pipeline posting async-done
prematurely, when some streams were actually still in the middle
of performing a flushing seek. The newly-added code looks up a
sticky segment event on the first stream in order to respond to
the PLAY request with accurate Scale and Speed headers. In the
failure condition, the first stream was flushing, and thus had
no sticky segment event, leading to the PLAY request failing,
and in turn the test.
2019-06-12 22:19:27 +02:00
Michael Bunk
b545c10e8f Fix typos 2019-06-07 13:42:24 +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
Mathieu Duponchelle
7640cb8f21 rtsp-client: add gst_rtsp_client_get_stream_transport()
This will be used in the onvif tests in order to validate the
data transmitted over TCP: for streaming to continue after a
data message has been provided to client->send_func, the client
is responsible for marking the message as sent on the relevant
stream transport.
2019-06-06 18:45:17 +02:00
Mathieu Duponchelle
52d20df0f4 client: Scale implies TRICK_MODE 2019-06-04 14:32:51 +02:00
Mathieu Duponchelle
b9cc3e867a client: compare booleans, not pointers to them 2019-06-04 14:32:51 +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
65d9aa327c rtsp-client: allow sub classes to adjust the seek
Adds a new virtual function, adjust_play_mode(), that allows
sub classes to adjust the seek done on the media. The sub class can
modify the values of the the seek flags and the rate.

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
Mathieu Duponchelle
da22533780 doc: remove xml from comments 2019-05-29 23:20:09 +02:00
Thibault Saunier
f4b20b010d doc: Fix some docstrings 2019-05-13 17:00:00 -04:00
Thibault Saunier
5b039416db docs: Port to hotdoc 2019-05-13 11:38:39 -04:00
Sebastian Dröge
abf6be1d7a rtsp-server: Fix various Since markers 2019-04-23 15:09:34 +03:00
Sebastian Dröge
8d3bef4c1e rtsp-server: Add various Since: 1.14 markers 2019-04-23 15:01:32 +03:00
Sebastian Dröge
802a648723 rtsp-server: Add various missing Since: 1.16 markers 2019-04-23 14:56:42 +03:00
Sebastian Dröge
640c5bba41 rtspclientsink: Set async-handling=false for the internal bins
Without this we can easily run into a race condition with async state changes:
- the pipeline is doing an async state change
- we set the internal bins to PLAYING but that's ignored because an
  async state change is currently pending
- the async state change finishes but does not change the state of the
  internal bins because of locked_state==TRUE
- the internal bins stay in PAUSED forever
2019-04-22 10:38:08 +00:00
Sebastian Dröge
c4653ef38b rtspclientsink: Use write_messages() API to send buffer lists in one go
And to write messages with multiple memories also via writev().
2019-04-22 10:38:08 +00:00
Kristofer Bjorkstrom
b578628dc1 rtsp-client: Handle Content-Length limitation
Add functionality to limit the Content-Length.
API addition, Enhancement.

Define an appropriate request size limit and reject requests
exceeding the limit with response status 413 Request Entity Too Large

Related to !182
2019-04-22 09:17:13 +00:00
Sebastian Dröge
0f0a10525a rtspclientsink: Notify the stream transport about each written message
Otherwise it will never try to send us the next one: it tries to keep
exactly one message in-flight all the time.

In gst-rtsp-server this is done asynchronously via the GstRTSPWatch but
in the client sink we always write data out synchronously.
2019-04-15 17:34:56 +00:00
Göran Jönsson
3cfe88632f rtsp_server: Free thread pool before clean transport cache
If not waiting for free thread pool before clean transport caches, there
can be a crash if a thread is executing in transport list loop in
function send_tcp_message.

Also add a check if priv->send_pool in on_message_sent to avoid that a
new thread is pushed during wait of free thread pool. This is possible
since when waiting for free thread pool mutex have to be unlocked.
2019-04-11 08:02:52 +02:00
Ulf Olsson
d09b7c8e4f rtsp-stream: Add support for GCM (RFC 7714)
Follow-up to !198
2019-04-10 08:43:29 +00:00
Erlend Eriksen
a9d3bcc03e session pool: fix missing klass-> in klass->create_session 2019-03-28 00:27:37 +01: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
Göran Jönsson
afb27f91cf rtsp-server: remove recursive behavior
Introduce a threadpool to send rtp and rtcp to avoid recursive behavior.
2019-02-02 10:42:33 +00:00
Sebastian Dröge
4be7424de5 rtsp-client: Only allow to set either a send_func or send_messages_func but not both
And route all messages through the send_func if no send_messages_func
was provided.

We otherwise break backwards compatibility.
2019-01-30 14:40:09 +02:00
Sebastian Dröge
c372643e1e rtsp-client: Add support for sending buffer lists directly
Fixes https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/issues/29
2019-01-30 14:40:09 +02:00
Sebastian Dröge
d708f9736b rtsp-server: Add support for buffer lists
This adds new functions for passing buffer lists through the different
layers without breaking API/ABI, and enables the appsink to actually
provide buffer lists.

This should already reduce CPU usage and potentially context switches a
bit by passing a whole buffer list from the appsink instead of
individual buffers. As a next step it would be necessary to
  a) Add support for a vector of data for the GstRTSPMessage body
  b) Add support for sending multiple messages at once to the
    GstRTSPWatch and let it be handled internally
  c) Adding API to GOutputStream that works like writev()

Fixes https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/issues/29
2019-01-30 14:39:50 +02:00
Benjamin Berg
621e140a8e client: Fix crash in close handler
The close handler could trigger a crash because it invalidated the
watch_context while still leaving a source attached to it which would be
cleaned up at a later point.
2019-01-29 18:34:08 +00:00
Edward Hervey
a48711fa9d rtsp-stream: Use cached address when allocating sockets
If an address/port was previously decided upon (ex: multicast in the
SDP), then use that instead of re-creating another one

Fixes https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/issues/57
2019-01-29 14:42:35 +01:00
Lars Wiréen
ae32203cb0 rtsp-media: Fix race codition in finish_unprepare
The previous fix for race condition around finish_unprepare where the
function could be called twice assumed that the status wouldn't change
during execution of the function. This assumption is incorrect as the
state may change, for example if an error message arrives from the
pipeline bus.

Instead a flag keeping track on whether the finish_unprepare function
is currently executing is introduced and checked.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/issues/59
2019-01-25 12:44:23 +00:00
Patricia Muscalu
3be1b9bba8 Add source elements to the pipeline before activation
In plug_src we changed the element state before adding it to
the owner container. This prevented the pipeline from intercepting
a GST_STREAM_STATUS_TYPE_CREATE message from the pad in order
to assign a custom task pool.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/issues/53
2018-12-06 08:59:04 +00:00
Patricia Muscalu
4370f3a901 rtsp-media: Update priv->blocked when linked streams are unblocked.
Media is considered to be blocked when all streams that belong to
that media are blocked.
This patch solves the problem of inconsistent updates of
priv->blocked that are not synchronized with the media state.
2018-11-19 11:35:26 +00:00
Patricia Muscalu
146b3da174 rtsp-media: Don't block streams before seeking
Before the seek operation is performed on media, it's required that
its pipeline is prepared <=> the pipeline is in the PAUSED state.
At this stage, all transport parts (transport sinks) have been successfully
added to the pipeline and there is no need for blocking the streams.
2018-11-19 11:35:26 +00:00
Linus Svensson
185385924d rtsp-stream: Use seqnum-offset for rtpinfo
The sequence number in the rtpinfo is supposed to be the first RTP
sequence number. The "seqnum" property on a payloader is supposed to be
the number from the last processed RTP packet. The sequence number for
payloaders that inherit gstrtpbasepayload will not be correct in case of
buffer lists. In order to fix the seqnum property on the payloaders
gst-rtsp-server must get the sequence number for rtpinfo elsewhere and
"seqnum-offset" from the "stats" property contains the value of the
very first RTP packet in a stream. The server will, however, try to look
at the last simple in the sink element and only use properties on the
payloader in case there no sink elements yet, and by looking at the last
sample of the sink gives the server full control of which RTP packet it
looks at. If the payloader does not have the "stats" property, "seqnum"
is still used since "seqnum-offset" is only present in as part of
"stats" and this is still an issue not solved with this patch.

Needed for gst-plugins-base!17
2018-11-14 12:29:58 +00:00
Linus Svensson
1c4d3b36fb rtsp-stream: Plug memory leak
Attaching a GSource to a context will increase the refcount. The idle
source will never be free'd since the initial reference is never
dropped.
2018-11-14 12:29:58 +00:00
Mathieu Duponchelle
f43df76ee7 meson: add new onvif types 2018-11-01 14:20:36 +01:00
Sebastian Dröge
961de06be2 Add ONVIF subclass headers to the installed headers in meson.build too 2018-11-01 12:49:51 +02:00
Sebastian Dröge
5392cbba8a rtsp-server: Declare GstRTSPServer struct before anything else
It's needed by all kinds of other headers, including the ones that are
required for defining the GstRTSPServer struct itself and its API.
2018-11-01 11:29:01 +02:00
Sebastian Dröge
d525000f6a Mark all ONVIF-specific subclasses as Since 1.14 2018-11-01 10:23:02 +02:00
Sebastian Dröge
84a7f459a1 Include ONVIF types from single-include rtsp-server.h
... by actually making it a single-include header and moving everything
related to the GstRTSPServer type to rtsp-server-object.h instead.
Otherwise there are too many circular includes.

https://bugzilla.gnome.org/show_bug.cgi?id=797361
2018-11-01 10:18:22 +02:00
Göran Jönsson
7cfd59820a rtsp-stream: use idle source in on_message_sent
When the underlying layers are running on_message_sent, this sometimes
causes the underlying layer to send more data, which will cause the
underlying layer to run callback on_message_sent again. This can go on
and on.

To break this chain, we introduce an idle source that takes care of
sending data if there are more to send when running callback

https://bugzilla.gnome.org/show_bug.cgi?id=797289
2018-10-23 08:18:52 +01:00
Edward Hervey
ebafccb65a rtsp-client: Remove timeout GSource on cleanup
Avoids ending up with races where a timeout would still be around
*after* a client was gone. This could happen rather easily in
RTSP-over-HTTP mode on a local connection, where each RTSP message
would be sent as a different HTTP connection with the same tunnelid.

If not properly removed, that timeout would then try to free again
a client (and its contents).
2018-10-22 09:35:54 +02:00
Tim-Philipp Müller
22ced50da5 autotools: fix distcheck 2018-10-04 14:31:59 +01:00
Ognyan Tonchev
7b5e232a9e onvif: encapsulate onvif part into a bin
...and thus do not let onvif affect pipelines latency

https://bugzilla.gnome.org/show_bug.cgi?id=797174
2018-10-03 13:26:36 +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
62d4c0b179 libs: fix API export/import and 'inconsistent linkage' on MSVC
Export rtsp-server library API in headers when we're building the
library itself, otherwise import the API from the headers.

This fixes linker warnings on Windows when building with MSVC.

Fix up some missing config.h includes when building the lib which
is needed to get the export api define from config.h

https://bugzilla.gnome.org/show_bug.cgi?id=797185
2018-09-24 09:36:21 +01:00
Edward Hervey
ff51e9a68d rtsp-media-factory: Add missing break statements
This resulted in warnings/assertions whenever one accessed the
max-mcast-ttl property.

CID #1439515
CID #1439523
2018-09-19 14:31:56 +02: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
8a7f5cfe5f 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:42:48 +05:30
Matthew Waters
5bd835a196 meson: add pkg-config file for the rtspclientsink plugin 2018-08-31 18:11:04 +10: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
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
Mathieu Duponchelle
c414158022 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:31:41 +03:00
Sebastian Dröge
d06f3af0be Revert "rtsp-stream: avoid duplicating the first multicast client"
This reverts commit 3357094440.

Commits where accidentially squashed together
2018-08-14 14:25:53 +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
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
Thibault Saunier
20dc49749c rtsp-server: Add gstreamer-base gir dir in autotools 2018-08-06 15:33:04 -04:00