[vlc-commits] [Git][videolan/vlc][master] rawvideo: factor date increment

Rémi Denis-Courmont (@Courmisch) gitlab at videolan.org
Sun Mar 20 08:40:36 UTC 2022



Rémi Denis-Courmont pushed to branch master at VideoLAN / VLC


Commits:
1171147b by Rémi Denis-Courmont at 2022-03-19T21:08:13+00:00
rawvideo: factor date increment

This works the same for the decoder and the packetiser.

- - - - -


1 changed file:

- modules/codec/rawvideo.c


Changes:

=====================================
modules/codec/rawvideo.c
=====================================
@@ -175,13 +175,16 @@ static block_t *DecodeBlock( decoder_t *p_dec, block_t *p_block )
     {
         date_Set( &p_sys->pts, p_block->i_pts );
     }
-    else if( p_block->i_dts != VLC_TICK_INVALID )
+    else
     {
-        /* NB, davidf doesn't quite agree with this in general, it is ok
-         * for rawvideo since it is in order (ie pts=dts), however, it
-         * may not be ok for an out-of-order codec, so don't copy this
-         * without thinking */
-        date_Set( &p_sys->pts, p_block->i_dts );
+        if( p_block->i_dts != VLC_TICK_INVALID )
+            /* NB, davidf doesn't quite agree with this in general, it is ok
+             * for rawvideo since it is in order (ie pts=dts), however, it
+             * may not be ok for an out-of-order codec, so don't copy this
+             * without thinking */
+            date_Set( &p_sys->pts, p_block->i_dts );
+
+        p_block->i_pts = date_Get( &p_sys->pts );
     }
 
     if( p_block->i_buffer < p_sys->size )
@@ -193,6 +196,9 @@ static block_t *DecodeBlock( decoder_t *p_dec, block_t *p_block )
         return NULL;
     }
 
+    /* Date management: 1 frame per packet */
+    date_Increment( &p_sys->pts, 1 );
+
     return p_block;
 }
 
@@ -238,8 +244,6 @@ static int DecodeFrame( decoder_t *p_dec, block_t *p_block )
     if( p_block == NULL )
         return VLCDEC_SUCCESS;
 
-    decoder_sys_t *p_sys = p_dec->p_sys;
-
     /* Get a new picture */
     picture_t *p_pic = NULL;
     if( !decoder_UpdateVideoFormat( p_dec ) )
@@ -251,10 +255,7 @@ static int DecodeFrame( decoder_t *p_dec, block_t *p_block )
     }
 
     FillPicture( p_dec, p_block, p_pic );
-
-    /* Date management: 1 frame per packet */
-    p_pic->date = date_Get( &p_sys->pts );
-    date_Increment( &p_sys->pts, 1 );
+    p_pic->date = p_block->i_pts;
 
     if( p_block->i_flags & BLOCK_FLAG_INTERLACED_MASK )
     {
@@ -300,14 +301,8 @@ static block_t *SendFrame( decoder_t *p_dec, block_t **pp_block )
     *pp_block = NULL;
 
     p_block = DecodeBlock( p_dec, p_block );
-    if( p_block == NULL )
-        return NULL;
-
-    decoder_sys_t *p_sys = p_dec->p_sys;
-
-    /* Date management: 1 frame per packet */
-    p_block->i_dts = p_block->i_pts = date_Get( &p_sys->pts );
-    date_Increment( &p_sys->pts, 1 );
+    if( p_block != NULL )
+        p_block->i_dts = p_block->i_pts;
     return p_block;
 }
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/1171147b0ba16836364b4805a60a63e7b6d45e73

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/1171147b0ba16836364b4805a60a63e7b6d45e73
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list