From ed2c54cea99fc5b3a28c2df9370db3aa88b256cc Mon Sep 17 00:00:00 2001 From: wm4 Date: Thu, 8 Nov 2012 00:30:30 +0100 Subject: [PATCH] demux_mkv: don't crash on tracks with unknown audio codecs Demuxers can't remove streams anymore after adding them, so the free_sh_audio() call caused a crash. --- libmpdemux/demux_mkv.c | 1 - libmpdemux/demuxer.c | 4 ++-- libmpdemux/stheader.h | 2 -- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/libmpdemux/demux_mkv.c b/libmpdemux/demux_mkv.c index c93d67180e..b12f1eb061 100644 --- a/libmpdemux/demux_mkv.c +++ b/libmpdemux/demux_mkv.c @@ -1542,7 +1542,6 @@ static int demux_mkv_open_audio(demuxer_t *demuxer, mkv_track_t *track, mp_tmsg(MSGT_DEMUX, MSGL_WARN, "[mkv] Unknown/unsupported audio " "codec ID '%s' for track %u or missing/faulty\n[mkv] " "private codec data.\n", track->codec_id, track->tnum); - free_sh_audio(demuxer, track->id); return 1; } diff --git a/libmpdemux/demuxer.c b/libmpdemux/demuxer.c index b827a64018..1119e61013 100644 --- a/libmpdemux/demuxer.c +++ b/libmpdemux/demuxer.c @@ -400,7 +400,7 @@ sh_audio_t *new_sh_audio_aid(demuxer_t *demuxer, int id, int aid) return demuxer->a_streams[id]; } -void free_sh_audio(demuxer_t *demuxer, int id) +static void free_sh_audio(demuxer_t *demuxer, int id) { sh_audio_t *sh = demuxer->a_streams[id]; demuxer->a_streams[id] = NULL; @@ -429,7 +429,7 @@ sh_video_t *new_sh_video_vid(demuxer_t *demuxer, int id, int vid) return demuxer->v_streams[id]; } -void free_sh_video(sh_video_t *sh) +static void free_sh_video(sh_video_t *sh) { mp_msg(MSGT_DEMUXER, MSGL_DBG2, "DEMUXER: freeing sh_video at %p\n", sh); free(sh->bih); diff --git a/libmpdemux/stheader.h b/libmpdemux/stheader.h index 2d214966d2..b5f11c0ecc 100644 --- a/libmpdemux/stheader.h +++ b/libmpdemux/stheader.h @@ -184,8 +184,6 @@ struct sh_video *new_sh_video_vid(struct demuxer *demuxer, int id, int vid); struct sh_sub *new_sh_sub_sid(struct demuxer *demuxer, int id, int sid); struct sh_sub *new_sh_sub_sid_lang(struct demuxer *demuxer, int id, int sid, const char *lang); -void free_sh_audio(struct demuxer *demuxer, int id); -void free_sh_video(struct sh_video *sh); const char *sh_sub_type2str(int type);