[vlc-commits] packetizer: h264: set duration also using frame rate

Francois Cartegnie git at videolan.org
Wed Mar 22 12:17:31 CET 2017


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Mar 22 11:39:31 2017 +0100| [98e83f7796b56960ad916f6ab76b5b4dd591ce90] | committer: Francois Cartegnie

packetizer: h264: set duration also using frame rate

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

 modules/packetizer/h264.c | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/modules/packetizer/h264.c b/modules/packetizer/h264.c
index 043e3ce..b0496c5 100644
--- a/modules/packetizer/h264.c
+++ b/modules/packetizer/h264.c
@@ -764,12 +764,6 @@ static block_t *OutputPicture( decoder_t *p_dec )
         }
     }
 
-    if( p_sps->vui.i_time_scale && p_pic->i_length == 0 )
-    {
-        p_pic->i_length = CLOCK_FREQ * i_num_clock_ts *
-                          p_sps->vui.i_num_units_in_tick / p_sps->vui.i_time_scale;
-    }
-
     if( p_sps->frame_mbs_only_flag == 0 && p_sps->vui.b_pic_struct_present_flag )
     {
         switch( p_sys->i_pic_struct )
@@ -849,6 +843,21 @@ static block_t *OutputPicture( decoder_t *p_dec )
         p_sys->prevdatedpoc.num = PictureOrderCount;
     }
 
+    if( p_pic->i_length == 0 )
+    {
+        if( p_sps->vui.i_time_scale )
+        {
+            p_pic->i_length = CLOCK_FREQ * i_num_clock_ts *
+                              p_sps->vui.i_num_units_in_tick / p_sps->vui.i_time_scale;
+        }
+        else
+        {
+            date_t next = p_sys->dts;
+            date_Increment( &next, i_num_clock_ts );
+            p_pic->i_length = date_Get( &next ) - date_Get( &p_sys->dts );
+        }
+    }
+
 #if 0
     msg_Err(p_dec, "F/BOC %d/%d POC %d %s ref%d fn %d fp %d %d pts %ld",
                     tFOC, bFOC, PictureOrderCount,



More information about the vlc-commits mailing list