Commit graph

310 commits

Author SHA1 Message Date
Edward Hervey
7bf8c4d218 rtsp-client: Don't leak addr
CID #1422260
2017-11-21 09:53:19 +01:00
Edward Hervey
4d98bc5e55 Run gst-indent 2017-11-21 09:53:08 +01:00
Patricia Muscalu
a7732a68e8 Dynamically reconfigure pipeline in PLAY based on transports
The initial pipeline does not contain specific transport
elements. The receiver and the sender parts are added
after PLAY.
If the media is shared, the streams are dynamically
reconfigured after each PLAY.

https://bugzilla.gnome.org/show_bug.cgi?id=788340
2017-11-15 19:56:15 +02:00
Branko Subasic
619ac7b710 rtsp-client: unref 'pipelined_requests' in finalize
The hash table priv->pipelined_requests is not unref:ed in the
finalize funktion. Make sure it is.

https://bugzilla.gnome.org/show_bug.cgi?id=788704
2017-10-09 20:39:14 +02:00
Thibault Saunier
9706199efb Start support for RTSP 2.0
This adds basic support for new 2.0 features, though the protocol is
subposdely backward incompatible, most semantics are the sames.

This commit adds:

- features:
 * version negotiation
 * pipelined requests support
 * Media-Properties support
 * Accept-Ranges support

- APIs:
  * gst_rtsp_media_seekable

The RTSP methods that have been removed when using 2.0 now return
BAD_REQUEST.

https://bugzilla.gnome.org/show_bug.cgi?id=781446
2017-10-05 13:23:48 -03:00
Sebastian Dröge
ffbabb1529 rtsp-client: Fix typo in debug message 2017-08-14 21:04:58 +03:00
Sebastian Dröge
cd4e675f0c rtsp-client: Also handle the (S|G)ET_PARAMETER case of size==0 || !data as keep-alive
If there is no Content-Length header, no body would be allocated and the
'\0' would also not be appended to the body.
2017-01-19 14:57:19 +02:00
Sebastian Dröge
ac1124efb4 rtsp-client: Fix handling of keep-alive GET_PARAMETER/SET_PARAMETER
While they logically have 0 bytes length, GstRTSPConnection is appending
a '\0' to everything making the size be 1 instead.
2017-01-19 14:24:07 +02:00
Dag Gullberg
f00ac2daf2 rtsp-client: add IDLE timeout, before session exists
The RTSP server will not timeout an idle RTSP connection
(note this is different from doing timeout on a RTSP
session).

At least for Apache this is a problem when running RTSP over
HTTPS since it uses one of the threads (there is a rather
limited number) that are available for handling requests.

https://bugzilla.gnome.org/show_bug.cgi?id=771830
2016-11-23 09:45:33 +00:00
Scott D Phillips
01ef7f32b6 client: update do_send_message to match type GstRTSPClientSendFunc
This type mismatch fails building with MSVC

https://bugzilla.gnome.org/show_bug.cgi?id=774640
2016-11-17 23:38:15 +00:00
Branko Subasic
8425ea6969 client: emit signal in the beginning of each rtsp request
These signals let the application validate the requests, configure the
media/stream in a certain way and also generate error status code in
case of error or bad request.

https://bugzilla.gnome.org/show_bug.cgi?id=758062
2016-11-01 20:25:22 +02:00
Göran Jönsson
dbf91ab231 rtsp-client: Session filter in unwatch session
Call session filter with filter_session_media as paramer in
client_unwatch_session if using drop_backlog = FALSE.

In client_unwatch_session its allowed to grow the watchs backlog.
If using drop_backlog = FALSE and the backlog is full it will cause
a deadlock when setting session media state to NULL
if the backlog is not allowed to grow.

https://bugzilla.gnome.org/show_bug.cgi?id=771983
2016-10-25 12:55:59 +03:00
Nikita Bobkov
ff65732270 rtsp-client: Fix factory leaking in find_media() in error cases
https://bugzilla.gnome.org/show_bug.cgi?id=771488
2016-10-20 14:01:38 +03:00
Xavier Claessens
8495c47a9d stream: revert back to create udpsrc/udpsink on DESCRIBE for unicast
This is basically reverting changes introduced in commit f62a9a7,
because it was introducing various regressions:

