Commit graph

24 commits

Author SHA1 Message Date
Sebastian Dröge
65bfa84d7a rtsp-stream-transport: Fix accidental API/ABI breakage with message_sent callbacks
The old API is preserved now and new API was added that provides the
additional parameter to the callback.

Fixes https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/issues/104

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/-/merge_requests/116>
2020-05-01 10:45:45 +03: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
Sebastian Dröge
d708f9736b rtsp-server: Add support for buffer lists
This adds new functions for passing buffer lists through the different
layers without breaking API/ABI, and enables the appsink to actually
provide buffer lists.

This should already reduce CPU usage and potentially context switches a
bit by passing a whole buffer list from the appsink instead of
individual buffers. As a next step it would be necessary to
  a) Add support for a vector of data for the GstRTSPMessage body
  b) Add support for sending multiple messages at once to the
    GstRTSPWatch and let it be handled internally
  c) Adding API to GOutputStream that works like writev()

Fixes https://gitlab.freedesktop.org/gstreamer/gst-rtsp-server/issues/29
2019-01-30 14:39:50 +02:00
David Svensson Fors
12169f1e84 Limit queued TCP data messages to one per stream
Before, the watch backlog size in GstRTSPClient was changed
dynamically between unlimited and a fixed size, trying to avoid both
unlimited memory usage and deadlocks while waiting for place in the
queue. (Some of the deadlocks were described in a long comment in
handle_request().)

In the previous commit, we changed to a fixed backlog size of 100.
This is possible, because we now handle RTP/RTCP data messages differently
from RTSP request/response messages.

The data messages are messages tunneled over TCP. We allow at most one
queued data message per stream in GstRTSPClient at a time, and
successfully sent data messages are acked by sending a "message-sent"
callback from the GstStreamTransport. Until that ack comes, the
GstRTSPStream does not call pull_sample() on its appsink, and
therefore the streaming thread in the pipeline will not be blocked
inside GstRTSPClient, waiting for a place in the queue.

pull_sample() is called when we have both an ack and a "new-sample"
signal from the appsink. Then, we know there is a buffer to write.

RTSP request/response messages are not acked in the same way as data
messages. The rest of the 100 places in the queue are used for
them. If the queue becomes full of request/response messages, we
return an error and close the connection to the client.

Change-Id: I275310bc90a219ceb2473c098261acc78be84c97
2018-07-23 17:45:00 +03:00
Tim-Philipp Müller
2df75442d0 rtsp-server: GST_EXPORT -> GST_RTSP_SERVER_API
We need different export decorators for the different libs.
For now no actual change though, just rename before the release,
and add prelude headers to define the new decorator to GST_EXPORT.
2018-03-13 13:37:13 +00:00
Tim-Philipp Müller
b344248630 Mark symbols explicitly for export with GST_EXPORT 2017-05-18 10:35:18 +01:00
Xavier Claessens
0ea68a1b0f rtsp-server: Add g_autoptr() support to all types
https://bugzilla.gnome.org/show_bug.cgi?id=754464
2015-12-14 13:52:17 -05:00
Wim Taymans
ea5d4cfc7e stream-transport: make method to handle received data
Make a method to handle the data received on a channel. It sends the
data to the stream of the transport on the RTP or RTCP pads based on
the channel number.
2014-09-16 10:45:20 +02:00
Wim Taymans
037e21b578 session-media: calculate start-time 2013-12-26 16:29:39 +01:00
Wim Taymans
4ca0b23a3f session-media: let the session-media make the RTPInfo
Add method to create the RTPInfo for a stream-transport.
Add method to create the RTPInfo for all stream-transports in a
session-media.
Use the session-media RTPInfo code in client. This allows us to refactor
another method to link the TCP callbacks.
2013-12-26 16:29:38 +01:00
Tim-Philipp Müller
91fac8eb29 rtsp-server: add padding to many public structures
Not mini objects though, since they are not subclassable
anyway, nor kept on the stack or inlined in a structure.
2013-12-12 00:36:07 +00:00
Wim Taymans
568477d9b5 stream-transport: add method to get/set url 2013-11-28 17:35:45 +01:00
Wim Taymans
041b1b79a1 docs: improve docs 2013-07-16 12:32:51 +02:00
Wim Taymans
ccceb1de11 docs: update docs 2013-07-11 12:18:26 +02:00
Wim Taymans
ad00c5e792 rtsp: make object details private
Make all object details private
Add methods to access private bits
2012-11-29 11:11:05 +01:00
Wim Taymans
e4ea72ccdf stream: use the address managed by the stream
Use the address managed by the stream for multicast. This allows us to have 1
multicast address for each stream.
Because the address is now managed by the stream we don't have to pass it around
anymore.
Set the address pool on the streams.
2012-11-15 16:18:29 +01:00
Wim Taymans
45b6693b39 rtsp: make address-pool return an address object
Return a boxed GstRTSPAddress from the GstRTSPAddressPool. This allows us to
store more info in the structure and allows us to more easily return the address
to the right pool when no longer needed.
Pass the address to the StreamTransport so that we can return it to the pool
when the stream transport is freed or changed.
2012-11-15 13:25:14 +01:00
Wim Taymans
c7d20e5603 stream-transport: add keep-alive method 2012-11-12 17:11:18 +01:00
Wim Taymans
75473fc88d stream-transport: add method to handle RTP/RTCP
Call new methods instead of poking into the structures directly.
2012-11-12 17:06:42 +01:00
Tim-Philipp Müller
4dba434f16 Fix FSF address 2012-11-04 00:14:25 +00:00
Wim Taymans
543aa383e7 rtsp: only create transport when needed
Only create the StreamTransport when configured.
2012-10-28 00:23:57 +02:00
Wim Taymans
fb117a4f75 rtsp: refactor configuration of transport
Move the configuration of the transport to a place where it makes
more sense.
2012-10-27 23:49:24 +02:00
Wim Taymans
348b7f9c21 docs: update docs 2012-10-26 12:35:20 +02:00
Wim Taymans
de7c72dec2 rtsp: massive refactoring
Make GObjects from the remaining simple structures.
Remove GstRTSPSessionStream, it's not needed.
Rename GstRTSPMediaStream -> GstRTSPStream: It is shorter
Rename GstRTSPMediaTrans -> GstRTSPStreamTransport: It describes how
  a GstRTSPStream should be transported to a client.
Rename GstRTSPMediaFactory::get_element -> create_element because that
  more accurately describes what it does.
Make nice methods instead of poking in the structures.
Move some methods inside the relevant object source code.
Use GPtrArray to store objects instead of plain arrays, it is more
  natural and allows us to more easily clean up.
Move the allocation of udp ports to the Stream object. The Stream object
  contains the elements needed to stream the media to a client.
Improve the prepare and unprepare methods. Unprepare should now undo
  everything prepare did. Improve also async unprepare when doing EOS on
  shutdown. Make sure we always unprepare correctly.
2012-10-25 21:29:58 +02:00