platform/upstream/gstreamer.git
3 years agortspclientsink: mark cached caps as maybe-leaked to make leaks tracer happy
Tim-Philipp Müller [Mon, 15 Feb 2021 12:26:30 +0000 (12:26 +0000)]
rtspclientsink: mark cached caps as maybe-leaked to make leaks tracer happy

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/190>

3 years agortspclientsink: add unit test for potential shutdown deadlock
Tim-Philipp Müller [Mon, 15 Feb 2021 12:07:45 +0000 (12:07 +0000)]
rtspclientsink: add unit test for potential shutdown deadlock

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/189>

3 years agortspclientsink: fix deadlock on shutdown before preroll
Tim-Philipp Müller [Mon, 15 Feb 2021 12:01:34 +0000 (12:01 +0000)]
rtspclientsink: fix deadlock on shutdown before preroll

Fixes https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/issues/130

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/189>

3 years agortsp-stream: avoid deadlock in send_func
Branko Subasic [Mon, 1 Feb 2021 11:16:46 +0000 (12:16 +0100)]
rtsp-stream: avoid deadlock in send_func

Currently the send_func() runs in a thread of its own which is started
the first time we enter handle_new_sample(). It runs in an outer loop
until priv->continue_sending is FALSE, which happens when a TEARDOWN
request is received. We use a local variable, cont, which is initialized
to TRUE, meaning that we will always enter the outer loop, and at the
end of the outer loop we assign it the value of priv->continue_sending.

Within the outer loop there is an inner loop, where we wait to be
signaled when there is more data to send. The inner loop is exited when
priv->send_cookie has changed value, which it does when more data is
available or when a TEARDOWN has been received.

But if we get a TEARDOWN before send_func() is entered we will get stuck
in the inner loop because no one will increase priv->session_cookie
anymore.

By not entering the outer loop in send_func() if priv->continue_sending
is FALSE we make sure that we do not get stuck in send_func()'s inner
loop should we receive a TEARDOWN before the send thread has started.

Change-Id: I7338a0ea60ea435bb685f875965f5165839afa20
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/187>

3 years agortsp-client: cleanup transports during TEARDOWN
Branko Subasic [Fri, 22 Jan 2021 07:58:23 +0000 (08:58 +0100)]
rtsp-client: cleanup transports during TEARDOWN

When tunneling RTP over RTSP the stream transports are stored in a hash
table in the GstRTSPClientPrivate struct. They are used for, among other
things, mapping channel id to stream transports when receiving data from
the client. The stream tranports are created and added to the hash table
in handle_setup_request(), but unfortuately they are not removed in
handle_teardown_request(). This means that if the client sends data on
the RTSP connection after it has sent the TEARDOWN, which is often the
case when audio backchannel is enabled, handle_data() will still be able
to map the channel to a session transport and pass the data along to it.
Which eventually leads to a failing assert in gst_rtsp_stream_recv_rtp()
because the stream is no longer joined to a bin.
We avoid this by removing the stream transports from the hash table when
we handle the TEARDOWN request.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/184>

3 years agortspclientsink: Add "update-sdp" signal that allows updating the SDP before sending...
Sebastian Dröge [Tue, 15 Dec 2020 09:07:01 +0000 (11:07 +0200)]
rtspclientsink: Add "update-sdp" signal that allows updating the SDP before sending it to the server

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/178>

3 years agoAdd test cases for mountpoint of '/'
John Lindgren [Wed, 23 Dec 2020 18:54:54 +0000 (13:54 -0500)]
Add test cases for mountpoint of '/'

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/168>

3 years agoMake a mount point of "/" work correctly.
John Lindgren [Thu, 5 Nov 2020 21:02:49 +0000 (16:02 -0500)]
Make a mount point of "/" work correctly.

As far as I can tell, this is neither explicitly allowed nor
forbidden by RFC 7826.

Meanwhile, URLs such as rtsp://<IP>:554 or rtsp://<IP>:554/ are in
use in the wild (presumably with non-GStreamer servers).

GStreamer's prior behavior was confusing, in that
gst_rtsp_mount_points_add_factory() would appear to accept a mount
path of "" or "/", but later connection attempts would fail with a
"media not found" error.

This commit makes a mount path of "/" work for either form of URL,
while an empty mount path ("") is rejected and logs a warning.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/168>

3 years agortspclientsink: Use proper types instead of G_TYPE_POINTER for the RTSP messages...
Sebastian Dröge [Tue, 15 Dec 2020 08:18:16 +0000 (10:18 +0200)]
rtspclientsink: Use proper types instead of G_TYPE_POINTER for the RTSP messages in the "handle-request" signal

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/177>

