[vlc-devel] commit: RTP: apply de-jitter from last dequeuing rather than last queuing ( Rémi Denis-Courmont )

git version control git at videolan.org
Mon Sep 7 18:13:51 CEST 2009


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Sep  7 19:09:35 2009 +0300| [4f49f2aac62b4459cf75f3c593e4ee2e52b2f921] | committer: Rémi Denis-Courmont 

RTP: apply de-jitter from last dequeuing rather than last queuing

Previously, if the absolute delay dropped by a longer interval than the
packetization time, we could end up repeatedly waiting into the future,
and never dequeue anything.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=4f49f2aac62b4459cf75f3c593e4ee2e52b2f921
---

 modules/access/rtp/session.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/modules/access/rtp/session.c b/modules/access/rtp/session.c
index 5b7dccb..7d1fef5 100644
--- a/modules/access/rtp/session.c
+++ b/modules/access/rtp/session.c
@@ -146,6 +146,7 @@ struct rtp_source_t
 
     uint16_t last_seq; /* sequence of the next dequeued packet */
     block_t *blocks; /* re-ordered blocks queue */
+    mtime_t  last_dq; /* last dequeued (decoded) packet local timestamp */
     void    *opaque[0]; /* Per-source private payload data */
 };
 
@@ -314,6 +315,7 @@ rtp_queue (demux_t *demux, rtp_session_t *session, block_t *block)
         }
     }
     src->last_rx = now;
+    block->i_pts = now;
     src->last_ts = rtp_timestamp (block);
 
     /* Check sequence number */
@@ -410,6 +412,7 @@ rtp_decode (demux_t *demux, const rtp_session_t *session, rtp_source_t *src)
     /* FIXME: handle timestamp wrap properly */
     /* TODO: inter-medias/sessions sync (using RTCP-SR) */
     const uint32_t timestamp = rtp_timestamp (block);
+    src->last_dq = block->i_pts;
     block->i_pts = CLOCK_FREQ * timestamp / pt->frequency;
 
     /* CSRC count */
@@ -489,7 +492,7 @@ bool rtp_dequeue (demux_t *demux, const rtp_session_t *session,
              * match for random gaussian jitter). Additionnaly, we implicitly
              * wait for misordering times the packetization time.
              */
-            mtime_t deadline = src->last_rx;
+            mtime_t deadline = src->last_dq;
             const rtp_pt_t *pt = rtp_find_ptype (session, src, block, NULL);
             if (pt)
                 deadline += CLOCK_FREQ * 3 * src->jitter / pt->frequency;




More information about the vlc-devel mailing list