PR #23829 opened by sfan5
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23829
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23829.patch


>From 1bc9e7ab090f2a52a32cc7c9f7eb8804a84f0a1c Mon Sep 17 00:00:00 2001
From: sfan5 <[email protected]>
Date: Thu, 16 Jul 2026 12:35:36 +0200
Subject: [PATCH 1/2] libavcodec/mediacodecdec_common: improve logging for
 failing to get codec

The logging should obviously happen before returning an error.
Also include the mime type and detected profile.

Signed-off-by: sfan5 <[email protected]>
---
 libavcodec/mediacodecdec_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/mediacodecdec_common.c 
b/libavcodec/mediacodecdec_common.c
index 9a627c06de..7d86094d05 100644
--- a/libavcodec/mediacodecdec_common.c
+++ b/libavcodec/mediacodecdec_common.c
@@ -779,12 +779,12 @@ static int mediacodec_dec_get_video_codec(AVCodecContext 
*avctx, MediaCodecDecCo
 
     s->codec_name = ff_AMediaCodecList_getCodecNameByType(mime, profile, 0, 
avctx);
     if (!s->codec_name) {
+        av_log(avctx, AV_LOG_INFO, "Failed to getCodecNameByType(%s, %d)\n", 
mime, profile);
         // getCodecNameByType() can fail due to missing JVM, while NDK
         // mediacodec can be used without JVM.
         if (!s->use_ndk_codec) {
             return AVERROR_EXTERNAL;
         }
-        av_log(avctx, AV_LOG_INFO, "Failed to getCodecNameByType\n");
     } else {
         av_log(avctx, AV_LOG_DEBUG, "Found decoder %s\n", s->codec_name);
     }
-- 
2.52.0


>From 08c44f8a9624f835949098043535993ad86fab50 Mon Sep 17 00:00:00 2001
From: sfan5 <[email protected]>
Date: Thu, 16 Jul 2026 12:37:22 +0200
Subject: [PATCH 2/2] libavcodec/mediacodecdec_common: support
 AV_HWACCEL_FLAG_ALLOW_PROFILE_MISMATCH

Signed-off-by: sfan5 <[email protected]>
---
 libavcodec/mediacodecdec_common.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/mediacodecdec_common.c 
b/libavcodec/mediacodecdec_common.c
index 7d86094d05..0cb9c092d7 100644
--- a/libavcodec/mediacodecdec_common.c
+++ b/libavcodec/mediacodecdec_common.c
@@ -778,6 +778,10 @@ static int mediacodec_dec_get_video_codec(AVCodecContext 
*avctx, MediaCodecDecCo
     }
 
     s->codec_name = ff_AMediaCodecList_getCodecNameByType(mime, profile, 0, 
avctx);
+    if (!s->codec_name && (avctx->hwaccel_flags & 
AV_HWACCEL_FLAG_ALLOW_PROFILE_MISMATCH)) {
+        profile = -1;
+        s->codec_name = ff_AMediaCodecList_getCodecNameByType(mime, profile, 
0, avctx);
+    }
     if (!s->codec_name) {
         av_log(avctx, AV_LOG_INFO, "Failed to getCodecNameByType(%s, %d)\n", 
mime, profile);
         // getCodecNameByType() can fail due to missing JVM, while NDK
-- 
2.52.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to