3 years agortsp-media: Only count senders when counting blocked streams
Tobias Ronge [Thu, 17 Dec 2020 14:27:27 +0000 (15:27 +0100)]
rtsp-media: Only count senders when counting blocked streams

Only sender streams sends the GstRTSPStreamBlocking message, so only
these should be counted before setting media status to prepared.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/180>

3 years agortspclientsink add proper support for uri queries
Jimmi Holst Christensen [Wed, 21 Oct 2020 13:38:43 +0000 (15:38 +0200)]
rtspclientsink add proper support for uri queries

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/166>

3 years agortsp-client: Only unref client watch context on finalize, to avoid deadlock
Lawrence Troup [Mon, 14 Dec 2020 01:12:38 +0000 (14:12 +1300)]
rtsp-client: Only unref client watch context on finalize, to avoid deadlock

Fixes https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/issues/127

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/176>

3 years agortsp-stream: collect a clock_rate when blocking
Mathieu Duponchelle [Wed, 18 Nov 2020 19:36:50 +0000 (20:36 +0100)]
rtsp-stream: collect a clock_rate when blocking

This lets us provide a clock_rate in a fashion similar to the
other code paths in get_rtpinfo()

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/174>

3 years agortsp-media: Use guint64 for setting the size-time property on rtpstorage
Sebastian Dröge [Mon, 16 Nov 2020 08:34:41 +0000 (10:34 +0200)]
rtsp-media: Use guint64 for setting the size-time property on rtpstorage

Otherwise this will cause memory corruption as the property expects a 64
bit integer.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/169>

3 years agortsp-media: Ignore GstRTSPStreamBlocking from incomplete streams
David Phung [Tue, 3 Nov 2020 15:56:28 +0000 (16:56 +0100)]
rtsp-media: Ignore GstRTSPStreamBlocking from incomplete streams

To prevent cases with prerolling when the inactive stream prerolls first
and the server proceeds without waiting for the active stream, we will
ignore GstRTSPStreamBlocking messages from incomplete streams. When
there are no complete streams (during DESCRIBE), we will listen to all
streams.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/167>

3 years agomedia test: Add test for seeking one active stream with a demuxer
Kristofer Björkström [Wed, 28 Oct 2020 20:48:06 +0000 (21:48 +0100)]
media test: Add test for seeking one active stream with a demuxer

Add another seek_one_active_stream test but with a demuxer. The demuxer
will flush both streams in opposed to the existing test which only
flushes the active stream. This will help exposing problems with the
prerolling process after a flushing seek.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/167>

3 years agoMeson: Use pkg-config generator
Xavier Claessens [Mon, 29 Oct 2018 13:19:33 +0000 (09:19 -0400)]
Meson: Use pkg-config generator

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/1>

3 years agomeson: update glib minimum version to 2.56
Sebastian Dröge [Mon, 19 Oct 2020 08:25:25 +0000 (11:25 +0300)]
meson: update glib minimum version to 2.56

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/164>

3 years agortsp-media-factory: expose API to disable RTCP
Mathieu Duponchelle [Fri, 4 Sep 2020 19:14:35 +0000 (21:14 +0200)]
rtsp-media-factory: expose API to disable RTCP

This is supported by the RFC, and can be useful on systems where
allocating two consecutive ports is problematic, and RTCP is not
necessary.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/159>

3 years agogit: use our standard pre commit hook
Mathieu Duponchelle [Thu, 8 Oct 2020 21:45:24 +0000 (23:45 +0200)]
git: use our standard pre commit hook

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/162>

3 years agortsp-stream: make use of blocked_running_time in query_position
Mathieu Duponchelle [Thu, 8 Oct 2020 20:17:16 +0000 (22:17 +0200)]
rtsp-stream: make use of blocked_running_time in query_position

When blocking, the sink element will not have received a buffer
yet and the position query will fail. Instead, we make use of
the running time of the buffer we blocked on.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/160>

3 years agortsp-stream: collect rtp info when blocking
Mathieu Duponchelle [Mon, 5 Oct 2020 22:04:17 +0000 (00:04 +0200)]
rtsp-stream: collect rtp info when blocking

We don't unblock the stream anymore before replying to the
play request (883ddc72bb5bc57c95a9e167814d1ac53fe1b443),
so the sinks don't have a last-sample after potentially flush
seeking. seek_trickmode waits for preroll however, which means
the stream will block and wait for a first buffer. Subsequent
calls to get_rtpinfo() can thus make use of the information.

See https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/issues/115

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/160>

3 years agoexamples: Add an example for loop playback
Seungha Yang [Sun, 27 Sep 2020 11:09:22 +0000 (20:09 +0900)]
examples: Add an example for loop playback

This demo example shows a way of file loop playback of a given source.
Note that client seek request is not properly implemented yet.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/154>

