From a95c049f76344f08a3ae129af0fc6f55182c5f96 Mon Sep 17 00:00:00 2001 From: Patrick Radizi Date: Fri, 12 Jun 2009 16:06:28 +0200 Subject: rtspsrc: Add RTP blocksize functionality Add property to make the client suggest a blocksize to the server. Fixes #585549 --- gst/rtsp/gstrtspsrc.c | 31 +++++++++++++++++++++++++++++++ gst/rtsp/gstrtspsrc.h | 1 + 2 files changed, 32 insertions(+) (limited to 'gst/rtsp') diff --git a/gst/rtsp/gstrtspsrc.c b/gst/rtsp/gstrtspsrc.c index 210e142e..d0c007b8 100644 --- a/gst/rtsp/gstrtspsrc.c +++ b/gst/rtsp/gstrtspsrc.c @@ -149,6 +149,7 @@ enum #define DEFAULT_NAT_METHOD GST_RTSP_NAT_DUMMY #define DEFAULT_DO_RTCP TRUE #define DEFAULT_PROXY NULL +#define DEFAULT_RTP_BLOCKSIZE 0 enum { @@ -164,6 +165,7 @@ enum PROP_NAT_METHOD, PROP_DO_RTCP, PROP_PROXY, + PROP_RTP_BLOCKSIZE, PROP_LAST }; @@ -239,6 +241,7 @@ static void gst_rtspsrc_loop (GstRTSPSrc * src); static void gst_rtspsrc_stream_push_event (GstRTSPSrc * src, GstRTSPStream * stream, GstEvent * event); static void gst_rtspsrc_push_event (GstRTSPSrc * src, GstEvent * event); +static gchar *gst_rtspsrc_dup_printf (const gchar * format, ...); /* commands we send to out loop to notify it of events */ #define CMD_WAIT 0 @@ -367,6 +370,19 @@ gst_rtspsrc_class_init (GstRTSPSrcClass * klass) "Proxy settings for HTTP tunneling. Format: [http://][user:passwd@]host[:port]", DEFAULT_PROXY, G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + /** + * GstRTSPSrc::rtp_blocksize + * + * RTP package size to suggest to server. + * + * Since: 0.10.16 + */ + g_object_class_install_property (gobject_class, PROP_RTP_BLOCKSIZE, + g_param_spec_uint ("rtp-blocksize", "RTP Blocksize", + "RTP package size to suggest to server (0 = disabled)", + 0, 65536, DEFAULT_RTP_BLOCKSIZE, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + gstelement_class->change_state = gst_rtspsrc_change_state; gstbin_class->handle_message = gst_rtspsrc_handle_message; @@ -542,6 +558,9 @@ gst_rtspsrc_set_property (GObject * object, guint prop_id, const GValue * value, case PROP_PROXY: gst_rtspsrc_set_proxy (rtspsrc, g_value_get_string (value)); break; + case PROP_RTP_BLOCKSIZE: + rtspsrc->rtp_blocksize = g_value_get_uint (value); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -606,6 +625,9 @@ gst_rtspsrc_get_property (GObject * object, guint prop_id, GValue * value, g_value_take_string (value, str); break; } + case PROP_RTP_BLOCKSIZE: + g_value_set_uint (value, rtspsrc->rtp_blocksize); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -4074,6 +4096,7 @@ gst_rtspsrc_setup_streams (GstRTSPSrc * src) gboolean unsupported_real = FALSE; gint rtpport, rtcpport; GstRTSPUrl *url; + gchar *hval; url = gst_rtsp_connection_get_url (src->connection); @@ -4161,6 +4184,14 @@ gst_rtspsrc_setup_streams (GstRTSPSrc * src) gst_rtsp_message_add_header (&request, GST_RTSP_HDR_TRANSPORT, transports); g_free (transports); + /* if the user wants a non default RTP packet size we add the blocksize + * parameter */ + if (src->rtp_blocksize > 0) { + hval = gst_rtspsrc_dup_printf ("%d", src->rtp_blocksize); + gst_rtsp_message_add_header (&request, GST_RTSP_HDR_BLOCKSIZE, hval); + g_free (hval); + } + /* handle the code ourselves */ if ((res = gst_rtspsrc_send (src, &request, &response, &code) < 0)) goto send_error; diff --git a/gst/rtsp/gstrtspsrc.h b/gst/rtsp/gstrtspsrc.h index c2387c7e..b4ed06bc 100644 --- a/gst/rtsp/gstrtspsrc.h +++ b/gst/rtsp/gstrtspsrc.h @@ -193,6 +193,7 @@ struct _GstRTSPSrc { guint proxy_port; gchar *proxy_user; gchar *proxy_passwd; + guint rtp_blocksize; /* state */ GstRTSPState state; -- cgit