[vlc-commits] packetizer: mpegvideo: fix dts repeats regression (#24072)

Francois Cartegnie git at videolan.org
Tue Feb 11 09:31:02 CET 2020


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Feb 10 14:01:57 2020 +0100| [dd1f506f409ab14ab579f08e077fd0fcd53ee1d4] | committer: Francois Cartegnie

packetizer: mpegvideo: fix dts repeats regression (#24072)

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

 modules/packetizer/mpegvideo.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/modules/packetizer/mpegvideo.c b/modules/packetizer/mpegvideo.c
index d906f6adde..bb0771a398 100644
--- a/modules/packetizer/mpegvideo.c
+++ b/modules/packetizer/mpegvideo.c
@@ -997,6 +997,18 @@ static block_t *ParseMPEGBlock( decoder_t *p_dec, block_t *p_frag )
             p_sys->i_picture_type = ( p_frag->p_buffer[5] >> 3 ) & 0x03;
         }
 
+        /* Check if we can use timestamps */
+        if(p_frag->i_dts != VLC_TICK_INVALID &&
+           p_frag->i_dts <= date_Get(&p_sys->dts))
+        {
+            date_t next = p_sys->dts;
+            date_Set(&next, p_frag->i_dts);
+            /* Because the prev timestamp could have been repeated though
+             * helper, clear up if we are within 2 frames backward */
+            if(date_Increment(&next, 4) >= p_sys->i_dts)
+                p_frag->i_dts = p_frag->i_pts = VLC_TICK_INVALID; /* do not reuse */
+        }
+
         p_sys->i_dts = p_frag->i_dts;
         p_sys->i_pts = p_frag->i_pts;
     }



More information about the vlc-commits mailing list