Commit graph

596 commits

Author SHA1 Message Date
Seungha Yang 8b4f18d53b rtspsrc: Don't return TRUE for unhandled query
Expected return value for unhandled query is FALSE

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/629>
2020-06-16 19:35:30 +09:00
Mathieu Duponchelle f63299ff2f plugins: uddate gst_type_mark_as_plugin_api() calls 2020-06-06 00:42:25 +02:00
Mathieu Duponchelle 37c619f995 plugins: Use gst_type_mark_as_plugin_api() for all non-element plugin types 2020-06-03 22:44:09 -04:00
Thibault Saunier 3fdae346ca rtspsrc: Error out when failling to receive message response
And let it rety twice.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/issues/717

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/601>
2020-05-25 20:13:06 -04:00
Thibault Saunier fd7ecac793 rtspsrc: Properly set segments seqnums after seeks 2020-04-09 14:03:04 -04:00
Thibault Saunier 00539e1277 rtspsrc: Avoid stack overflow recursing waiting for response
Instead of recursing, simply implement a loop with gotos, the same
way it was done before 8121752887

Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/issues/710
2020-04-08 09:49:49 -04:00
Stefano Buora 2d3dccdba7 rtspsrc: remove useless function calls
Comparing gst_rtspsrc_loop_interleaved and gst_rtspsrc_loop_udp, and investigating on timeout issues, it sounds like a piece of code has been originally copied from udp to the interleaved one. The timeout variable is never used inside the interleaved one. No side effect has been seen in the removed function calls.

The debug message removed is pointless as the timeout used is "src->tcp_timeout" that is fixed.

The presence of the two timeout drove my team in investigating if the reference to the tcp_timeout was correct (it is). Hence we removed the misleading reference to the local timeout variable.
2020-02-20 08:27:35 +00:00
Mathieu Duponchelle 1471100f37 rtspsrc: fix requested range
When the server replies with a range "now-", it is presumed to
be a "live" stream and we should request a similar range.

This was the case prior to my refactoring to make use of
gst_rtsp_range_to_string in 5f1a732bc7,
this commit restores the behaviour for that case.
2020-02-12 05:47:54 +00:00
Alexander Lapajne 54c4ba82f8 rtspsrc: Fix for segmentation fault when handling set/get_parameter requests
gstrtspsrc uses a queue, set_get_param_q, to store set param and get
param requests. The requests are put on the queue by calling
get_parameters() and set_parameter(). A thread which executs in
gst_rtspsrc_thread() then pops requests from the queue and processes
them. The crash occured because the queue became empty and a NULL
request object was then used. The reason that the queue became empty
is that it was popped even when the thread was NOT processing a get
parameter or set parameter command. The fix is to make sure that the
queue is ONLY popped when the command being processed is a set
parameter or get parameter command.
2020-02-10 09:43:17 +01:00
Aaron Boxer 09d4514814 rtspsrc: improved handling of control concatenation with base
Also, `control_url` variable has been renamed to `control_path`,
as it is actually a path.
2019-12-30 16:52:45 +00:00
Aaron Boxer ed6b5a3a63 rtspsrc: append aggregate control string to base URL before query string
Appending control string to end of query changes meaning of query string
Fixes #650
2019-12-30 16:52:45 +00:00
Aaron Boxer 4155c59cc4 rtspsrc: avoid seek DISCONT when only rate changes in same direction
Not setting DISCONT avoids a noticable delay when seeking
with only rate changing, in the same direction as current
rate.
2019-12-19 05:54:38 +00:00
Olivier Crête 9db1d740e8 rtspsrc: Remove deprecated GTimeVal
GTimeVal won't work past 2038
2019-12-18 19:48:34 +00:00
Joakim Johansson 4d7d577496 gstrtspsrc: Add missing lock on free set_get_param_q
Otherwise is it possible to get a crash in gst_rtspsrc_set_parameter.
2019-12-16 13:13:00 +01:00
Niels De Graef 7cf4ab6229 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-17 15:32:30 +00:00
Aaron Boxer 46989dca96 documentation: fix a number of typos 2019-10-05 22:38:11 +00:00
Mathieu Duponchelle c5e8a8f320 rtspsrc: fix git diff indentation 2019-09-02 16:33:05 +02:00
Mathieu Duponchelle 3bc5d3d3b5 rtspsrc: normalize variable to boolean 2019-08-30 22:42:58 +02:00
Mathieu Duponchelle 37eca8a12c rtspsrc: clip output segment on accurate seeks
The output segment is only used in ONVIF mode.

The previous behaviour was to output a segment computed from
the Range response sent by the server.

