Commit graph

562 commits

Author SHA1 Message Date
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
Edward Hervey
92c3207463 rtspsrc: Use the proper maximum value for seekable
it's a gfloat, not a gdouble
2017-11-21 09:33:49 +01:00
Sebastian Dröge
af3ce874a0 rtspsrc: Add "accept-certificate" signal for manually checking a TLS certificate for validity
https://bugzilla.gnome.org/show_bug.cgi?id=785024
2017-11-01 13:42:45 +02:00
Sangkyu Park
257f7c9063 rtspsrc: Print RTSP/SDP messages to gstreamer log instead of stdout
- 'debug' property is deprecated
- All RTSP messages are printed to gstreamer log with 'log' level.

https://bugzilla.gnome.org/show_bug.cgi?id=788917
2017-11-01 11:35:44 +02:00
Thibault Saunier
6d72ae13fe rtsp: Add missing Since marker 2017-10-16 14:21:56 +02:00
Thibault Saunier
fb952e3470 rtspsrc: Avoid potentially dereferencing NULL pointer
CID 1418986
2017-10-09 14:39:14 +02:00
Tim-Philipp Müller
d5f72418c8 rtpbin, rtspsrc: fix compiler warnings about 64-bit integer signednes
"warning: this decimal constant is unsigned only in ISO C90" with
gcc 4.8.4 (Ubuntu/Linaro 4.8.4-2ubuntu1~14.04.3)
2017-10-07 15:55:24 +01:00
Thibault Saunier
125e835045 rtspsrc: Fix build 2017-10-05 14:37:54 -03:00
Thibault Saunier
ffcd173c09 rtspsrc: Handle TCP as lower transport with RTSP 2.0
Meaning that the interleave fields have to be updated as
if streams setup was working when using pipelined setup
request. Otherwise there is a mismatch between the server
channel count and our own.

This also makes RTSP 2.0 over HTTP working.

https://bugzilla.gnome.org/show_bug.cgi?id=781446
2017-10-05 12:05:40 -03:00
Thibault Saunier
8121752887 rtsp: Start implementing support for RTSP 2.0
- Handle version negotation:

  Added a `default-version` property so that the user can configure
  what to use in case the server does not support version negotation
  (which actually exist)

- Handle pipelined requests, which allow avoiding full round trip to
  setup the RTP streams (request are sent in a raw, and response are
  handled as they arrive).

- Handle the new Media-Properties header

- Handle the new Seek-Style header

- Handle the new Accept-Ranges header

Handling of IPV6 should already be OK.

We are still missing (at least) the following features (which do not
seem really mandatory as they require a "persistent connection between
server and client"):

  - Server to Client TEARDOWN command (Not so usefull fmpov)
  - PLAY_NOTIFY (not needed for our server yet)
  - Support for the new REDIRECT features

and probably some more protocol changes might not be handled yet.

https://bugzilla.gnome.org/show_bug.cgi?id=781446
2017-10-05 12:05:40 -03:00
Thibault Saunier
5faad79049 rtspsrc: Use a macro to debug RTSP messages
Simplifying the code a little.

https://bugzilla.gnome.org/show_bug.cgi?id=781446
2017-10-05 12:05:39 -03:00
Sebastian Dröge
26cf8c1dc9 rtspsrc: Ignore medias marked as sendonly
We're never going to receive anything from them, so don't create pads
for them. These medias are destinations where *we* could send something.
2017-10-01 16:09:13 +02:00
Patrick Radizi
3de0244532 rtpbin: add option for sanity checking timestamp offset
Timestamp offsets needs to be checked to detect unrealistic values
caused for example by NTP clocks not in sync. The new parameter
max-ts-offset lets the user decide an upper offset limit. There
are two different cases for checking the offset based on if
ntp-sync is used or not:
1) ntp-sync enabled
   Only negative offsest are allowed since a positive offset would
   mean that the sender and receiver clocks are not in sync.
   Default vaule of max-ts-offset = 0 (disabled)
2) ntp-sync disabled
   Both positive and negative offsets are allowed.
   Default vaule of max-ts-offset = 3000000000
The reason for different default values is to be backwards
compatible.

https://bugzilla.gnome.org/show_bug.cgi?id=785733
2017-09-15 13:33:14 +03:00
Patrick Radizi
23f7739ba4 rtpbin: add option for increasing ts_offset gradually
Instant large changes to ts_offset may cause timestamps to move
backwards and also cause visible effects in media playback. The new
option max-ts-offset-adjustment lets the application control the rate to
apply changes to ts_offset.

https://bugzilla.gnome.org/show_bug.cgi?id=784002
2017-09-14 13:15:56 +03:00
Sebastian Dröge
cd17c71dce rtspsrc: Create send/recv mutexes once, not on every connect()
Also fixes a crash caused by freeing an uninitialized mutex in an error
case.

https://bugzilla.gnome.org//show_bug.cgi?id=784282
2017-06-29 18:59:58 +03:00
Sebastian Dröge
c438545dc9 rtspsrc: Actually use the receive lock when receiving, not the send lock 2017-06-22 11:39:16 +03:00
Mathieu Duponchelle
0da5679c6f rtspsrc: do not checksum the stream id
https://bugzilla.gnome.org/show_bug.cgi?id=783307
2017-06-16 17:30:11 +02:00
Sebastian Dröge
a722f6e832 rtspsrc: Use a mutex for protecting against concurrent send/receives
We currently send data to the RTSP connection from multiple threads:
whenever a command is to be handled and whenever RTCP is generated. This
can cause data corruption or worse if both happen at the same time.