- It introduces a leak of udpsrc elements that got wrongly fixed by adding
  an hash table in commit cba045e. We should have at most 4 udpsrc for unicast:
  ipv4/ipv6, rtp/rtcp. They can be reused for all unicast clients.
- If a mcast client connects, it creates a new socket in SETUP to try to respect
  the destination/port given by the client in the transport, and overrides the
  socket already set on the udpsink element. That means that if we already had a
  client connected, the source address on the udp packets it receives suddenly
  changes.
- If a 2nd mcast client connects, the destination/port in its transport is
  ignored but its transport wasn't updated.

What this patch does:

- Revert back to create udpsrc/udpsink for unicast clients on DESCRIBE.
- Always have a tee+queue when udp is enabled. This could be optimized
  again in a later patch, but is more complicated. If no unicast clients
  connects then those elements are useless, this could be also optimized
  in a later patch.
- When mcast transport is added, it creates a new set of udpsrc/udpsink,
  seperated from those for unicast clients. Since we already support only
  one mcast address, we also create only one set of elements.

https://bugzilla.gnome.org/show_bug.cgi?id=766612
2016-09-05 13:36:17 +03:00
Nikita Bobkov
de3d0c4522 rtsp-client: Fix leaking of media in error cases
With additional fixes by Kseniya Vasilchuk <vasilchukkseniia@gmail.com>
and myself to make the media refcounting a bit easier to follow.

https://bugzilla.gnome.org/show_bug.cgi?id=755632
2016-08-02 17:46:49 +03:00
Sebastian Dröge
687301af86 rtsp-client: Fix leaking of session in error cases
https://bugzilla.gnome.org/show_bug.cgi?id=755632
2016-08-02 15:18:30 +03:00
Sebastian Dröge
9fab555cc5 rtsp-server: Implement clock signalling according to RFC7273
For NTP and PTP clocks we signal the actual clock that is used and signal
the direct media clock offset.

For all other clocks we at least signal that it's the local sender clock.

This allows receivers to know which clock was used to generate the media and
its RTP timestamps. Receivers can then implement network synchronization,
either absolute or at least relative by getting the sender clock rate directly
via NTP/PTP instead of estimating it from RTP timestamps and packet receive
times.

https://bugzilla.gnome.org/show_bug.cgi?id=760005
2016-04-03 11:22:31 +03:00
Sebastian Dröge
406ed190ac rtsp-server: Fix indentation 2016-03-02 11:48:49 +02:00
Patricia Muscalu
f62a9a7eb9 rtsp-stream: postpone UDP socket allocation until SETUP
Postpone the allocation of the UDP sockets until we know
what transport has been chosen by the client.
Both unicast and multicast UDP sources are created in one
function.

https://bugzilla.gnome.org/show_bug.cgi?id=757488
2016-02-23 17:05:15 +02:00
Sebastian Dröge
c8f179948e rtsp-media: Add property to decide if sending media should be stopped when a client disconnects without TEARDOWN
Without TEARDOWN it might be desireable to keep the media running and continue
sending data to the client, even if the RTSP connection itself is
disconnected.

Only do this for session medias that have only UDP transports. If there's at
least on TCP transport, it will stop working and cause problems when the
connection is disconnected.

https://bugzilla.gnome.org/show_bug.cgi?id=758999
2015-12-28 10:51:56 +02:00
Srimanta Panda
ed70572c6c rtsp-client: suspend media during setup request
SETUP request from clients needs to suspend the media to clear the
prerolled buffers. Otherwise it will not affect the prerolled buffer
and the prerolled buffers will be incorrect (for example block-size
from setup request will not affect the prerolled buffer unless the
media is suspended).