3 years agortsp-media: Plug memory leak
David Phung [Mon, 28 Sep 2020 20:03:47 +0000 (22:03 +0200)]
rtsp-media: Plug memory leak

The get-storage signal of rtpbin increases the ref count of the storage.
So we have to unref it after usage.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/155>

3 years agortsp-media: Get rates only on sender streams
Guiqin Zou [Fri, 11 Sep 2020 13:46:41 +0000 (15:46 +0200)]
rtsp-media: Get rates only on sender streams

When play a media with both sender and receiver stream, like ONVIF
back channel audio in, gst_rtsp_media_get_rates call
gst_rtsp_stream_get_rates for each stream to set the rates. But
gst_rtsp_stream_get_rates return false for the receiver steam, which
lead a g_assert crash.

Instead to get rates on all streams, now just get rates on sender
streams.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/150>

3 years agortsp-media: set a 0 storage size for TCP receivers
Mathieu Duponchelle [Fri, 4 Sep 2020 22:30:42 +0000 (00:30 +0200)]
rtsp-media: set a 0 storage size for TCP receivers

ulpfec correction is obviously useless when receiving a stream
over TCP, and in TCP modes the rtp storage receives non
timestamped buffers, causing it to queue buffers indefinitely,
until the queue grows so large that sanity checks kick in and
warnings start to get emitted.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/149>

3 years agortsp-stream: preroll on gap events
Mathieu Duponchelle [Fri, 21 Aug 2020 01:02:40 +0000 (03:02 +0200)]
rtsp-stream: preroll on gap events

This allows negotiating a SDP with all streams present, but only
start sending packets at some later point in time

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/146>

3 years agortsp-media: do not unblock on unsuspend
Mathieu Duponchelle [Tue, 25 Aug 2020 14:10:36 +0000 (16:10 +0200)]
rtsp-media: do not unblock on unsuspend

rtsp_media_unsuspend() is called from handle_play_request()
before sending the play response. Unblocking the streams here
was causing data to be sent out before the client was ready
to handle it, with obvious side effects such as initial packets
getting discarded, causing decoding errors.

Instead we can simply let the media streams be unblocked when
the state of the media is set to PLAYING, which occurs after
sending the play response.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/147>

3 years agoci: include template from gst-ci master branch again
Tim-Philipp Müller [Tue, 8 Sep 2020 16:30:49 +0000 (17:30 +0100)]
ci: include template from gst-ci master branch again

3 years agoBack to development
Tim-Philipp Müller [Tue, 8 Sep 2020 15:58:58 +0000 (16:58 +0100)]
Back to development

3 years agoRelease 1.18.0
Tim-Philipp Müller [Mon, 7 Sep 2020 23:08:29 +0000 (00:08 +0100)]
Release 1.18.0

3 years agoRelease 1.17.90
Tim-Philipp Müller [Thu, 20 Aug 2020 15:15:06 +0000 (16:15 +0100)]
Release 1.17.90

3 years agortsp-thread-pool.c: fix clang 10 warning
Jordan Petridis [Mon, 3 Aug 2020 16:34:30 +0000 (19:34 +0300)]
rtsp-thread-pool.c: fix clang 10 warning

clang 10 is complaining about incompatible types due to the
glib typesystem.

```
../subprojects/gst-rtsp-server/gst/rtsp-server/rtsp-thread-pool.c:534:10: error: incompatible pointer types passing 'typeof ((((void *)0))) *' (aka 'void **') to parameter of type 'GThreadPool **' (aka 'struct _GThreadPool **') [-Werror,-Wincompatible-pointer-types]
```

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/145>

3 years agortsp-thread-pool.c: fix clang 10 warning
Jordan Petridis [Mon, 3 Aug 2020 16:34:30 +0000 (19:34 +0300)]
rtsp-thread-pool.c: fix clang 10 warning

clang 10 is complaining about incompatible types due to the
glib typesystem.

```
../subprojects/gst-rtsp-server/gst/rtsp-server/rtsp-thread-pool.c:534:10: error: incompatible pointer types passing 'typeof ((((void *)0))) *' (aka 'void **') to parameter of type 'GThreadPool **' (aka 'struct _GThreadPool **') [-Werror,-Wincompatible-pointer-types]
```

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/145>

4 years agortsp-sdp: Fix resource leak in mikey messsage
Srimanta Panda [Wed, 15 Jul 2020 09:19:40 +0000 (11:19 +0200)]
rtsp-sdp: Fix resource leak in mikey messsage

Fixed a resource leak for mikey message while adding crypto session
failed.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/144>

4 years agomeson: set release date from .doap file for releases
Tim-Philipp Müller [Wed, 8 Jul 2020 16:28:57 +0000 (17:28 +0100)]
meson: set release date from .doap file for releases

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/143>

