[vlc-commits] demux: wav: don't increment pts past data chunk bundary

Thomas Guillem git at videolan.org
Mon Mar 16 13:31:37 CET 2020


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Mar 12 14:41:22 2020 +0100| [6cdbd26806692306ce60a974f7714581e07a7e20] | committer: Thomas Guillem

demux: wav: don't increment pts past data chunk bundary

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

 modules/demux/wav.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/modules/demux/wav.c b/modules/demux/wav.c
index ddd3a04a2a..f91a3c3abc 100644
--- a/modules/demux/wav.c
+++ b/modules/demux/wav.c
@@ -91,6 +91,8 @@ static int Demux( demux_t *p_demux )
     block_t     *p_block;
     const int64_t i_pos = vlc_stream_Tell( p_demux->s );
     unsigned int i_read_size = p_sys->i_frame_size;
+    uint32_t i_read_samples = p_sys->i_frame_samples;
+
 
     if( p_sys->i_data_size > 0 )
     {
@@ -100,7 +102,11 @@ static int Demux( demux_t *p_demux )
 
         /* Don't read past data chunk boundary */
         if ( i_end < i_pos + i_read_size )
+        {
             i_read_size = i_end - i_pos;
+            i_read_samples = ( p_sys->i_frame_size - i_read_size )
+                           * p_sys->i_frame_samples / p_sys->i_frame_size;
+        }
     }
 
     if( ( p_block = vlc_stream_Block( p_demux->s, i_read_size ) ) == NULL )
@@ -123,7 +129,7 @@ static int Demux( demux_t *p_demux )
 
     es_out_Send( p_demux->out, p_sys->p_es, p_block );
 
-    date_Increment( &p_sys->pts, p_sys->i_frame_samples );
+    date_Increment( &p_sys->pts, i_read_samples );
 
     return VLC_DEMUXER_SUCCESS;
 }



More information about the vlc-commits mailing list