[vlc-devel] [PATCH] MKV: fix COOK/ATRAC3 seeking

Steve Lhomme robUx4 at videolabs.io
Thu Mar 19 11:11:51 CET 2015


Fixes #14210
---
 modules/demux/mkv/mkv.cpp  |  2 +-
 modules/demux/mkv/util.cpp | 10 +++++++++-
 modules/demux/mkv/util.hpp |  3 ++-
 3 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/modules/demux/mkv/mkv.cpp b/modules/demux/mkv/mkv.cpp
index 48496e2..5a4f76a 100644
--- a/modules/demux/mkv/mkv.cpp
+++ b/modules/demux/mkv/mkv.cpp
@@ -600,7 +600,7 @@ void BlockDecode( demux_t *p_demux, KaxBlock *block, KaxSimpleBlock *simpleblock
         case VLC_CODEC_COOK:
         case VLC_CODEC_ATRAC3:
         {
-            handle_real_audio(p_demux, tk, p_block, i_pts);
+            handle_real_audio(p_demux, tk, p_block, i_pts, b_key_picture);
             block_Release(p_block);
             i_pts = ( tk->i_default_duration )?
                 i_pts + ( mtime_t )tk->i_default_duration:
diff --git a/modules/demux/mkv/util.cpp b/modules/demux/mkv/util.cpp
index 8f84d94..58d77bd 100644
--- a/modules/demux/mkv/util.cpp
+++ b/modules/demux/mkv/util.cpp
@@ -168,7 +168,8 @@ block_t *MemToBlock( uint8_t *p_mem, size_t i_mem, size_t offset)
 }
 
 
-void handle_real_audio(demux_t * p_demux, mkv_track_t * p_tk, block_t * p_blk, mtime_t i_pts)
+void handle_real_audio(demux_t * p_demux, mkv_track_t * p_tk, block_t * p_blk,
+                       mtime_t i_pts, bool b_key_picture)
 {
     uint8_t * p_frame = p_blk->p_buffer;
     Cook_PrivateTrackData * p_sys = (Cook_PrivateTrackData *) p_tk->p_sys;
@@ -183,6 +184,13 @@ void handle_real_audio(demux_t * p_demux, mkv_track_t * p_tk, block_t * p_blk, m
                 p_sys->p_subpackets[i] = NULL;
             }
         p_sys->i_subpacket = 0;
+
+        if ( !b_key_picture )
+        {
+            msg_Dbg( p_demux, "discard non-key preroll block in track %d at%"PRId64,
+                     p_tk->i_number, i_pts );
+            return;
+        }
     }
 
     if( p_tk->fmt.i_codec == VLC_CODEC_COOK ||
diff --git a/modules/demux/mkv/util.hpp b/modules/demux/mkv/util.hpp
index c181ad2..6b8285e 100644
--- a/modules/demux/mkv/util.hpp
+++ b/modules/demux/mkv/util.hpp
@@ -31,7 +31,8 @@ block_t *block_zlib_decompress( vlc_object_t *p_this, block_t *p_in_block );
 #endif
 
 block_t *MemToBlock( uint8_t *p_mem, size_t i_mem, size_t offset);
-void handle_real_audio(demux_t * p_demux, mkv_track_t * p_tk, block_t * p_blk, mtime_t i_pts);
+void handle_real_audio(demux_t * p_demux, mkv_track_t * p_tk, block_t * p_blk,
+                       mtime_t i_pts, bool b_key_picture);
 
 
 struct real_audio_private
-- 
2.3.2




More information about the vlc-devel mailing list