4 years agortsp-stream: explicitly set caps on udpsrc elements
Mathieu Duponchelle [Thu, 2 Jul 2020 21:52:47 +0000 (23:52 +0200)]
rtsp-stream: explicitly set caps on udpsrc elements

This causes them to send caps events before data flow, which is
usually a pretty correct thing to do!

Not doing so manifested in a bug where ssrcdemux wouldn't forward
the caps it had received with an extra ssrc field, as it hadn't
received any caps event.

Fixes #85

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/141>

4 years agoBack to development
Tim-Philipp Müller [Fri, 3 Jul 2020 01:04:04 +0000 (02:04 +0100)]
Back to development

4 years agoRelease 1.17.2
Tim-Philipp Müller [Thu, 2 Jul 2020 23:33:54 +0000 (00:33 +0100)]
Release 1.17.2

4 years agodoc: Stop documenting properties from parents
Thibault Saunier [Sat, 20 Jun 2020 02:55:54 +0000 (22:55 -0400)]
doc: Stop documenting properties from parents

4 years agodocs: Fix version in the plugins cache
Sebastian Dröge [Mon, 22 Jun 2020 17:04:45 +0000 (20:04 +0300)]
docs: Fix version in the plugins cache

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/138>

4 years agortspclientsink: Don't call gst_ghost_pad_construct() anymore
Sebastian Dröge [Mon, 22 Jun 2020 09:33:32 +0000 (12:33 +0300)]
rtspclientsink: Don't call gst_ghost_pad_construct() anymore

It's deprecated, unneeded and doesn't do anything anymore.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/138>

4 years agoBack to development
Tim-Philipp Müller [Fri, 19 Jun 2020 23:28:28 +0000 (00:28 +0100)]
Back to development

4 years agoRelease 1.17.1
Tim-Philipp Müller [Fri, 19 Jun 2020 18:24:38 +0000 (19:24 +0100)]
Release 1.17.1

4 years agortsp-media: Add/configure transports when completing the pipeline
Sebastian Dröge [Mon, 15 Jun 2020 16:45:38 +0000 (19:45 +0300)]
rtsp-media: Add/configure transports when completing the pipeline

Otherwise the transports are not set up yet during the PLAY request
handling when unsuspending (and thus unblocking) the media.

In case of live pipelines this then causes the first few packets to go
to the sinks before they know what to do with them, and they simply
discard them which is rather suboptimal in case of keyframes.

For non-live pipelines this is not a problem because the sink will still
be PAUSED and as such not send out the data yet but wait until it goes
to PLAYING, which is late enough.

Adding the transports multiple times is not a problem: if the transport
is already added it won't be added another time and TRUE will be
returned.

This fixes a regression introduced by a7732a68e8bc6b4ba15629c652056c240c624ff0
before 1.14.0.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/issues/107

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/135>

4 years agortsp-media: Fix misleading comment
Sebastian Dröge [Mon, 15 Jun 2020 16:45:21 +0000 (19:45 +0300)]
rtsp-media: Fix misleading comment

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/135>

4 years agortsp-media: Make sure to also unblock pads when going to PLAYING while buffering
Sebastian Dröge [Mon, 15 Jun 2020 15:29:13 +0000 (18:29 +0300)]
rtsp-media: Make sure to also unblock pads when going to PLAYING while buffering

The pad probes are not needed anymore at this point and later when
reaching buffering 100% only the state is changed, no unblocking
happens.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/135>

4 years agortsp-media: Remove duplicated media_unblock() function
Sebastian Dröge [Mon, 15 Jun 2020 15:17:40 +0000 (18:17 +0300)]
rtsp-media: Remove duplicated media_unblock() function

It does literally the same as media_streams_set_blocked(FALSE).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/135>

4 years agotest-onvif-server: cast ntp-offset property value to 64 bit
Lenny Jorissen [Fri, 12 Jun 2020 13:38:45 +0000 (15:38 +0200)]
test-onvif-server: cast ntp-offset property value to 64 bit

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/134>

4 years agodocs: Update plugins cache
Thibault Saunier [Tue, 9 Jun 2020 19:21:24 +0000 (15:21 -0400)]
docs: Update plugins cache

4 years agoonvif-media-factory: define autoptr cleanup function
Mathieu Duponchelle [Wed, 10 Jun 2020 11:45:04 +0000 (13:45 +0200)]
onvif-media-factory: define autoptr cleanup function

And have the factory in the onvif-server example inherit from
GstRTSPOnvifMediaFactory.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/133>

4 years agodocs: Update plugins cache
Thibault Saunier [Mon, 8 Jun 2020 14:59:34 +0000 (10:59 -0400)]
docs: Update plugins cache

