rtpsession: Only warn once if configured latency needs to be known but isn't yet

Otherwise we would warn about this once for every single packet until
the LATENCY event is received.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5854>
This commit is contained in:
Sebastian Dröge 2023-12-22 12:56:33 +02:00 committed by GStreamer Marge Bot
parent 04ae39f25b
commit c292da7044

View file

@ -276,6 +276,9 @@ struct _GstRtpSessionPrivate
GHashTable *ptmap;
GstClockTime send_latency;
/* Set if we warned once already that no latency is configured yet but we
* need it to calculate correct send running time of the packets */
gboolean warned_latency_once;
gboolean use_pipeline_clock;
GstRtpNtpTimeSource ntp_time_source;
@ -1367,6 +1370,7 @@ gst_rtp_session_change_state (GstElement * element, GstStateChange transition)
GST_RTP_SESSION_LOCK (rtpsession);
rtpsession->priv->wait_send = TRUE;
rtpsession->priv->send_latency = GST_CLOCK_TIME_NONE;
rtpsession->priv->warned_latency_once = FALSE;
GST_RTP_SESSION_UNLOCK (rtpsession);
break;
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
@ -2475,8 +2479,14 @@ gst_rtp_session_chain_send_rtp_common (GstRtpSession * rtpsession,
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");
if (!priv->warned_latency_once) {
priv->warned_latency_once = TRUE;
GST_WARNING_OBJECT (rtpsession,
"Can't determine running time for this packet without knowing configured latency");
} else {
GST_LOG_OBJECT (rtpsession,
"Can't determine running time for this packet without knowing configured latency");
}
running_time = -1;
}
}