[vlc-commits] demux: avi: fix unread audio chunks

Francois Cartegnie git at videolan.org
Wed Jul 25 18:05:25 CEST 2018


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Jul 25 17:11:05 2018 +0200| [50bd23227231f08f30fa272bfb12746accf55ac9] | committer: Francois Cartegnie

demux: avi: fix unread audio chunks

need to rewrite all that legacy 0.9.x crap...
if only we could fully understand and avoid further regressions

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

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

diff --git a/modules/demux/avi/avi.c b/modules/demux/avi/avi.c
index d1fdba81b2..48f2674f2a 100644
--- a/modules/demux/avi/avi.c
+++ b/modules/demux/avi/avi.c
@@ -1091,7 +1091,14 @@ static int Demux_Seekable( demux_t *p_demux )
         }
         else if ( i_dpts > VLC_TICK_FROM_SEC(-2) ) /* don't send a too early dts (low fps video) */
         {
-            toread[i_track].i_toread = AVI_PTSToChunk( tk, i_dpts );
+            int64_t i_chunks_count = AVI_PTSToChunk( tk, i_dpts );
+            if( i_dpts > 0 && AVI_GetDPTS( tk, i_chunks_count ) < i_dpts )
+            {
+                /* AVI code is crap. toread is either bytes, or here, chunk count.
+                 * That does not even work when reading amount < scale / rate */
+                i_chunks_count++;
+            }
+            toread[i_track].i_toread = i_chunks_count;
         }
         else
             toread[i_track].i_toread = -1;



More information about the vlc-commits mailing list