As such, protect gst_rtsp_connection_send() and gst_rtsp_connection_receive()
calls with a mutex. While this means that we hold a mutex during the IO
operation, this is not actually a problem as the IO operation can be
interrupted (gst_rtsp_connection_flush()) at any time and is blocking by
itself anyway.
2017-06-15 15:25:23 +03:00
Mathieu Duponchelle
f6283b082e rtspsrc: uniquify stream ids
https://bugzilla.gnome.org/show_bug.cgi?id=783307
2017-06-07 23:30:05 +02:00
Sebastian Dröge
c99f7579f3 rtspsrc: Chain up to the parent class' provide_clock() implementation
If no clock was provided directly by rtspsrc. This behaviour was removed
by f8013487c9 and results in rtspsrc not
providing the system clock via the rtpjitterbuffer.

As a result, if another element like an audio sink, provides a clock,
the pipeline would select that (when going to PAUSED/PLAYING again later).
Audio clocks usually don't progress in PAUSED, and thus our live source
won't be able to use the clock to produce data, making the sink never
preroll and everything is stuck.
2017-04-21 19:14:09 +01:00
Edward Hervey
474819cc3d rtspsrc: Use GST_ELEMENT_ERROR_WITH_DETAILS
Allows the application to know the exact status code that was returned
by the server in a programmatic fashion.

https://bugzilla.gnome.org/show_bug.cgi?id=781304
2017-04-17 13:10:06 +02:00
Edward Hervey
49002fa8a7 rtspsrc: Properly notify missing elements
If the srtp elements are not present, post a message on the bus
informing about the missing plugins.
2017-02-13 11:17:25 +01:00
Matt Staples
a8eb0515f1 rtspsrc: find_stream_by_channel should ignore unconfigured streams
https://bugzilla.gnome.org/show_bug.cgi?id=777101
2017-01-26 15:31:47 +02:00
Tim-Philipp Müller
d7b2820b73 Fix indentation 2017-01-09 19:05:10 +00:00
Matt Staples
bc2adef550 rtspsrc: Fix session cleanup when handling redirect on PLAY
Redirect on PLAY wasn't doing the necessary session cleanup. Fixed by
removing code from gst_rtspsrc_send that changed the state varable upon
encountering a redirect. Better to let the redirect handlers in
gst_rtspsrc_retrieve_sdp and gst_rtspsrc_play do their own
state-dependent cleanup.

https://bugzilla.gnome.org/show_bug.cgi?id=775543
2016-12-05 18:23:31 +02:00
Aleix Conchillo Flaque
bc9f06f37b rtspsrc: always send teardown request
Allow CMD_CLOSE to cancel all commands not only CMD_PAUSE
and ignore CMD_WAIT while closing.

https://bugzilla.gnome.org/show_bug.cgi?id=748360
2016-12-05 11:32:43 +02:00
Sebastian Dröge
058ab0df1d rtspsrc: Move to new helper function to parse authentication responses
https://bugzilla.gnome.org/show_bug.cgi?id=774416
2016-11-21 09:40:08 +02:00
Matt Staples
cd71e3a8e8 rtspsrc: Also handle redirect on PLAY
https://bugzilla.gnome.org/show_bug.cgi?id=772610
2016-11-01 20:14:35 +02:00
Petr Kulhavy
5cdf66d5d2 rtspsrc: allow missing control attribute in case of a single stream
Improve RFC2326 - chapter C.3 compatibility:
In case just a single stream is specified in SDP and the control attribute
is missing do not drop the stream but rather assume "a=control:*"

https://bugzilla.gnome.org/show_bug.cgi?id=770568
2016-11-01 20:13:49 +02:00
Mark Nauwelaerts
735924236e rtspsrc: reset connection info to non-flushing when closing
This solves a hanging mainloop in following scenario:
* connect to source
* network/server drops
* pipeline set to NULL (and connection to flushing as part)
* pipeline set to PAUSED/PLAYING (connection to non-flushing, but not recorded)
* [connecting still not possible]
* pipeline set to NULL => mainloop hangs (since no actual flushing is done)
2016-10-26 12:30:39 +02:00
Sebastian Dröge
eaae016884 rtspsrc: Use new bin suppressed flags API for managing the element flags 2016-09-15 18:20:30 +02:00
Thibault Saunier
150edef830 Use the new API to post flow ERROR messages on the bus
https://bugzilla.gnome.org/show_bug.cgi?id=770158
2016-08-26 19:23:26 -03:00
Sebastian Dröge
0b0a042781 rtspsrc: Allow mimetypes with properties as long as they're application/sdp
Some servers add properties like charset, e.g.
  application/sdp; charset=utf8

Ideally we should also parse the charset and do conversion of all messages,
but that's for a later time.
2016-08-17 09:49:04 +03:00
Steven Hoving
ec59291b2e rtspsrc: Fix error messages to first convert to doubles before division 2016-07-06 11:22:53 +03:00
Sebastian Dröge
b9532527ec rtspsrc: Set to PLAYING after a seek again after setting up the segment and everything else
There's a small window for a race condition otherwise.
2016-07-05 21:11:35 +03:00