https://bugzilla.gnome.org/show_bug.cgi?id=758268
2015-12-04 15:48:23 +02:00
Jan Schmidt
9e92a0307c rtsp-client: Report RECORD and ANNOUNCE as supported in the OPTIONS 2015-11-17 01:12:28 +11:00
Ognyan Tonchev
8922afb88d rtsp-client: allow application to decide what requirements are supported
Add "check-requirements" signal and vfunc to allow application
(and subclasses) to check the requirements.

Based on patch from Hyunjun Ko <zzoon.ko@samsung.com>

https://bugzilla.gnome.org/show_bug.cgi?id=749417
2015-06-23 14:38:29 +01:00
Göran Jönsson
08e0c79cee rtsp-client: No flush during Teardown.
When calling gst_rtsp_watch_write_data in gstrtspconnection.c and
backlog is empty it can happen that just a part of a message will be
sent and rest is in backlog queue. If then flush during teardown
just a part of message will be sent.This can lead to client miss
teardown response since it expect to get the last part of message.

The flushing during teardown was introduced to fix a deadlock that now
is fixed more generally in handle_request by temporary  setting backlog
size to unlimited.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=749845
2015-06-03 15:09:10 +02:00
Sebastian Dröge
51ed357597 rtsp-client: Only error out in PLAY if seeking actually failed
If the media was just not seekable, we continue from whatever position we are
and let the client decide if that is what is wanted or not.

Only if the actual seek failed, we can't really recover and should error out.
2015-02-13 12:21:16 +02:00
Sebastian Dröge
98b162f54b rtsp-media: If seeking fails, don't wait forever for the media to preroll again
Instead error out properly the same way as if the SEEKING query already
failed.
2015-02-12 16:53:27 +02:00
Tim-Philipp Müller
57c21c8f9e rtsp-client: fix awkward if clause 2015-02-08 12:08:36 +00:00
Sebastian Dröge
a93ed7e5d4 rtsp-media: Use flags to distinguish between PLAY and RECORD media 2015-02-06 09:42:50 +01:00
Tim-Philipp Müller
e9ce91634c rtsp-client: fix a couple of leaks in handle_announce 2015-02-06 09:42:50 +01:00
Sebastian Dröge
ccf6c6eb53 Add initial support for RECORD
We currently only support media that is RECORD or PLAY only, not both at once.

https://bugzilla.gnome.org/show_bug.cgi?id=743175
2015-02-06 09:42:42 +01:00
Tim-Philipp Müller
cc3e0ed39b rtsp-client: log interleaved data received 2015-01-19 23:24:28 +00:00
Tim-Philipp Müller
47eaac5b9e rtsp-client: fix unintentional fallthrough to debug warning when receiving interleaved data 2015-01-19 23:18:02 +00:00
Sebastian Dröge
fcef562f35 rtsp-client: If we have a single-stream media and SETUP contains no control, use the one and only stream 2015-01-19 13:09:20 +01:00
Sebastian Dröge
69e346419a rtsp-client: Use a random session ID in the SDP
RFC4566 Section 5.2 says that it should make the username, session id,
nettype, addrtype and unicast address tuple globally unique. Always using
1188340656180883 is not going to guarantee that: https://xkcd.com/221/

Instead let's create a 64 bit random number, which at least brings us
closer to the goal of global uniqueness.

https://tools.ietf.org/html/rfc4566#section-5.2
2015-01-18 19:08:36 +01:00
Sebastian Dröge
586fe4ea4b rtsp-client: Drop trailing \0 of RTSP DATA messages
We add a trailing \0 in GstRTSPConnection to make parsing of
string message bodies easier (e.g. the SDP from DESCRIBE) but
for actual data this means we have to drop it or otherwise
create invalid data.
2015-01-16 20:06:57 +01:00
Sebastian Dröge
79e41bc2be rtsp-client: Add a send_message default signal handler
This allows subclasses to easily hook into the response sending
mechanism without doing everything from a signal, which seems
awkward from subclasses.
2014-12-29 12:06:50 +01:00
Göran Jönsson
058698c9cf rtsp: Ref transports in hash table.
Also ref streams for transports.
This solves a crash when reciving a rtcp after teardown but before
client finalize.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=740845
2014-12-02 16:29:24 +01:00
Wim Taymans
bd8b2d3fb9 client: refactor cleanup of cached media 2014-11-07 12:48:53 +01:00
Linus Svensson
088eee6590 client: Configure transport after creating session media
The default implementation of configure_client_transport() in
rtsp-client uses the session media when it chooses channels for
interleaved traffic.

