[vlc-devel] [PATCH] rawvideo: only init the date once

Steve Lhomme robux4 at videolabs.io
Wed Jul 19 15:29:59 CEST 2017


No need to do it with invalid values and then check it's valid.
---
 modules/codec/rawvideo.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/modules/codec/rawvideo.c b/modules/codec/rawvideo.c
index 3db4c94d0b..9c5853bed6 100644
--- a/modules/codec/rawvideo.c
+++ b/modules/codec/rawvideo.c
@@ -103,8 +103,6 @@ static int OpenCommon( decoder_t *p_dec, bool b_packetizer )
     if ( !b_packetizer )
         es_format_Copy( &p_dec->fmt_out, &p_dec->fmt_in );
 
-    date_Init( &p_sys->pts, p_dec->fmt_out.video.i_frame_rate,
-               p_dec->fmt_out.video.i_frame_rate_base );
     if( p_dec->fmt_out.video.i_frame_rate == 0 ||
         p_dec->fmt_out.video.i_frame_rate_base == 0)
     {
@@ -113,6 +111,9 @@ static int OpenCommon( decoder_t *p_dec, bool b_packetizer )
                   p_dec->fmt_out.video.i_frame_rate_base);
         date_Init( &p_sys->pts, 25, 1 );
     }
+    else
+        date_Init( &p_sys->pts, p_dec->fmt_out.video.i_frame_rate,
+                    p_dec->fmt_out.video.i_frame_rate_base );
 
     for( unsigned i = 0; i < dsc->plane_count; i++ )
     {
-- 
2.12.1



More information about the vlc-devel mailing list