Commit graph

1579 commits

Author SHA1 Message Date
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 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 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 a44a729acb meson: add gobject-cast-checks, glib-asserts, glib-checks options 2018-09-19 12:21:30 +01:00
Tim-Philipp Müller ffebe3dd84 meson: add option to disable build of rtspclientsink plugin 2018-09-19 12:17:57 +01:00
Tim-Philipp Müller 46d8bb2881 meson: re-arrange options 2018-09-19 12:10:14 +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
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
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
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
Sebastian Dröge 98b480fae9 examples: Fix indentation 2018-08-14 14:10:56 +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
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
Nirbheek Chauhan 3baf94ed55 meson: Convert common options to feature options
These are necessary for gst-build to set options correctly. The
remaining automagic option is cgroup support in examples.

https://bugzilla.gnome.org/show_bug.cgi?id=795107
2018-07-27 18:48:46 +05:30
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
David Svensson Fors 287345f6ac rtsp-client: Use fixed backlog size
Change to using a fixed backlog size WATCH_BACKLOG_SIZE.

Preparation for the next commit, which changes to a different way of
avoiding both deadlocks and unlimited memory usage with the watch
backlog.
2018-07-23 17:44:15 +03:00
Carlos Rafael Giani 12c2dd6e1c rtsp-media: unref clock (if set) when finalizing
https://bugzilla.gnome.org/show_bug.cgi?id=796814
2018-07-16 23:56:09 +01:00
Carlos Rafael Giani e99471a56b rtsp-media: add gst_rtsp_media_*_set_clock to docs
https://bugzilla.gnome.org/show_bug.cgi?id=796814
2018-07-16 23:55:37 +01:00
Tim-Philipp Müller 7f7a210b84 media-factory: unref old clock when setting new clock
https://bugzilla.gnome.org/show_bug.cgi?id=796724
2018-07-12 19:02:40 +01:00
Brendan Shanks f304096994 media-factory: unref clock in finalize
https://bugzilla.gnome.org/show_bug.cgi?id=796724
2018-07-12 19:02:40 +01:00
Tim-Philipp Müller 1cd6c0340e rtsp-onvif-media: fix g-ir-scanner warnings 2018-07-12 19:02:40 +01:00
Tim-Philipp Müller 318525570f .gitignore: add another example binary 2018-07-10 23:56:23 +01:00
Tim-Philipp Müller c2e3aa49f8 meson: add new test-appsrc2 example to meson build 2018-07-10 23:55:20 +01:00
Tim-Philipp Müller 35e284a946 examples: fix build of new test-appsrc2 example
Need to link against libgstapp-1.0.
2018-07-10 23:53:41 +01:00
Jan Schmidt b6c3960f11 examples: Add test-appsrc2
Add an example of feeding both audio and video into an RTSP
pipeline via appsrc.
2018-07-11 01:25:51 +10:00
Louis-Francis Ratté-Boulianne 604240f7eb client: Strip transport parts as whitespaces could be around commas
https://bugzilla.gnome.org/show_bug.cgi?id=758428
2018-07-06 16:13:33 -04: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