[vlc-commits] demux:mkv: do not write audio/video elements in a mismatched track

Steve Lhomme git at videolan.org
Sat Jul 8 18:39:21 CEST 2017


vlc | branch: master | Steve Lhomme <robux4 at videolabs.io> | Thu Jul  6 14:32:33 2017 +0200| [2b575fd20bacbb83d74ae88d04e92b62ea4dad85] | committer: Jean-Baptiste Kempf

demux:mkv: do not write audio/video elements in a mismatched track

It will overwrite values in the es_format_t union incorrectly.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/demux/mkv/matroska_segment_parse.cpp | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/modules/demux/mkv/matroska_segment_parse.cpp b/modules/demux/mkv/matroska_segment_parse.cpp
index 48093cc86d..6a232df1d7 100644
--- a/modules/demux/mkv/matroska_segment_parse.cpp
+++ b/modules/demux/mkv/matroska_segment_parse.cpp
@@ -514,6 +514,9 @@ void matroska_segment_c::ParseTrackEntry( const KaxTrackEntry *m )
 
             mkv_track_t *tk = vars.tk;
 
+            if (tk->fmt.i_cat != VIDEO_ES ) {
+                msg_Err( vars.p_demuxer, "Video elements not allowed for this track" );
+            } else {
             tk->f_fps = 0.0;
 
             if( tk->i_default_duration > 1000 ) /* Broken ffmpeg mux info when non set fps */
@@ -553,6 +556,7 @@ void matroska_segment_c::ParseTrackEntry( const KaxTrackEntry *m )
             }
             /* FIXME: i_display_* allows you to not only set DAR, but also a zoom factor.
                we do not support this atm */
+            }
         }
 #if LIBMATROSKA_VERSION >= 0x010406
         E_CASE( KaxVideoProjection, proj )
@@ -672,10 +676,13 @@ void matroska_segment_c::ParseTrackEntry( const KaxTrackEntry *m )
         }
         E_CASE( KaxTrackAudio, tka ) {
             debug( vars, "Track Audio");
-
+            if (vars.tk->fmt.i_cat != AUDIO_ES ) {
+                msg_Err( vars.p_demuxer, "Audio elements not allowed for this track" );
+            } else {
             vars.level += 1;
             dispatcher.iterate( tka.begin(), tka.end(), Payload( vars ));
             vars.level -= 1;
+            }
         }
         E_CASE( KaxAudioSamplingFreq, afreq )
         {



More information about the vlc-commits mailing list