summaryrefslogtreecommitdiffstats
path: root/gst/rtpmanager/rtpsession.c
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@gmail.com>2007-10-05 17:26:14 +0000
committerTim-Philipp Müller <tim.muller@collabora.co.uk>2009-08-11 02:30:31 +0100
commit76a89b5e500952afb6d8d0c544848c7c99bb0427 (patch)
tree302c41180d15c07b5d38b684755f7230c8db7364 /gst/rtpmanager/rtpsession.c
parent387f41e157e0aac82d798152765e1c952c3a7c47 (diff)
gst/rtpmanager/rtpsession.c: When reconsidering RTCP timeouts, set the next timeout against the last report time inst...
Original commit message from CVS: * gst/rtpmanager/rtpsession.c: (rtp_session_next_timeout), When reconsidering RTCP timeouts, set the next timeout against the last report time instead of the current clock time so that we don't end up reconsidering forever.
Diffstat (limited to 'gst/rtpmanager/rtpsession.c')
-rw-r--r--gst/rtpmanager/rtpsession.c43
1 files changed, 32 insertions, 11 deletions
diff --git a/gst/rtpmanager/rtpsession.c b/gst/rtpmanager/rtpsession.c
index 0f907efd..628147df 100644
--- a/gst/rtpmanager/rtpsession.c
+++ b/gst/rtpmanager/rtpsession.c
@@ -1569,19 +1569,35 @@ rtp_session_next_timeout (RTPSession * sess, GstClockTime time)
result = sess->next_rtcp_check_time;
+ GST_DEBUG ("current time: %" GST_TIME_FORMAT ", next :%" GST_TIME_FORMAT,
+ GST_TIME_ARGS (time), GST_TIME_ARGS (result));
+
+ if (result < time) {
+ GST_DEBUG ("take current time as base");
+ /* our previous check time expired, start counting from the current time
+ * again. */
+ result = time;
+ }
+
if (sess->source->received_bye) {
- if (sess->sent_bye)
+ if (sess->sent_bye) {
+ GST_DEBUG ("we sent BYE already");
result = GST_CLOCK_TIME_NONE;
- else if (sess->stats.active_sources >= 50)
+ } else if (sess->stats.active_sources >= 50) {
+ GST_DEBUG ("reconsider BYE, more than 50 sources");
/* reconsider BYE if members >= 50 */
- result = time + calculate_rtcp_interval (sess, FALSE, TRUE);
+ result += calculate_rtcp_interval (sess, FALSE, TRUE);
+ }
} else {
- if (sess->first_rtcp)
+ if (sess->first_rtcp) {
+ GST_DEBUG ("first RTCP packet");
/* we are called for the first time */
- result = time + calculate_rtcp_interval (sess, FALSE, TRUE);
- else if (sess->next_rtcp_check_time < time)
+ result += calculate_rtcp_interval (sess, FALSE, TRUE);
+ } else if (sess->next_rtcp_check_time < time) {
+ GST_DEBUG ("old check time expired, getting new timeout");
/* get a new timeout when we need to */
- result = time + calculate_rtcp_interval (sess, FALSE, FALSE);
+ result += calculate_rtcp_interval (sess, FALSE, FALSE);
+ }
}
sess->next_rtcp_check_time = result;
@@ -1784,20 +1800,25 @@ session_bye (RTPSession * sess, ReportData * data)
static gboolean
is_rtcp_time (RTPSession * sess, GstClockTime time, ReportData * data)
{
- GstClockTime new_send_time;
+ GstClockTime new_send_time, elapsed;
gboolean result;
/* no need to check yet */
if (sess->next_rtcp_check_time > time) {
- GST_DEBUG ("no check time yet");
+ GST_DEBUG ("no check time yet, next %" GST_TIME_FORMAT " > now %"
+ GST_TIME_FORMAT, GST_TIME_ARGS (sess->next_rtcp_check_time),
+ GST_TIME_ARGS (time));
return FALSE;
}
+ /* get elapsed time since we last reported */
+ elapsed = time - sess->last_rtcp_send_time;
+
/* perform forward reconsideration */
new_send_time = rtp_stats_add_rtcp_jitter (&sess->stats, data->interval);
- GST_DEBUG ("forward reconsideration %" GST_TIME_FORMAT,
- GST_TIME_ARGS (new_send_time));
+ GST_DEBUG ("forward reconsideration %" GST_TIME_FORMAT ", elapsed %"
+ GST_TIME_FORMAT, GST_TIME_ARGS (new_send_time), GST_TIME_ARGS (elapsed));
new_send_time += sess->last_rtcp_send_time;