From aaf473dab2b45bfbf2eb73128198d00db57c1c85 Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Mon, 1 Jun 2020 09:54:42 +0200 Subject: [PATCH] File: really respect :opportunistic_audio Before this fix, using :opportunistic_audio while there was no audio track in the media file resulted in crash. --- src/video_capture/file.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/video_capture/file.c b/src/video_capture/file.c index 909dfd68b..30035c415 100644 --- a/src/video_capture/file.c +++ b/src/video_capture/file.c @@ -455,7 +455,8 @@ static int vidcap_file_init(struct vidcap_params *params, void **state) { log_msg(LOG_LEVEL_ERROR, MOD_NAME "Could not find audio stream!\n"); vidcap_file_common_cleanup(s); return VIDCAP_INIT_FAIL; - } else { + } + if (s->audio_stream_idx >= 0) { s->aud_ctx = vidcap_file_open_dec_ctx(dec, s->fmt_ctx->streams[s->audio_stream_idx]);