In ONVIF mode, servers will start serving from the appropriate
synchronization point (keyframe), and the Range in response will
start at that position.

This means rtspsrc can now perform truly accurate seeks in that
mode, by clipping the output segment to the values requested in
the seek. The decoder will then discard out of segment buffers
and playback will start without artefacts at the exact requested
position, similar to the behaviour of a demuxer when an accurate
seek is requested.
2019-08-30 14:50:21 +00:00
Mathieu Duponchelle 5c7423d73c rtspsrc: expose and implement is-live property
This is useful to support the ONVIF case: when is-live is set to
FALSE and onvif-rate-control is no, the client can control the
rate of delivery and arrange for the server to block and still
keep sending when unblocked, without requiring back and forth
PAUSE / PLAY requests. This enables, amongst other things, fast
frame stepping on the client side.

When is-live is FALSE, we don't use a manager at all. This case
was actually already pretty well handled by the current code. The
standard manager, rtpbin, is simply no longer needed in this case.

Applications can instantiate a downloadbuffer after rtspsrc if
needed.
2019-08-06 22:45:37 +00:00
Mathieu Duponchelle 75f53631e5 rtspsrc: reset_time when flush stopping 2019-08-06 22:45:37 +00:00
Mathieu Duponchelle 5f1a732bc7 rtspsrc: expose and implement onvif-mode property
Refactor the code for parsing and generating the Range, taking
advantage of existing API in GstRtspTimeRange.

Only use the TCP protocol in that mode, as per the specification.

Generate an accurate segment when in that mode, and signal to the
depayloader that it should not generate its own segment, through
the "onvif-mode" field in the caps, see
<https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/merge_requests/328>
for more information.

Translate trickmode seek flags to their ONVIF representation

Expose an onvif-rate-control property
2019-08-06 22:45:37 +00:00
Mathieu Duponchelle 544f8fecf4 rtspsrc: improve handling of rate in seeks 2019-08-06 22:45:37 +00:00
Sebastian Dröge 86ec5c1031 rtspsrc: Use new GstRTSPMessage API to set message body from a buffer directly 2019-08-05 19:35:36 +03:00
Mathieu Duponchelle 33277da781 rtspsrc: unref the event in element seek handler 2019-07-01 13:54:13 +02:00
Mathieu Duponchelle bcd367b81d rtspsrc: handle seek event on the element
Without this, the user has to wait for rtspsrc to have sent a PLAY
request and exposed its pads before seeking it.
2019-06-29 00:25:26 +02:00
Nicolas Dufresne 301a46bd2d rtspsrc: Remove uneeded keep-alive hack
The rtsp connection code has been fixed now.

https://bugzilla.gnome.org/show_bug.cgi?id=744209
2019-05-27 16:04:23 +02:00
Mathieu Duponchelle d704790519 doc: fix element section documentations
Element sections were not rendered anymore after the hotdoc
port, fixing this revealed a few incorrect links.
2019-05-25 16:57:31 +02:00
Thiago Santos 135e12565b rtspsrc: do not try to send EOS with invalid seqnum
The second udpsrc (rtcp) might not have seen the segment event if it was
not enabled or if rtcp is not available on the server. So if the
application tries to send an EOS event it will try to set an invalid
seqnum to the event.
2019-05-02 22:14:35 -07:00
Sebastian Dröge a676c17259 rtspsrc: Don't remove udpsrc/sink from rtspsrc if they were not added to it
This can happen in various error cases that could happen between the
creation of the element in question and the adding to the rtspsrc.

It causes an ugly critical warning right now but is otherwise harmless.
2019-03-15 08:21:11 +00:00
Antonio Ospite 2dfe228740 docs: fix typos s/recieve/receive/ 2019-03-07 12:41:40 +01:00
Mathieu Duponchelle 6ed7ddebf9 rtspsrc: use the correct segment seqnum 2019-02-04 13:14:37 +00:00
Patrick Radizi d3662bae00 rtspsrc: send GstRTSPSrcTimeout message on timeout
The GstRTSPSrcTimeout message is sent by the rtspsrc when it receives
the on-timeout signal from rtpsession. This can be used by an
application for error handling.

https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/issues/499
2019-01-14 08:15:23 +00:00
Juan Navarro 5dfd12b64c rtspsrc: Accept NULL for "port-range" property
The documentation of "port-range" implies that passing NULL should be
valid, but currently it is not. Without this check, the sscanf() call
will crash.
2018-12-21 10:59:22 +01:00
Ulf Olsson 0f6a4e7c98 rtspsrc: Add support for SET_PARAMETER and GET_PARAMETER using signals
https://bugzilla.gnome.org/show_bug.cgi?id=792131
2018-08-16 09:03:42 +03:00
Jan Schmidt f067b50dd6 rtspsrc: Add a small configurable teardown delay
This causes rtspsrc to send a teardown and wait on
PAUSED->READY transition, with a configurable delay.
Otherwise, typically teardown never gets sent in
playbin / uridecodebin where the transition back to NULL
happens too quickly.

