Avoid segfault in android decoder if the codec is not supported

This commit is contained in:
Guillaume Meunier committed 2024-10-21 23:01:53 +02:00
1 parent ab126dd9b7
commit 08d19bd94d
1 file changed
+3
@@ -118,6 +118,9 @@ decoder::decoder(
media_codec.reset(AMediaCodec_createDecoderByType(mime(description.codec)));
if (not media_codec)
throw std::runtime_error(std::string("Cannot create decoder for MIME type ") + mime(description.codec));
char * codec_name;
check(AMediaCodec_getName(media_codec.get(), &codec_name), "AMediaCodec_getName");
spdlog::info("Created MediaCodec decoder \"{}\"", codec_name);