https://bugzilla.gnome.org/show_bug.cgi?id=739112
2014-11-07 12:42:48 +01:00
Linus Svensson
a455181aff client: Stop caching media in client when doing setup
If the media has been managed by a session media, it should not be
cached in the client any longer. The GstRTSPSessionMedia object is now
responsible for unpreparing the GstRTSPMedia object using
gst_rtsp_media_unprepare(). Unprepare the media when finalizing the
session media.

https://bugzilla.gnome.org/show_bug.cgi?id=739112
2014-11-07 12:34:23 +01:00
Aleix Conchillo Flaqué
ef9dc6c9e4 rtsp-client: mikey memory leaks
https://bugzilla.gnome.org/show_bug.cgi?id=739383
2014-10-30 10:34:56 +00:00
Aleix Conchillo Flaqué
0aad92531d rtsp-client: add stream transport to context
We add the stream transport to the context so we can get the configured
client stream transport in the setup request signal.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=738905
2014-10-21 11:44:40 +02:00
Aleix Conchillo Flaqué
6c0c90c9d2 client: set session media to NULL without the lock
We need to set session medias to NULL without the client lock otherwise
we can end up in a deadlock if another thread is waiting for the lock
and media unprepare is also waiting for that thread to end.

https://bugzilla.gnome.org/show_bug.cgi?id=737690
2014-10-01 10:31:04 +01:00
Sebastian Rasmussen
404a80e38a rtsp-client: Remove backlog limit while processings requests
If the backlog limit is kept two cases of deadlocks may be
encountered when streaming over TCP. Without the backlog
limit this deadlocks can not happen, at the expence of
memory usage.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=737631
2014-09-30 12:22:49 +02:00
Ognyan Tonchev
17f5785638 rtsp-client: do not free main context before rtsp watch
https://bugzilla.gnome.org/show_bug.cgi?id=737110
2014-09-24 10:42:16 +03:00
Branko Subasic
2218510cae rtsp-*: Treat sending packets to clients as keepalive
As long as gst-rtsp-server can successfully send RTP/RTCP data to
clients then the client must be reading. This change makes the server
timeout the connection if the client stops reading.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=736647
2014-09-24 10:37:59 +03:00
Branko Subasic
733ef1162b rtsp-client: Allow backlog to grow while expiring session
Allow the send backlog in the RTSP watch to grow to unlimited size while
attempting to bring the media pipeline to NULL due to a session
expiring.  Without this change the appsink element cannot change state
because it is blocked while rendering data in the new_sample callback.
This callback will block until it has successfully put the data into the
send backlog. There is a chance that the send backlog is full at this
point which means that the callback may block for a long time, possibly
forever. Therefore the media pipeline may also be prevented from
changing state for a long time.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=736647
2014-09-24 10:37:49 +03:00
Edward Hervey
980553547d rtsp-client: Make old compilers happy
rtsp-client.c:2553:50: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]

Just in case that guint8 doesn't fit in a pointer. Just in case ...
2014-09-22 09:30:39 +02:00
Göran Jönsson
23b9d8fbb0 client: raise the backlog limits before pausing
We need to raise the backlog limits before pausing the pipeline or else
the appsink might be blocking in the render method in wait_backlog() and
we would deadlock waiting for paused.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=736322
2014-09-16 11:41:52 +02:00
Göran Jönsson
ebd9be59fe client: make define for the WATCH_BACKLOG
See https://bugzilla.gnome.org/show_bug.cgi?id=736322
2014-09-16 11:29:38 +02:00