Commit graph

1775 commits

Author SHA1 Message Date
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
Tim-Philipp Müller
95ce953e34 meson: build gir even when cross-compiling if introspection was enabled explicitly
This can be made to work in certain circumstances when
cross-compiling, so default to not building g-i stuff
when cross-compiling, but allow it if introspection was
enabled explicitly via -Dintrospection=enabled.

See gstreamer/gstreamer#454 and gstreamer/gstreamer#381.
2019-10-18 08:30:59 +00: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
Göran Jönsson
e1760eeb51 client: fix test mem leak in attach_rate_tweaking_probe 2019-10-07 10:49:08 +02:00
Göran Jönsson
3ff0ca9887 media: remove memleak in test test_media_seek 2019-10-07 10:42:54 +02:00
Göran Jönsson
19f9373113 rtspserver: Remove memleak in test test_double_play 2019-10-07 10:42:04 +02: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
Mathieu Duponchelle
9cba1f7708 test-onvif-client: remove unused query 2019-09-05 14:25:34 +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
Mathieu Duponchelle
513c0fcb95 test-onvif-client: perform accurate seeks
See https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/merge_requests/336

Also, modify how we compute the position: position queries in
PAUSED mode fail to account for the newly-prerolled frame, leading
to frame skips when performing seeks in that state. Instead,
compute the current position from the last sample.
2019-08-29 22:48:10 +02: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
Matthew Waters
4319e17b0e examples/onvif-server: fix werror build with clang
../subprojects/gst-rtsp-server/examples/test-onvif-server.c:346:65: warning: implicit conversion from enumeration type 'const GstSegmentFlags' to different enumeration type 'GstSeekFlags' [-Wenum-conversion]
        self->incoming_segment->format, self->incoming_segment->flags,
                                        ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
../subprojects/gst-rtsp-server/examples/test-onvif-server.c:53:1: warning: unused function 'REPLAY_IS_BIN' [-Wunused-function]
G_DECLARE_FINAL_TYPE (ReplayBin, replay_bin, REPLAY, BIN, GstBin);
^
/usr/include/glib-2.0/gobject/gtype.h:1407:26: note: expanded from macro 'G_DECLARE_FINAL_TYPE'
  static inline gboolean MODULE##_IS_##OBJ_NAME (gpointer ptr) {                                         \
                         ^
<scratch space>:77:1: note: expanded from here
REPLAY_IS_BIN
^
../subprojects/gst-rtsp-server/examples/test-onvif-server.c:525:1: warning: unused function 'ONVIF_FACTORY' [-Wunused-function]
G_DECLARE_FINAL_TYPE (OnvifFactory, onvif_factory, ONVIF, FACTORY,
^
/usr/include/glib-2.0/gobject/gtype.h:1405:33: note: expanded from macro 'G_DECLARE_FINAL_TYPE'
  static inline ModuleObjName * MODULE##_##OBJ_NAME (gpointer ptr) {                                     \
                                ^
<scratch space>:9:1: note: expanded from here
ONVIF_FACTORY
^
../subprojects/gst-rtsp-server/examples/test-onvif-server.c:525:1: warning: unused function 'ONVIF_IS_FACTORY' [-Wunused-function]
/usr/include/glib-2.0/gobject/gtype.h:1407:26: note: expanded from macro 'G_DECLARE_FINAL_TYPE'
  static inline gboolean MODULE##_IS_##OBJ_NAME (gpointer ptr) {                                         \
                         ^
<scratch space>:12:1: note: expanded from here
ONVIF_IS_FACTORY
^
2019-08-26 12:42:48 +00:00
Matthew Waters
b2d5e4db52 meson: Don't generate doc cache when no plugins are enabled
Fixes gst-build with -Dauto-features=disabled -Drtsp_server=enabled
2019-08-23 16:59:48 +10:00
Xavier Claessens
c2deb7f64b test-onvif-client: stdin is not defined in MSVC 2019-08-16 13:38:01 -04:00
Mathieu Duponchelle
7073ade1a6 rtsp-media: add missing Since tag 2019-08-12 16:09:02 +00:00
Mathieu Duponchelle
859e59b944 test-onvif-client: STDIN_FILENO is not portable
If not defined, define it to _fileno(stdin) on Windows, 0
everywhere else
2019-08-08 15:52:53 +02:00
Mathieu Duponchelle
df1f9f38ce test-onvif-server: downgrade logging 2019-08-07 21:04:33 +02:00
Mathieu Duponchelle
0bdae677d3 examples: add ONVIF client / server example 2019-08-07 18:04:03 +02: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
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
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
Niels De Graef
e788fc4e88 meson: Bump minimal GLib version to 2.44
This means we can use some newer features and get rid of some
boilerplate code using the G_DECLARE_* macros.

As discussed on IRC, 2.44 is old enough by now to start depending on it.
2019-06-02 21:39:33 +02:00
Mathieu Duponchelle
768975f71b docs: remove obsolete gtk-doc related files 2019-05-31 18:53:36 +02:00
Mathieu Duponchelle
da22533780 doc: remove xml from comments 2019-05-29 23:20:09 +02:00
Thibault Saunier
ef88a27317 docs: Stop building the doc cache by default
And update the cache

Fixes https://gitlab.freedesktop.org/gstreamer/gst-docs/issues/36
2019-05-16 09:36:06 -04:00
Thibault Saunier
89cc9e9201 docs: Update plugins documentation cache 2019-05-13 22:59:57 -04:00
Thibault Saunier
f4b20b010d doc: Fix some docstrings 2019-05-13 17:00:00 -04:00