Truly independent web browser
LibMedia: Fail softly if FFmpegAudioDecoder cannot set a channel layout
Zaggy1024f4144c260dce
diff --git a/Libraries/LibMedia/FFmpeg/FFmpegAudioDecoder.cpp b/Libraries/LibMedia/FFmpeg/FFmpegAudioDecoder.cppindex e6a1a2a8678..5bc28ea827a 100644--- a/Libraries/LibMedia/FFmpeg/FFmpegAudioDecoder.cpp+++ b/Libraries/LibMedia/FFmpeg/FFmpegAudioDecoder.cpp@@ -87,7 +87,8 @@ DecoderErrorOr<NonnullOwnPtr<FFmpegAudioDecoder>> FFmpegAudioDecoder::try_createreturn DecoderError::format(DecoderErrorCategory::Invalid, channel_layout_result.error().string_literal());auto channel_layout = channel_layout_result.release_value();auto set_result = functions.av_opt_set_chlayout(codec_context, "ch_layout", &channel_layout.layout(), 0);- VERIFY(set_result == 0);+ if (set_result != 0)+ return DecoderError::with_description(DecoderErrorCategory::Memory, "Failed to set the channel layout"sv);}if (functions.avcodec_open2(codec_context, codec, nullptr) < 0)