The timeout is set to 100ms default.

https://bugzilla.gnome.org/show_bug.cgi?id=751994
2018-07-27 00:41:57 +10:00
Edward Hervey 418a6270e5 rtspsrc: Seek handling is always done with a valid event
Remove the checks
2018-06-06 07:48:32 +02:00
Tim-Philipp Müller db688c5504 docs: fix typos 2018-05-23 13:14:27 +01:00
Jan Schmidt 9cbde904e8 rtspsrc: Fix doc comment markers 2018-05-07 01:40:05 +10:00
Sebastian Dröge 6d92fcd043 Revert "rtspsrc: Fix up sendonly/recvonly attribute handling"
This reverts commit af273b4de9.

While RFC 3264 (SDP) says that sendonly/recvonly are from the point of view of
the requester, the actual RTSP RFCs (RFC 2326 / 7826) disagree and say
the opposite, just like the ONVIF standard.

Let's follow those RFCs as we're doing RTSP here, and add a property at
a later time if needed to switch to the SDP RFC behaviour.

https://bugzilla.gnome.org/show_bug.cgi?id=793964
2018-04-17 17:58:01 +03:00
Mathieu Duponchelle 893d39cef7 rtspsrc: reject segment seeks
https://bugzilla.gnome.org/show_bug.cgi?id=784681
2018-03-26 21:13:12 +02:00
Sebastian Dröge f29fe76d7e rtspsrc: Ignore sendonly/recvonly attributes unless a backchannel is configured
This works around a bug in various ONVIF cameras that implement the
attributes the wrong way around. They still won't work with a
backchannel but at least normal playback will work for the time being.
It restores pre-1.14 behaviour where we would fail to preroll on any SDP
that lists a recvonly stream. For 1.16 a better solution should be
found.

The problem here is that the ONVIF spec has the meaning of the two
attributes the wrong way around in the examples, compared to RFC4566.

https://bugzilla.gnome.org/show_bug.cgi?id=793715
2018-03-01 20:27:10 +02:00
James Stevenson d64ae7b01a rtspsrc: Fix missing read property of backchannel
Add missing read property code for backchannel

https://bugzilla.gnome.org/show_bug.cgi?id=793507
2018-02-16 12:53:07 +00:00
Sebastian Dröge 7512120e5d rtspsrc: Implement ONVIF backchannel support via TCP 2018-02-16 11:06:27 +02:00
Nirbheek Chauhan befa41cdf6 rtspsrc: Implement ONVIF backchannel support
Set backchannel=onvif to enable, and use the 'push-backchannel-sample'
action signal with the correct stream id.
2018-02-16 11:06:27 +02:00
Sebastian Dröge af273b4de9 rtspsrc: Fix up sendonly/recvonly attribute handling
We can't handle recvonly streams, sendonly streams are perfectly fine.

The direction is the one from the point of view of the SDP offerer
(i.e. the RTSP server), and a recvonly stream would be one where the
server expects us to send media.

RFC 3264, section 5.1:
   If the offerer wishes to only send media on a stream to its peer, it
   MUST mark the stream as sendonly with the "a=sendonly" attribute.

This is mixed up in the ONVIF streaming specification examples, but
actual implementations and conformance tools seem to not care at all
about the attributes.

https://bugzilla.gnome.org/show_bug.cgi?id=792376
2018-01-22 12:24:18 +02:00
Mark Nauwelaerts aad0faaf59 rtspsrc: also proxy multicast-iface property to RTCP udpsrc 2017-12-23 12:48:20 +01:00
Edward Hervey 9a7dd45e57 rtspsrc: Fix two leaks
* gst_event_new_stream_start() does not take ownership of the stream_id

* the pipeline_request_id string that is created was not being freed
2017-12-19 11:57:52 +01:00
Matt Staples ea1b10e4ca rtspsrc: Add a signal to allow outgoing messages to be modified or dropped
This feature allows applications to implement extensions to the RTSP
protocol, such as those defined in the ONVIF Streaming Specification.

https://bugzilla.gnome.org/show_bug.cgi?id=762884
2017-12-06 10:46:01 +02:00
Edward Hervey 10bc8fdfd2 rtspsrc: Do more checks for seekability
When receiving a seek event, check whether we can actually seek based
on the information the server provided.

Also add more documentation on what the seekable field means
2017-11-24 15:39:38 +01:00