[vlc-commits] demux: avi: fix slow seek access regression

Francois Cartegnie git at videolan.org
Thu Dec 7 23:26:06 CET 2017


vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Dec  7 14:13:02 2017 +0100| [3a72bf7141136267c89c0d8db9e0bd213ae2a031] | committer: Jean-Baptiste Kempf

demux: avi: fix slow seek access regression

(cherry picked from commit 5cad69c88718a85437e2f78846caae6bede8215d)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/demux/avi/avi.c | 29 ++++++++++++++++++++++++-----
 1 file changed, 24 insertions(+), 5 deletions(-)

diff --git a/modules/demux/avi/avi.c b/modules/demux/avi/avi.c
index 9708cf8d3d..caa59f37af 100644
--- a/modules/demux/avi/avi.c
+++ b/modules/demux/avi/avi.c
@@ -332,9 +332,6 @@ static int Open( vlc_object_t * p_this )
                         &p_sys->b_fastseekable );
     vlc_stream_Control( p_demux->s, STREAM_CAN_SEEK, &p_sys->b_seekable );
 
-    p_demux->pf_control = Control;
-    p_demux->pf_demux = (p_sys->b_seekable) ? Demux_Seekable : Demux_UnSeekable;
-
     p_sys->b_interleaved = var_InheritBool( p_demux, "avi-interleaved" );
 
     if( AVI_ChunkReadRoot( p_demux->s, &p_sys->ck_root ) )
@@ -404,11 +401,33 @@ static int Open( vlc_object_t * p_this )
 
     p_sys->b_interleaved |= (p_avih->i_flags & AVIF_ISINTERLEAVED);
 
-    if( p_sys->b_interleaved && !p_sys->b_fastseekable )
+    /* Set callbacks */
+    p_demux->pf_control = Control;
+
+    if( p_sys->b_fastseekable )
+    {
+        p_demux->pf_demux = Demux_Seekable;
         p_sys->i_read_increment = READ_LENGTH;
+    }
+    else if( p_sys->b_seekable && !p_sys->b_interleaved )
+    {
+        p_demux->pf_demux = Demux_Seekable;
+        p_sys->i_read_increment = READ_LENGTH_NONINTERLEAVED;
+        msg_Warn( p_demux, "Non seekable non interleaved content over slow seekable, "
+                           "expect bad performance" );
+    }
     else
+    {
+        p_demux->pf_demux = Demux_UnSeekable;
         p_sys->i_read_increment = READ_LENGTH_NONINTERLEAVED;
-    /* non seekable and non interleaved case ? well... */
+         /* non seekable and non interleaved case ? well... */
+        if( !p_sys->b_interleaved )
+        {
+            msg_Warn( p_demux, "Non seekable non interleaved content, "
+                               "disabling other tracks" );
+            i_track = __MIN(i_track, 1);
+        }
+    }
 
     AVI_MetaLoad( p_demux, p_riff, p_avih );
     p_sys->i_avih_flags = p_avih->i_flags;



More information about the vlc-commits mailing list