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

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


vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Jul 25 17:11:05 2018 +0200| [442d49cac5eae13df0685b5db8bee54d717012fb] | 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

(cherry picked from commit 50bd23227231f08f30fa272bfb12746accf55ac9)

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

 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 c48d392e6b..6f74445c94 100644
--- a/modules/demux/avi/avi.c
+++ b/modules/demux/avi/avi.c
@@ -1107,7 +1107,14 @@ static int Demux_Seekable( demux_t *p_demux )
         }
         else if ( i_dpts > -2 * CLOCK_FREQ ) /* 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