RTP: dequeue and discard late packets
authorRémi Denis-Courmont <rdenis@simphalempin.com>
Wed, 3 Dec 2008 17:29:38 +0000 (19:29 +0200)
committerRémi Denis-Courmont <rdenis@simphalempin.com>
Wed, 3 Dec 2008 17:29:38 +0000 (19:29 +0200)
modules/access/rtp/session.c

index e9bf3cb..a4e0d22 100644 (file)
@@ -479,13 +479,12 @@ bool rtp_dequeue (demux_t *demux, const rtp_session_t *session,
          */
         while (((block = src->blocks)) != NULL)
         {
-#if 0
-            if (rtp_seq (block) == ((src->last_seq + 1) & 0xffff))
-            {   /* Next block ready, no need to wait */
+            if ((int16_t)(rtp_seq (block) - (src->last_seq + 1)) <= 0)
+            {   /* Next (or earlier) block ready, no need to wait */
                 rtp_decode (demux, session, src);
                 continue;
             }
-#endif
+
             /* Wait for 3 times the inter-arrival delay variance (about 99.7%
              * match for random gaussian jitter). Additionnaly, we implicitly
              * wait for misordering times the packetization time.