rtsp-stream: Implement UDP buffer size setting.

Add gst_rtsp_stream_(get|set)_buffer_size and use it to configure the
UDP TX buffer size.

Incorporates a patch by Hyunjun Ko <zzoon.ko@samsung.com>
Fixes https://bugzilla.gnome.org/show_bug.cgi?id=749095
This commit is contained in:
Jan Schmidt 2015-08-31 22:48:34 +10:00
parent 9bfcdba42b
commit 27736d406e
3 changed files with 64 additions and 3 deletions

View file

@ -1124,6 +1124,7 @@ void
gst_rtsp_media_set_buffer_size (GstRTSPMedia * media, guint size)
{
GstRTSPMediaPrivate *priv;
guint i;
g_return_if_fail (GST_IS_RTSP_MEDIA (media));
@ -1133,6 +1134,11 @@ gst_rtsp_media_set_buffer_size (GstRTSPMedia * media, guint size)
g_mutex_lock (&priv->lock);
priv->buffer_size = size;
for (i = 0; i < priv->streams->len; i++) {
GstRTSPStream *stream = g_ptr_array_index (priv->streams, i);
gst_rtsp_stream_set_buffer_size (stream, size);
}
g_mutex_unlock (&priv->lock);
}
@ -1560,6 +1566,7 @@ gst_rtsp_media_create_stream (GstRTSPMedia * media, GstElement * payloader,
gst_rtsp_stream_set_profiles (stream, priv->profiles);
gst_rtsp_stream_set_protocols (stream, priv->protocols);
gst_rtsp_stream_set_retransmission_time (stream, priv->rtx_time);
gst_rtsp_stream_set_buffer_size (stream, priv->buffer_size);
g_ptr_array_add (priv->streams, stream);

View file

@ -1389,8 +1389,8 @@ gst_rtsp_stream_set_retransmission_time (GstRTSPStream * stream,
}
/**
* gst_rtsp_media_get_retransmission_time:
* @media: a #GstRTSPMedia
* gst_rtsp_stream_get_retransmission_time:
* @stream: a #GstRTSPStream
*
* Get the amount of time to store retransmission data.
*
@ -1410,6 +1410,13 @@ gst_rtsp_stream_get_retransmission_time (GstRTSPStream * stream)
return ret;
}
/**
* gst_rtsp_stream_set_retransmission_pt:
* @stream: a #GstRTSPStream
* @rtx_pt: a #guint
*
* Set the payload type (pt) for retransmission of this stream.
*/
void
gst_rtsp_stream_set_retransmission_pt (GstRTSPStream * stream, guint rtx_pt)
{
@ -1431,6 +1438,14 @@ gst_rtsp_stream_set_retransmission_pt (GstRTSPStream * stream, guint rtx_pt)
g_mutex_unlock (&stream->priv->lock);
}
/**
* gst_rtsp_stream_get_retransmission_pt:
* @stream: a #GstRTSPStream
*
* Get the payload-type used for retransmission of this stream
*
* Returns: The retransmission PT.
*/
guint
gst_rtsp_stream_get_retransmission_pt (GstRTSPStream * stream)
{
@ -1445,6 +1460,43 @@ gst_rtsp_stream_get_retransmission_pt (GstRTSPStream * stream)
return rtx_pt;
}
/**
* gst_rtsp_media_get_buffer_size:
* @media: a #GstRTSPMedia
* @size: a #guint
*
* Set the size of the UDP transmission buffer (in bytes)
* Needs to be set before the stream is joined to a bin.
*
*/
void
gst_rtsp_stream_set_buffer_size (GstRTSPStream * stream, guint size)
{
g_mutex_lock (&stream->priv->lock);
stream->priv->buffer_size = size;
g_mutex_unlock (&stream->priv->lock);
}
/**
* gst_rtsp_media_get_buffer_size:
* @media: a #GstRTSPMedia
*
* Get the size of the UDP transmission buffer (in bytes)
*
* Returns: the size of the UDP TX buffer
*/
guint
gst_rtsp_stream_get_buffer_size (GstRTSPStream * stream)
{
guint buffer_size;
g_mutex_lock (&stream->priv->lock);
buffer_size = stream->priv->buffer_size;
g_mutex_unlock (&stream->priv->lock);
return buffer_size;
}
/* executed from streaming thread */
static void
caps_notify (GstPad * pad, GParamSpec * unused, GstRTSPStream * stream)

View file

@ -160,6 +160,8 @@ GstClockTime gst_rtsp_stream_get_retransmission_time (GstRTSPStream *st
guint gst_rtsp_stream_get_retransmission_pt (GstRTSPStream * stream);
void gst_rtsp_stream_set_retransmission_pt (GstRTSPStream * stream,
guint rtx_pt);
void gst_rtsp_stream_set_buffer_size (GstRTSPStream *stream, guint size);
guint gst_rtsp_stream_get_buffer_size (GstRTSPStream *stream);
void gst_rtsp_stream_set_pt_map (GstRTSPStream * stream, guint pt, GstCaps * caps);
GstElement * gst_rtsp_stream_request_aux_sender (GstRTSPStream * stream, guint sessid);