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

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


vlc | branch: master | Steve Lhomme <robux4 at videolabs.io> | Thu Jul  6 15:40:51 2017 +0200| [9adad8ff909a45b9a91e40c6eb8214cb555140eb] | committer: Jean-Baptiste Kempf

vlc_codec: make sure we don't update the audio/video format on the wrong kind of track

We would write in the wrong parts of the es_format_t union.

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

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

 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;



More information about the vlc-commits mailing list