From cd923223dd24576679ff91deda71cc8f172504c3 Mon Sep 17 00:00:00 2001 From: Olivier CrĂȘte Date: Fri, 27 Aug 2010 14:11:53 -0400 Subject: rtpsession: Add action signal to request early RTCP --- gst/rtpmanager/gstrtpbin-marshal.list | 1 + gst/rtpmanager/rtpsession.c | 33 +++++++++++++++++++++++++++++++++ gst/rtpmanager/rtpsession.h | 1 + 3 files changed, 35 insertions(+) diff --git a/gst/rtpmanager/gstrtpbin-marshal.list b/gst/rtpmanager/gstrtpbin-marshal.list index 5176b334d..7d9821f51 100644 --- a/gst/rtpmanager/gstrtpbin-marshal.list +++ b/gst/rtpmanager/gstrtpbin-marshal.list @@ -9,3 +9,4 @@ VOID:OBJECT,OBJECT UINT64:BOOL,UINT64 BOOL:POINTER,BOOL VOID:UINT,UINT,UINT,UINT,POINTER +VOID:UINT64 diff --git a/gst/rtpmanager/rtpsession.c b/gst/rtpmanager/rtpsession.c index a60e7c094..49ce69b61 100644 --- a/gst/rtpmanager/rtpsession.c +++ b/gst/rtpmanager/rtpsession.c @@ -44,6 +44,7 @@ enum SIGNAL_ON_SENDER_TIMEOUT, SIGNAL_ON_SENDING_RTCP, SIGNAL_ON_FEEDBACK_RTCP, + SIGNAL_SEND_RTCP, LAST_SIGNAL }; @@ -104,6 +105,8 @@ static void rtp_session_get_property (GObject * object, guint prop_id, static gboolean rtp_session_on_sending_rtcp (RTPSession * sess, GstBuffer * buffer, gboolean early); +static void rtp_session_send_rtcp (RTPSession * sess, + GstClockTimeDiff max_delay); static guint rtp_session_signals[LAST_SIGNAL] = { 0 }; @@ -299,6 +302,22 @@ rtp_session_class_init (RTPSessionClass * klass) G_TYPE_NONE, 4, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_UINT, G_TYPE_POINTER); + /** + * RTPSession::send-rtcp: + * @session: the object which received the signal + * @max_delay: The maximum delay after which the feedback will not be useful + * anymore + * + * Requests that the #RTPSession initiate a new RTCP packet as soon as + * possible within the requested delay. + */ + + rtp_session_signals[SIGNAL_SEND_RTCP] = + g_signal_new ("send-rtcp", G_TYPE_FROM_CLASS (klass), + G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION, + G_STRUCT_OFFSET (RTPSessionClass, send_rtcp), NULL, NULL, + gst_rtp_bin_marshal_VOID__UINT64, G_TYPE_NONE, 1, G_TYPE_UINT64); + g_object_class_install_property (gobject_class, PROP_INTERNAL_SSRC, g_param_spec_uint ("internal-ssrc", "Internal SSRC", "The internal SSRC used for the session", @@ -408,6 +427,7 @@ rtp_session_class_init (RTPSessionClass * klass) klass->get_source_by_ssrc = GST_DEBUG_FUNCPTR (rtp_session_get_source_by_ssrc); klass->on_sending_rtcp = GST_DEBUG_FUNCPTR (rtp_session_on_sending_rtcp); + klass->send_rtcp = GST_DEBUG_FUNCPTR (rtp_session_send_rtcp); GST_DEBUG_CATEGORY_INIT (rtp_session_debug, "rtpsession", 0, "RTP Session"); } @@ -3134,3 +3154,16 @@ rtp_session_on_sending_rtcp (RTPSession * sess, GstBuffer * buffer, return ret; } + +static void +rtp_session_send_rtcp (RTPSession * sess, GstClockTimeDiff max_delay) +{ + GstClockTime now; + + if (!sess->callbacks.send_rtcp) + return; + + now = sess->callbacks.request_time (sess, sess->request_time_user_data); + + rtp_session_request_early_rtcp (sess, now, max_delay); +} diff --git a/gst/rtpmanager/rtpsession.h b/gst/rtpmanager/rtpsession.h index 3746a9b72..3268490ca 100644 --- a/gst/rtpmanager/rtpsession.h +++ b/gst/rtpmanager/rtpsession.h @@ -264,6 +264,7 @@ struct _RTPSessionClass { gboolean early); void (*on_feedback_rtcp) (RTPSession *sess, guint type, guint fbtype, guint sender_ssrc, guint media_ssrc, GstBuffer *fci); + void (*send_rtcp) (RTPSession *sess, GstClockTimeDiff max_delay); }; GType rtp_session_get_type (void); -- cgit v1.2.3