Commit graph

575 commits

Author SHA1 Message Date
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
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