From e952f7ba437e7f84f31cf4f6be2b42134ce2d92b Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 26 Jul 2013 12:06:35 +0200 Subject: [PATCH] session: remove internal sources on timeout When an internal source times out and becomes a receiver, remove it. --- gst/rtpmanager/rtpsession.c | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/gst/rtpmanager/rtpsession.c b/gst/rtpmanager/rtpsession.c index dd25ef064f..0911720912 100644 --- a/gst/rtpmanager/rtpsession.c +++ b/gst/rtpmanager/rtpsession.c @@ -2857,7 +2857,6 @@ session_cleanup (const gchar * key, RTPSource * source, ReportData * data) GST_LOG ("timeout base interval %" GST_TIME_FORMAT, GST_TIME_ARGS (binterval)); - /* FIXME, we need to remove internal sources too */ if (!source->internal) { if (source->marked_bye) { /* if we received a BYE from the source, remove the source after some @@ -2891,13 +2890,16 @@ session_cleanup (const gchar * key, RTPSource * source, ReportData * data) if (data->current_time > btime) { interval = MAX (binterval * 2, 5 * GST_SECOND); if (data->current_time - btime > interval) { - GST_DEBUG ("sender source %08x timed out and became receiver, last %" - GST_TIME_FORMAT, source->ssrc, GST_TIME_ARGS (btime)); - source->is_sender = FALSE; - sess->stats.sender_sources--; - if (source->internal) - sess->stats.internal_sender_sources--; - sendertimeout = TRUE; + if (source->internal && source->sent_bye) { + /* an internal source is BYE and stopped sending RTP, remove */ + GST_DEBUG ("internal BYE source %08x timed out, last %" + GST_TIME_FORMAT, source->ssrc, GST_TIME_ARGS (btime)); + remove = TRUE; + } else { + GST_DEBUG ("sender source %08x timed out and became receiver, last %" + GST_TIME_FORMAT, source->ssrc, GST_TIME_ARGS (btime)); + sendertimeout = TRUE; + } } } } @@ -2920,8 +2922,14 @@ session_cleanup (const gchar * key, RTPSource * source, ReportData * data) else on_timeout (sess, source); } else { - if (sendertimeout) + if (sendertimeout) { + source->is_sender = FALSE; + sess->stats.sender_sources--; + if (source->internal) + sess->stats.internal_sender_sources--; + on_sender_timeout (sess, source); + } } source->closing = remove;