[vlc-devel] [PATCH 03/10] vlc_codec: make sure we don't update the audio/video format on the wrong kind of track

Steve Lhomme robux4 at videolabs.io
Fri Jul 7 12:56:11 CEST 2017


We would write in the wrong parts of the es_format_t union.
---
 include/vlc_codec.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/vlc_codec.h b/include/vlc_codec.h
index fb7383907b..197486bc34 100644
--- a/include/vlc_codec.h
+++ b/include/vlc_codec.h
@@ -249,7 +249,8 @@ struct encoder_t
  */
 static inline int decoder_UpdateVideoFormat( decoder_t *dec )
 {
-    if( dec->pf_vout_format_update != NULL )
+    assert( dec->fmt_in.i_cat == VIDEO_ES );
+    if( dec->fmt_in.i_cat == VIDEO_ES && dec->pf_vout_format_update != NULL )
         return dec->pf_vout_format_update( dec );
     else
         return -1;
@@ -365,7 +366,8 @@ static inline int decoder_QueueSub( decoder_t *dec, subpicture_t *p_spu )
  * @return 0 if the audio output is working, -1 if not. */
 static inline int decoder_UpdateAudioFormat( decoder_t *dec )
 {
-    if( dec->pf_aout_format_update != NULL )
+    assert(dec->fmt_in.i_cat == AUDIO_ES);
+    if( dec->fmt_in.i_cat == AUDIO_ES && dec->pf_aout_format_update != NULL )
         return dec->pf_aout_format_update( dec );
     else
         return -1;
-- 
2.12.1



More information about the vlc-devel mailing list