[vlc-commits] demux: h26x: use fmtout rate as date rate

Francois Cartegnie git at videolan.org
Fri Oct 11 17:28:39 CEST 2019


vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sat Sep  7 18:25:29 2019 +0200| [9a372dba12c924c8828cf7108fdb679c43d6e299] | committer: Francois Cartegnie

demux: h26x: use fmtout rate as date rate

(cherry picked from commit fe88719c808cda0e91fd4d3da5c67218cb3e73f5)

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=9a372dba12c924c8828cf7108fdb679c43d6e299
---

 modules/demux/mpeg/h26x.c | 28 ++++++++++------------------
 1 file changed, 10 insertions(+), 18 deletions(-)

diff --git a/modules/demux/mpeg/h26x.c b/modules/demux/mpeg/h26x.c
index eda3e52920..a43b27aef9 100644
--- a/modules/demux/mpeg/h26x.c
+++ b/modules/demux/mpeg/h26x.c
@@ -346,17 +346,17 @@ static int GenericOpen( demux_t *p_demux, const char *psz_module,
         if ( f_fps < 0.001f ) f_fps = 0.001f;
         p_sys->frame_rate_den = 1000;
         p_sys->frame_rate_num = 1000 * f_fps;
-        date_Init( &p_sys->dts, p_sys->frame_rate_num, p_sys->frame_rate_den );
+        date_Init( &p_sys->dts, 2 * p_sys->frame_rate_num, p_sys->frame_rate_den );
     }
     else
-        date_Init( &p_sys->dts, 25000, 1000 );
+        date_Init( &p_sys->dts, 2 * 30000, 1000 );
     date_Set( &p_sys->dts, VLC_TS_0 );
 
     /* Load the mpegvideo packetizer */
     es_format_Init( &fmt, VIDEO_ES, i_codec );
     if( f_fps )
     {
-        fmt.video.i_frame_rate = p_sys->dts.i_divider_num;
+        fmt.video.i_frame_rate = p_sys->dts.i_divider_num >> 1;
         fmt.video.i_frame_rate_base = p_sys->dts.i_divider_den;
     }
     p_sys->p_packetizer = demux_PacketizerNew( p_demux, &fmt, psz_module );
@@ -458,22 +458,14 @@ static int Demux( demux_t *p_demux)
             es_out_Send( p_demux->out, p_sys->p_es, p_block_out );
             if( frame )
             {
-                if( !p_sys->frame_rate_den )
+                if( p_sys->p_packetizer->fmt_out.video.i_frame_rate_base &&
+                    p_sys->p_packetizer->fmt_out.video.i_frame_rate_base != p_sys->frame_rate_den &&
+                    p_sys->p_packetizer->fmt_out.video.i_frame_rate &&
+                    p_sys->p_packetizer->fmt_out.video.i_frame_rate_base != p_sys->frame_rate_num )
                 {
-                    /* Use packetizer's one */
-                    if( p_sys->p_packetizer->fmt_out.video.i_frame_rate_base &&
-                        p_sys->p_packetizer->fmt_out.video.i_frame_rate )
-                    {
-                        p_sys->frame_rate_num = p_sys->p_packetizer->fmt_out.video.i_frame_rate;
-                        p_sys->frame_rate_den = p_sys->p_packetizer->fmt_out.video.i_frame_rate_base;
-                    }
-                    else
-                    {
-                        p_sys->frame_rate_num = 25000;
-                        p_sys->frame_rate_den = 1000;
-                    }
-                    date_Init( &p_sys->dts, 2 * p_sys->frame_rate_num, p_sys->frame_rate_den );
-                    date_Set( &p_sys->dts, VLC_TS_0 );
+                    p_sys->frame_rate_num = p_sys->p_packetizer->fmt_out.video.i_frame_rate;
+                    p_sys->frame_rate_den = p_sys->p_packetizer->fmt_out.video.i_frame_rate_base;
+                    date_Change( &p_sys->dts, 2 * p_sys->frame_rate_num, p_sys->frame_rate_den );
                     msg_Dbg( p_demux, "using %.2f fps", (double) p_sys->frame_rate_num / p_sys->frame_rate_den );
                 }
 



More information about the vlc-commits mailing list