From a7b80281d1af025bde9fba40c5eee798a00f2f21 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 27 Apr 2007 15:09:12 +0000 Subject: gst/rtpmanager/gstrtpsession.c: Move reconsideration code to the rtpsession object. Original commit message from CVS: * gst/rtpmanager/gstrtpsession.c: (rtcp_thread), (gst_rtp_session_send_rtcp), (gst_rtp_session_reconsider): Move reconsideration code to the rtpsession object. Simplify timout handling and add reconsideration. * gst/rtpmanager/rtpsession.c: (rtp_session_class_init), (rtp_session_init), (rtp_session_finalize), (on_bye_ssrc), (on_bye_timeout), (on_timeout), (rtp_session_set_callbacks), (obtain_source), (rtp_session_create_source), (update_arrival_stats), (rtp_session_process_rtp), (rtp_session_process_sr), (rtp_session_process_rr), (rtp_session_process_bye), (rtp_session_process_rtcp), (calculate_rtcp_interval), (rtp_session_send_bye), (rtp_session_next_timeout), (session_start_rtcp), (session_report_blocks), (session_cleanup), (session_sdes), (session_bye), (is_rtcp_time), (rtp_session_on_timeout): * gst/rtpmanager/rtpsession.h: Handle timeout of inactive sources and senders. Implement BYE scheduling. * gst/rtpmanager/rtpsource.c: (calculate_jitter), (rtp_source_process_sr), (rtp_source_get_last_sr), (rtp_source_get_last_rb): * gst/rtpmanager/rtpsource.h: Add members to check for timeouts. * gst/rtpmanager/rtpstats.c: (rtp_stats_init_defaults), (rtp_stats_calculate_rtcp_interval), (rtp_stats_add_rtcp_jitter), (rtp_stats_calculate_bye_interval): * gst/rtpmanager/rtpstats.h: Use RFC algorithm for calculating the reporting interval. --- gst/rtpmanager/rtpsession.h | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) (limited to 'gst/rtpmanager/rtpsession.h') diff --git a/gst/rtpmanager/rtpsession.h b/gst/rtpmanager/rtpsession.h index 3554016fd..c9a2114fa 100644 --- a/gst/rtpmanager/rtpsession.h +++ b/gst/rtpmanager/rtpsession.h @@ -105,6 +105,17 @@ typedef gint (*RTPSessionClockRate) (RTPSession *sess, guint8 payload, gpointer */ typedef GstClockTime (*RTPSessionGetTime) (RTPSession *sess, gpointer user_data); +/** + * RTPSessionReconsider: + * @sess: an #RTPSession + * @user_data: user data specified when registering + * + * This callback will be called when @sess needs to cancel the previous timeout. + * The currently running timeout should be canceled and a new reporting interval + * should be requested from @sess. + */ +typedef void (*RTPSessionReconsider) (RTPSession *sess, gpointer user_data); + /** * RTPSessionCallbacks: * @RTPSessionProcessRTP: callback to process RTP packets @@ -122,6 +133,7 @@ typedef struct { RTPSessionSendRTCP send_rtcp; RTPSessionClockRate clock_rate; RTPSessionGetTime get_time; + RTPSessionReconsider reconsider; } RTPSessionCallbacks; /** @@ -164,6 +176,14 @@ struct _RTPSession { GHashTable *cnames; guint total_sources; + GstClockTime next_rtcp_check_time; + GstClockTime last_rtcp_send_time; + gboolean first_rtcp; + + GstBuffer *bye_packet; + gchar *bye_reason; + gboolean sent_bye; + RTPSessionCallbacks callbacks; gpointer user_data; @@ -185,6 +205,8 @@ struct _RTPSessionClass { void (*on_ssrc_collision) (RTPSession *sess, RTPSource *source); void (*on_ssrc_validated) (RTPSession *sess, RTPSource *source); void (*on_bye_ssrc) (RTPSession *sess, RTPSource *source); + void (*on_bye_timeout) (RTPSession *sess, RTPSource *source); + void (*on_timeout) (RTPSession *sess, RTPSource *source); }; GType rtp_session_get_type (void); @@ -229,8 +251,11 @@ GstFlowReturn rtp_session_process_rtcp (RTPSession *sess, GstBuffer /* processing packets for sending */ GstFlowReturn rtp_session_send_rtp (RTPSession *sess, GstBuffer *buffer); +/* stopping the session */ +GstFlowReturn rtp_session_send_bye (RTPSession *sess, const gchar *reason); + /* get interval for next RTCP interval */ -gdouble rtp_session_get_reporting_interval (RTPSession *sess); -GstFlowReturn rtp_session_perform_reporting (RTPSession *sess); +GstClockTime rtp_session_next_timeout (RTPSession *sess, GstClockTime time); +GstFlowReturn rtp_session_on_timeout (RTPSession *sess, GstClockTime time); #endif /* __RTP_SESSION_H__ */ -- cgit v1.2.3