[vlc-commits] packetizer: mpegvideo: don't increment invalid dts

Francois Cartegnie git at videolan.org
Sat May 20 13:55:40 CEST 2017


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri May 19 19:49:18 2017 +0200| [1f83239c3fdc7b7897e49a8fd0e867e2400c8b59] | committer: Francois Cartegnie

packetizer: mpegvideo: don't increment invalid dts

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

 modules/packetizer/mpegvideo.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/modules/packetizer/mpegvideo.c b/modules/packetizer/mpegvideo.c
index 58acfb7ba1..5f84d73017 100644
--- a/modules/packetizer/mpegvideo.c
+++ b/modules/packetizer/mpegvideo.c
@@ -526,9 +526,12 @@ static block_t *ParseMPEGBlock( decoder_t *p_dec, block_t *p_frag )
 
             p_pic->i_pts = date_Get( &datepts );
 
-            date_Increment( &p_sys->dts,  i_num_fields );
+            if( date_Get( &p_sys->dts ) != VLC_TS_INVALID )
+            {
+                date_Increment( &p_sys->dts,  i_num_fields );
 
-            p_pic->i_length = date_Get( &p_sys->dts ) - p_pic->i_dts;
+                p_pic->i_length = date_Get( &p_sys->dts ) - p_pic->i_dts;
+            }
             p_sys->i_prev_temporal_ref = p_sys->i_temporal_ref;
         }
         else /* General case, use demuxer's dts/pts when set or interpolate */
@@ -570,9 +573,12 @@ static block_t *ParseMPEGBlock( decoder_t *p_dec, block_t *p_frag )
                 p_pic->i_pts = VLC_TS_INVALID;
             }
 
-            date_Increment( &p_sys->dts,  i_num_fields );
+            if( date_Get( &p_sys->dts ) != VLC_TS_INVALID )
+            {
+                date_Increment( &p_sys->dts,  i_num_fields );
 
-            p_pic->i_length = date_Get( &p_sys->dts ) - p_pic->i_dts;
+                p_pic->i_length = date_Get( &p_sys->dts ) - p_pic->i_dts;
+            }
         }
 
 #if 0



More information about the vlc-commits mailing list