From 7c796b3c050902405e9a891b728682591b6c1e73 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sebastian=20Dr=C3=B6ge?= Date: Sat, 9 Apr 2022 11:00:52 +0300 Subject: [PATCH] rtpsession: Only add send latency to the running time if it is actually known Otherwise we can't know the running time yet if rtcp-sync-send-time is set, and have to wait until the latency is known later. Part-of: --- subprojects/gst-plugins-good/gst/rtpmanager/gstrtpsession.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/subprojects/gst-plugins-good/gst/rtpmanager/gstrtpsession.c b/subprojects/gst-plugins-good/gst/rtpmanager/gstrtpsession.c index 0f018aa..2ec5907 100644 --- a/subprojects/gst-plugins-good/gst/rtpmanager/gstrtpsession.c +++ b/subprojects/gst-plugins-good/gst/rtpmanager/gstrtpsession.c @@ -1309,6 +1309,7 @@ gst_rtp_session_change_state (GstElement * element, GstStateChange transition) case GST_STATE_CHANGE_READY_TO_PAUSED: GST_RTP_SESSION_LOCK (rtpsession); rtpsession->priv->wait_send = TRUE; + rtpsession->priv->send_latency = GST_CLOCK_TIME_NONE; GST_RTP_SESSION_UNLOCK (rtpsession); break; case GST_STATE_CHANGE_PAUSED_TO_PLAYING: @@ -2429,8 +2430,15 @@ gst_rtp_session_chain_send_rtp_common (GstRtpSession * rtpsession, running_time = gst_segment_to_running_time (&rtpsession->send_rtp_seg, GST_FORMAT_TIME, timestamp); - if (priv->rtcp_sync_send_time) - running_time += priv->send_latency; + if (priv->rtcp_sync_send_time) { + if (priv->send_latency != GST_CLOCK_TIME_NONE) { + running_time += priv->send_latency; + } else { + GST_WARNING_OBJECT (rtpsession, + "Can't determine running time for this packet without knowing configured latency"); + running_time = -1; + } + } } else { /* no timestamp. */ running_time = -1; -- 2.7.4