4 years agotests: enforce I420 format
Guillaume Desmottes [Mon, 8 Jun 2020 07:45:15 +0000 (09:45 +0200)]
tests: enforce I420 format

Test was not enforcing a video format on videotestsrc. I420 was picked as it
was the first format in GST_VIDEO_FORMATS_ALL which will no longer be
true (gst-plugins-base!689).

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/129>

4 years agoplugins: uddate gst_type_mark_as_plugin_api() calls
Mathieu Duponchelle [Fri, 5 Jun 2020 22:41:51 +0000 (00:41 +0200)]
plugins: uddate gst_type_mark_as_plugin_api() calls

4 years agodoc: Require hotdoc >= 0.11.0
Thibault Saunier [Wed, 3 Jun 2020 22:36:25 +0000 (18:36 -0400)]
doc: Require hotdoc >= 0.11.0

4 years agodocs: Update gst_plugins_cache.json
Sebastian Dröge [Wed, 27 May 2020 14:00:05 +0000 (17:00 +0300)]
docs: Update gst_plugins_cache.json

4 years agoplugins: Use gst_type_mark_as_plugin_api() for all non-element plugin types
Sebastian Dröge [Sat, 30 May 2020 20:23:51 +0000 (23:23 +0300)]
plugins: Use gst_type_mark_as_plugin_api() for all non-element plugin types

4 years agomeson: gir: remove bogus sources_top_dir kwarg
Tim-Philipp Müller [Wed, 27 May 2020 22:38:06 +0000 (23:38 +0100)]
meson: gir: remove bogus sources_top_dir kwarg

Doesn't actually exist. Was fixed differently in Meson
so that the user doesn't have to specify it.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/127>

4 years agotests: put registry into tests/check not the gst/ subdir
Tim-Philipp Müller [Wed, 27 May 2020 16:43:43 +0000 (17:43 +0100)]
tests: put registry into tests/check not the gst/ subdir

Underscorify the test name before setting GST_REGISTRY,
so the registry actually ends up in the current build dir
and not some subdir.

For consistency with the other modules, but should also
avoid problems on windows.

Also fix indentation of environment block.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/126>

4 years agotests: fix meson test env setup to make sure we use the right gst-plugin-scanner
Tim-Philipp Müller [Wed, 27 May 2020 16:33:24 +0000 (17:33 +0100)]
tests: fix meson test env setup to make sure we use the right gst-plugin-scanner

If core is built as a subproject (e.g. as in gst-build), make sure to use
the gst-plugin-scanner from the built subproject. Without this, gstreamer
might accidentally use the gst-plugin-scanner from the install prefix if
that exists, which in turn might drag in gst library versions we didn't
mean to drag in. Those gst library versions might then be older than
what our current build needs, and might cause our newly-built plugins
to get blacklisted in the test registry because they rely on a symbol
that the wrongly-pulled in gst lib doesn't have.

This should fix running of unit tests in gst-build when invoking
meson test or ninja test from outside the devenv for the case where
there is an older or different-version gst-plugin-scanner installed
in the install prefix.

In case no gst-plugin-scanner is installed in the install prefix, this
will fix "GStreamer-WARNING: External plugin loader failed. This most
likely means that the plugin loader helper binary was not found or
could not be run. You might need to set the GST_PLUGIN_SCANNER
environment variable if your setup is unusual." warnings when running
the unit tests.

In the case where we find GStreamer core via pkg-config we use
a newly-added pkg-config var "pluginscannerdir" to get the right
directory. This has the benefit of working transparently for both
installed and uninstalled pkg-config files/setups.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/126>

4 years agotests: gst-plugins-base and -bad plugins are required for the unit tests
Tim-Philipp Müller [Wed, 27 May 2020 16:32:02 +0000 (17:32 +0100)]
tests: gst-plugins-base and -bad plugins are required for the unit tests

Make hard requirement until we have more fine-grained control
in the unit tests. Of course the presence of the .pc file doesn't
imply that the plugins we need are actually there, but it's at
least a step in the right direction.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/126>

4 years agotests: pick up rtsp-server plugins from build directory only
Tim-Philipp Müller [Wed, 27 May 2020 16:29:18 +0000 (17:29 +0100)]
tests: pick up rtsp-server plugins from build directory only

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/126>

4 years agortsp-media: wait for all GstRTSPStreamBlocking messages
Ludvig Rappe [Tue, 26 May 2020 13:31:22 +0000 (15:31 +0200)]
rtsp-media: wait for all GstRTSPStreamBlocking messages

Make sure rtsp-media have received a GstRTSPStreamBlocking message from
each active stream when checking if all streams are blocked.

Without this change there will be a race condition when using two or
more streams and rtsp-media receives a GstRTSPStreamBlocking message
from one of the streams. This is because rtsp-media then checks if all
streams are blocked by calling gst_rtsp_stream_is_blocking() for each
stream. This function call returns TRUE if the stream has sent a
GstRTSPStreamBlocking message, however, rtsp-media may have yet to
receive this message. This would then result in that rtsp-media
erroneously thinks it is blocking all streams which could result in
rtsp-media changing state, from PREPARING to PREPARED. In the case of a
preroll, this could result in that rtsp-media thinks that the pipeline
is prerolled even though that might not be the case.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/124>

4 years agortsp-media: update expected_async_done during suspend
Ludvig Rappe [Mon, 4 May 2020 11:43:00 +0000 (13:43 +0200)]
rtsp-media: update expected_async_done during suspend

Set expected_async_done to FALSE in default_suspend() if a state change
occurs and the return value from set_target_state() is something other
than GST_STATE_CHANGE_ASYNC.

Without this change there is a risk that expected_async_done will be
TRUE even though no asynchronous state change is taking place. This
could happen if the pipeline is set to PAUSED using
media_set_pipeline_state_locked(), an asynchronous state change starts
and then the media is suspended (which could result in a state change,
aborting the asynchronous state change). If the media is suspended
before the asynchronous state change ends then expected_async_done will
be TRUE but no asynchronous state change is taking place.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/123>

4 years agortsp-client: Fix race condition in rtsp ctrl timeout by WeakRef client
Kristofer Björkström [Mon, 25 May 2020 11:49:45 +0000 (13:49 +0200)]
rtsp-client: Fix race condition in rtsp ctrl timeout by WeakRef client

There was a race condition where client was being finalized and
concurrently in some other thread the rtsp ctrl timout was relying on
client data that was being freed.
When rtsp ctrl timeout is setup, a WeakRef on Client is set.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/121>

4 years agomedia-factory: complete DSCP QoS setting support
Gregor Boirie [Tue, 3 Mar 2015 13:42:07 +0000 (14:42 +0100)]
media-factory: complete DSCP QoS setting support

add dscp_qos setting support at factory and media level to setup IP DSCP
field of bounded UDP sinks.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/issues/6

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/120>

4 years agortsp-client: Fix some race conditions around timeout source removal
Sebastian Dröge [Thu, 14 May 2020 07:08:32 +0000 (10:08 +0300)]
rtsp-client: Fix some race conditions around timeout source removal

We always need to take the lock while accessing it as otherwise another
thread might've removed it in the meantime. Also when destroying and
creating a new one, ensure that the mutex is not shortly unlocked in
between as during that time another one might potentially be created
already.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/119>

4 years agortsp-media: Mark out parameters accordingly in gst_rtsp_media_get_rates()
Sebastian Dröge [Sun, 3 May 2020 13:29:31 +0000 (16:29 +0300)]
rtsp-media: Mark out parameters accordingly in gst_rtsp_media_get_rates()

And the same for gst_rtsp_stream_get_rates().

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/118>

4 years agoexamples: test-onvif-server: fix compiler warnings on raspbian
Tim-Philipp Müller [Sun, 3 May 2020 10:17:41 +0000 (10:17 +0000)]
examples: test-onvif-server: fix compiler warnings on raspbian

Fix printf format for 64-bit variables.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/117>

4 years agortsp-stream-transport: Fix accidental API/ABI breakage with message_sent callbacks
Sebastian Dröge [Fri, 1 May 2020 07:42:17 +0000 (10:42 +0300)]
rtsp-stream-transport: Fix accidental API/ABI breakage with message_sent callbacks

The old API is preserved now and new API was added that provides the
additional parameter to the callback.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/issues/104

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/116>

4 years agortsp-client: Store the timeout source by pointer instead of id
Sebastian Dröge [Tue, 28 Apr 2020 20:33:49 +0000 (23:33 +0300)]
rtsp-client: Store the timeout source by pointer instead of id

That way we don't have to retrieve it again from the main context when
destroying it but can directly do so.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/115>

4 years agortsp-client: Clean up watch/watch context and related state consistently
Sebastian Dröge [Tue, 28 Apr 2020 20:16:18 +0000 (23:16 +0300)]
rtsp-client: Clean up watch/watch context and related state consistently

And assert that it was cleaned up properly before the client is
finalized. If something is still around when the client is shut down
then something went very wrong before.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/115>

4 years agortsp-client: Combine the pre-session and post-session timeout
Sebastian Dröge [Mon, 27 Apr 2020 20:25:22 +0000 (23:25 +0300)]
rtsp-client: Combine the pre-session and post-session timeout

They previously used the same state but different mechanisms and
functions, which was difficult to follow, error prone and simply
confusing.

Also adjust the test for the post-session timeout a bit to be less racy
now that the timing has slightly changed.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/115>

