[vlc-commits] mux: avformat: don't hide internal warning

Francois Cartegnie git at videolan.org
Wed Dec 9 12:06:46 UTC 2020


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Dec  8 11:30:01 2020 +0100| [2009387b5328c53644110ea4f4042cb9171fe955] | committer: Francois Cartegnie

mux: avformat: don't hide internal warning

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

 modules/demux/avformat/mux.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/modules/demux/avformat/mux.c b/modules/demux/avformat/mux.c
index ae5639e6de..3ecfa191f5 100644
--- a/modules/demux/avformat/mux.c
+++ b/modules/demux/avformat/mux.c
@@ -408,8 +408,12 @@ static int MuxBlock( sout_mux_t *p_mux, sout_input_t *p_input )
                                 VLC_TIME_BASE_Q, p_stream->time_base );
 
     /* this is another hack to prevent libavformat from triggering the "non monotone timestamps" check in avformat/utils.c */
-    p_stream->cur_dts = ( p_data->i_dts * p_stream->time_base.den /
-            CLOCK_FREQ / p_stream->time_base.num ) - 1;
+    if( p_stream->cur_dts >= pkt.dts )
+    {
+        msg_Warn( p_mux, "Non monotonic stream %d(%4.4s) %"PRId64" >= %"PRId64,
+                  p_input->fmt.i_id, (const char *) &p_input->fmt.i_codec, p_stream->cur_dts, pkt.dts );
+        p_stream->cur_dts = pkt.dts - 1;
+    }
 
     if( av_write_frame( p_sys->oc, &pkt ) < 0 )
     {
@@ -420,6 +424,8 @@ static int MuxBlock( sout_mux_t *p_mux, sout_input_t *p_input )
         return VLC_EGENERIC;
     }
 
+    p_stream->cur_dts = pkt.dts;
+
     block_Release( p_data );
     return VLC_SUCCESS;
 }



More information about the vlc-commits mailing list