vlc | branch: master | Francois Cartegnie <[email protected]> | 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;
     }

_______________________________________________
vlc-commits mailing list
[email protected]
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to