4 years agortsp-client: Don't ever close the client connection directly when a session is torn...
Sebastian Dröge [Mon, 27 Apr 2020 16:47:15 +0000 (19:47 +0300)]
rtsp-client: Don't ever close the client connection directly when a session is torn down

There might be other sessions that are running over the same RTSP
connection and we should not simply close the client directly if one of
them is torn down.

By default the connection will be closed once the client closes it or
the OS does. This behaviour can be adjusted with the
post-session-timeout property, which allows to close it automatically
from the server side after all sessions are gone and the given timeout
is reached.

This reverts the previous commit.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/115>

4 years agortsp-client: If the TEARDOWN response can be sent directly, directly close the client
Sebastian Dröge [Mon, 27 Apr 2020 10:49:55 +0000 (13:49 +0300)]
rtsp-client: If the TEARDOWN response can be sent directly, directly close the client

Instead of closing it never at all. Previously there was only code that
closed the client asynchronously if sending the response happened
asynchrously at a later time.

Thanks to Christian M for debugging this issue.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/issues/102

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/114>

4 years agortsp-stream: use mcast_udpsink[0] last-sample if available for rtpinfo
Michael Olbrich [Mon, 23 Mar 2020 13:51:28 +0000 (14:51 +0100)]
rtsp-stream: use mcast_udpsink[0] last-sample if available for rtpinfo

Otherwise no sink is found for multicast sreams and the less accurate
fallback is used to determine the current sequence number and timestamp.

4 years agortsp-auth: Fix NULL pointer dereference when handling an invalid basic Authorization...
Sebastian Dröge [Mon, 23 Mar 2020 14:06:43 +0000 (16:06 +0200)]
rtsp-auth: Fix NULL pointer dereference when handling an invalid basic Authorization header

When using the basic authentication scheme, we wouldn't validate that
the authorization field of the credentials is not NULL and pass it on
to g_hash_table_lookup(). g_str_hash() however is not NULL-safe and will
dereference the NULL pointer and crash.
A specially crafted (read: invalid) RTSP header can cause this to
happen.

As a solution, check for the authorization to be not NULL before
continuing processing it and if it is simply fail authentication.

This fixes CVE-2020-6095 and TALOS-2020-1018.

Discovered by Peter Wang of Cisco ASIG.

4 years agortsp-client: Use watch_context before unref
Göran Jönsson [Mon, 9 Mar 2020 13:17:34 +0000 (14:17 +0100)]
rtsp-client: Use watch_context before unref

Move the usage of priv->watch_context to beginning of function
gst_rtsp_client_finalize. Instead of use it after
g_main_context_unref (priv->watch_context).

4 years agortsp-stream: fix deadlock on transport removal
Mathieu Duponchelle [Fri, 14 Feb 2020 13:59:43 +0000 (14:59 +0100)]
rtsp-stream: fix deadlock on transport removal

We cannot take the RTSPStream lock while holding a transport backlog
lock, as remove_transport may be called externally, which will
take first the RTSPStream lock then the transport backlog lock.

4 years agortsp-stream: clear backlog when removing transport
Mathieu Duponchelle [Fri, 14 Feb 2020 13:59:25 +0000 (14:59 +0100)]
rtsp-stream: clear backlog when removing transport

This ensures we don't end up calling any of transports' callbacks
with a potentially unreffed user_data (in practice, a client that
may have been removed)

4 years agortsp-stream: marshal calls to send_tcp_message to a single thread
Mathieu Duponchelle [Thu, 6 Feb 2020 21:46:18 +0000 (22:46 +0100)]
rtsp-stream: marshal calls to send_tcp_message to a single thread

In order to address the race condition pointed out at
https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/merge_requests/108#note_403579
we get rid of the send thread pool, and instead spawn and manage
a single thread to pull samples from app sinks and add them to
the transport's backlogs.

Additionally, we now also always go through the backlogs in order
to simplify the logic.

4 years agortsp-stream: properly protect TCP backlog access
Mathieu Duponchelle [Wed, 5 Feb 2020 19:28:19 +0000 (20:28 +0100)]
rtsp-stream: properly protect TCP backlog access

Fixes #97

We cannot hold stream->lock while pushing data, but need
to consistently check the state of the backlog both from
the send_tcp_message function and the on_message_sent function,
which may or may not be called from the same thread.

This commit introduces internal API to allow for potentially
recursive locking of transport streams, addressing a race
condition where the RTSP stream could push items out of order
when popping them from the backlog.

4 years agortsp-media: Sink pipeline in gst_rtsp_media_take_pipeline()
Sebastian Dröge [Fri, 21 Feb 2020 22:41:32 +0000 (00:41 +0200)]
rtsp-media: Sink pipeline in gst_rtsp_media_take_pipeline()

