mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 15:04:46 +00:00
rtpsession: avoid timing out source too quickly
... following a PAUSE/PLAY cycle, particularly applicable when operating with a short RTCP interval (possibly forced so server-side).
This commit is contained in:
parent
77ebd33991
commit
f65d4c8300
3 changed files with 16 additions and 7 deletions
|
@ -837,6 +837,10 @@ rtcp_thread (GstRtpSession * rtpsession)
|
||||||
|
|
||||||
session = rtpsession->priv->session;
|
session = rtpsession->priv->session;
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (rtpsession, "starting at %" GST_TIME_FORMAT,
|
||||||
|
GST_TIME_ARGS (current_time));
|
||||||
|
session->start_time = current_time;
|
||||||
|
|
||||||
while (!rtpsession->priv->stop_thread) {
|
while (!rtpsession->priv->stop_thread) {
|
||||||
GstClockReturn res;
|
GstClockReturn res;
|
||||||
|
|
||||||
|
|
|
@ -2748,6 +2748,7 @@ session_cleanup (const gchar * key, RTPSource * source, ReportData * data)
|
||||||
gboolean is_sender, is_active;
|
gboolean is_sender, is_active;
|
||||||
RTPSession *sess = data->sess;
|
RTPSession *sess = data->sess;
|
||||||
GstClockTime interval;
|
GstClockTime interval;
|
||||||
|
GstClockTime btime;
|
||||||
|
|
||||||
is_sender = RTP_SOURCE_IS_SENDER (source);
|
is_sender = RTP_SOURCE_IS_SENDER (source);
|
||||||
is_active = RTP_SOURCE_IS_ACTIVE (source);
|
is_active = RTP_SOURCE_IS_ACTIVE (source);
|
||||||
|
@ -2766,11 +2767,13 @@ session_cleanup (const gchar * key, RTPSource * source, ReportData * data)
|
||||||
}
|
}
|
||||||
/* sources that were inactive for more than 5 times the deterministic reporting
|
/* sources that were inactive for more than 5 times the deterministic reporting
|
||||||
* interval get timed out. the min timeout is 5 seconds. */
|
* interval get timed out. the min timeout is 5 seconds. */
|
||||||
if (data->current_time > source->last_activity) {
|
/* mind old time that might pre-date last time going to PLAYING */
|
||||||
|
btime = MAX (source->last_activity, sess->start_time);
|
||||||
|
if (data->current_time > btime) {
|
||||||
interval = MAX (data->interval * 5, 5 * GST_SECOND);
|
interval = MAX (data->interval * 5, 5 * GST_SECOND);
|
||||||
if (data->current_time - source->last_activity > interval) {
|
if (data->current_time - btime > interval) {
|
||||||
GST_DEBUG ("removing timeout source %08x, last %" GST_TIME_FORMAT,
|
GST_DEBUG ("removing timeout source %08x, last %" GST_TIME_FORMAT,
|
||||||
source->ssrc, GST_TIME_ARGS (source->last_activity));
|
source->ssrc, GST_TIME_ARGS (btime));
|
||||||
remove = TRUE;
|
remove = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2779,12 +2782,13 @@ session_cleanup (const gchar * key, RTPSource * source, ReportData * data)
|
||||||
/* senders that did not send for a long time become a receiver, this also
|
/* senders that did not send for a long time become a receiver, this also
|
||||||
* holds for our own source. */
|
* holds for our own source. */
|
||||||
if (is_sender) {
|
if (is_sender) {
|
||||||
if (data->current_time > source->last_rtp_activity) {
|
/* mind old time that might pre-date last time going to PLAYING */
|
||||||
|
btime = MAX (source->last_rtp_activity, sess->start_time);
|
||||||
|
if (data->current_time > btime) {
|
||||||
interval = MAX (data->interval * 2, 5 * GST_SECOND);
|
interval = MAX (data->interval * 2, 5 * GST_SECOND);
|
||||||
if (data->current_time - source->last_rtp_activity > interval) {
|
if (data->current_time - btime > interval) {
|
||||||
GST_DEBUG ("sender source %08x timed out and became receiver, last %"
|
GST_DEBUG ("sender source %08x timed out and became receiver, last %"
|
||||||
GST_TIME_FORMAT, source->ssrc,
|
GST_TIME_FORMAT, source->ssrc, GST_TIME_ARGS (btime));
|
||||||
GST_TIME_ARGS (source->last_rtp_activity));
|
|
||||||
source->is_sender = FALSE;
|
source->is_sender = FALSE;
|
||||||
sess->stats.sender_sources--;
|
sess->stats.sender_sources--;
|
||||||
sendertimeout = TRUE;
|
sendertimeout = TRUE;
|
||||||
|
|
|
@ -209,6 +209,7 @@ struct _RTPSession {
|
||||||
|
|
||||||
GstClockTime next_rtcp_check_time;
|
GstClockTime next_rtcp_check_time;
|
||||||
GstClockTime last_rtcp_send_time;
|
GstClockTime last_rtcp_send_time;
|
||||||
|
GstClockTime start_time;
|
||||||
gboolean first_rtcp;
|
gboolean first_rtcp;
|
||||||
gboolean allow_early;
|
gboolean allow_early;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue