rtpsession: use RTT from the Retransmission event
authorWim Taymans <wtaymans@redhat.com>
Fri, 27 Dec 2013 15:48:48 +0000 (16:48 +0100)
committerWim Taymans <wtaymans@redhat.com>
Mon, 30 Dec 2013 10:18:50 +0000 (11:18 +0100)
Place the estimated RTT in the Retransmission event and let the session
manager use that instead of the hardcoded value.

gst/rtpmanager/gstrtpjitterbuffer.c
gst/rtpmanager/gstrtpsession.c

index 85dad3be94b028fb32a8958a19ad77e0ef5cdd13..ab7d838e43bb1830341fb7fdf801b77baff5d654 100644 (file)
@@ -2504,7 +2504,9 @@ do_expected_timeout (GstRtpJitterBuffer * jitterbuffer, TimerData * timer,
           "frequency", G_TYPE_UINT, priv->rtx_retry_timeout,
           "period", G_TYPE_UINT, priv->rtx_retry_period,
           "deadline", G_TYPE_UINT, priv->latency_ms,
-          "packet-spacing", G_TYPE_UINT64, priv->packet_spacing, NULL));
+          "packet-spacing", G_TYPE_UINT64, priv->packet_spacing,
+          "avg-rtt", G_TYPE_UINT, GST_TIME_AS_MSECONDS (priv->avg_rtx_rtt),
+          NULL));
 
   priv->num_rtx_requests++;
   timer->num_rtx_retry++;
index 4c9437ad002625d33a9ce47ceb9e44d96d4e94c2..f51b61353e7f7aa6ae14500bb9608a3e70f2aea9 100644 (file)
@@ -1551,7 +1551,7 @@ gst_rtp_session_event_recv_rtp_src (GstPad * pad, GstObject * parent,
           forward = FALSE;
       } else if (gst_structure_has_name (s, "GstRTPRetransmissionRequest")) {
         GstClockTime running_time;
-        guint seqnum, delay, deadline, max_delay;
+        guint seqnum, delay, deadline, max_delay, avg_rtt;
 
         GST_RTP_SESSION_LOCK (rtpsession);
         rtpsession->priv->rtx_count++;
@@ -1567,14 +1567,16 @@ gst_rtp_session_event_recv_rtp_src (GstPad * pad, GstObject * parent,
           delay = 0;
         if (!gst_structure_get_uint (s, "deadline", &deadline))
           deadline = 100;
+        if (!gst_structure_get_uint (s, "avg-rtt", &avg_rtt))
+          avg_rtt = 40;
 
         /* remaining time to receive the packet */
         max_delay = deadline;
         if (max_delay > delay)
           max_delay -= delay;
         /* estimated RTT */
-        if (max_delay > 40)
-          max_delay -= 40;
+        if (max_delay > avg_rtt)
+          max_delay -= avg_rtt;
         else
           max_delay = 0;