It's taken ownership of by the media, and returned with `transfer none`
from the GstRTSPMedia::create_pipeline() vfunc. If we don't sink it
first then any bindings will wrongly take ownership of the pipeline once
it arrives in bindings code.

4 years agoAdd initialization for context and params (gchar *)
Bastian Bouchardon [Wed, 5 Feb 2020 15:51:14 +0000 (16:51 +0100)]
Add initialization for context and params (gchar *)
Insert define (DEFAULT_*) into help to have to modify only the constants

4 years agortsp-media: fix default latency
Marc Leeman [Mon, 3 Feb 2020 12:30:14 +0000 (12:30 +0000)]
rtsp-media: fix default latency

4 years agortsp-client: make closing more thread safe
Mathieu Duponchelle [Wed, 15 Jan 2020 16:06:41 +0000 (17:06 +0100)]
rtsp-client: make closing more thread safe

+ Take the watch lock prior to using priv->watch
+ Flush both the watch and connection before closing / unreffing

gst_rtsp_connection_close() is not threadsafe on its own, this is
a workaround at the client level, where we control both the watch
and the connection

4 years agortsp-latency-bin: replace G_TYPE_INSTANCE_GET_PRIVATE as it's been deprecated
Jordan Petridis [Thu, 23 Jan 2020 14:41:26 +0000 (16:41 +0200)]
rtsp-latency-bin: replace G_TYPE_INSTANCE_GET_PRIVATE as it's been deprecated

from glib
```
Deprecated: 2.58: Use %G_ADD_PRIVATE and the generated
  `your_type_get_instance_private()` function instead
```

4 years agortsp-client: add property post-session-timeout
Zoltán Imets [Tue, 17 Dec 2019 15:08:19 +0000 (16:08 +0100)]
rtsp-client: add property post-session-timeout

This is a TCP connection timeout for client connections, in seconds.
If a positive value is set for this property, the client connection
will be kept alive for this amount of seconds after the last session
timeout. For negative values of this property the connection timeout
handling is delegated to the system (just as it was before).

Fixes #83

4 years agortsp-stream: check for NULL transports prior to ref'ing
Mark Nauwelaerts [Sat, 11 Jan 2020 21:58:48 +0000 (22:58 +0100)]
rtsp-stream: check for NULL transports prior to ref'ing

4 years agortsp-stream: fix checking of TCP backpressure
Mathieu Duponchelle [Thu, 9 Jan 2020 13:10:44 +0000 (14:10 +0100)]
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.

4 years agortsp-session: Butcher the file to please gst-indent in the CI
Olivier Crête [Wed, 11 Dec 2019 00:16:51 +0000 (19:16 -0500)]
rtsp-session: Butcher the file to please gst-indent in the CI

This should be reverted once the CI has an updated gst-indent.

4 years agortsp-session & client: Remove deprecated GTimeVal
Olivier Crête [Tue, 10 Dec 2019 23:39:32 +0000 (18:39 -0500)]
rtsp-session & client: Remove deprecated GTimeVal

GTimeVal won't work past 2038

4 years agortsp-auth: fix default token leak
Nicola Murino [Thu, 12 Dec 2019 16:56:18 +0000 (17:56 +0100)]
rtsp-auth: fix default token leak

4 years agogstrtspclientsink: unref transports when closing bin
Adam x Nilsson [Mon, 9 Dec 2019 13:17:05 +0000 (14:17 +0100)]
gstrtspclientsink: unref transports when closing bin

Fixes #91

4 years agortsp-media: Force seek when flush flag is set
Kristofer Bjorkstrom [Fri, 6 Dec 2019 09:44:35 +0000 (10:44 +0100)]
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.

4 years agortsp-client: Revitalize dead code
Edward Hervey [Thu, 21 Nov 2019 16:12:45 +0000 (17:12 +0100)]
rtsp-client: Revitalize dead code

Leftover from 65d9aa327cd1844934836249cd4463edf09c725d

CID: 1455379

4 years agortsp-sdp: Don't try to use non-initialized values
Edward Hervey [Wed, 27 Nov 2019 14:22:35 +0000 (15:22 +0100)]
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

4 years agortsp-stream: Removing invalid transports returns false
Adam x Nilsson [Fri, 1 Nov 2019 11:01:41 +0000 (12:01 +0100)]
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.

4 years agoclient test: add scale and speed negative tests
Zoltán Imets [Wed, 6 Nov 2019 13:17:48 +0000 (14:17 +0100)]
client test: add scale and speed negative tests

Negative tests for scale and speed should be done as well, verify that
the response code is "400 Bad request" when a bad request is done.

4 years agoDon't pass default GLib marshallers for signals
Niels De Graef [Thu, 29 Aug 2019 05:34:26 +0000 (07:34 +0200)]
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.