diff mbox

[FFmpeg-devel] avcodec/mediacodec_wrapper: blacklist more software decoders

Message ID DB3PR0202MB34525FC23671ABE42BE0C1A7ECD90@DB3PR0202MB3452.eurprd02.prod.outlook.com
State New
Headers show

Commit Message

sfan5 March 6, 2018, 6 p.m. UTC
Hi,

for hwdec on Android the wrapper attempts to blacklist known software decoders also provided through the mediacodec API. The list isn't complete however and ffmpeg might e.g. prefer slower "external" HEVC software decoding over its own software decoder.

This patch completes the list of known software decoders, which are:

OMX.ffmpeg.*

 see https://github.com/AOSB/android_device_lge_hammerhead/blob/master/media_codecs.xml#L89

OMX.SEC.*

 see https://chromium.googlesource.com/chromium/src/+/refs/heads/lkgr/media/base/android/media_codec_util.cc#288

OMX.qcom.video.decoder.hevcswvdec

 see https://github.com/moonlight-stream/moonlight-android/blob/master/app/src/main/java/com/limelight/binding/video/MediaCodecHelper.java#L83

Comments

Aman Karmani March 6, 2018, 9:31 p.m. UTC | #1
On Tue, Mar 6, 2018 at 10:00 AM, Stefan _ <sfan5@live.de> wrote:

> Hi,
>
> for hwdec on Android the wrapper attempts to blacklist known software
> decoders also provided through the mediacodec API. The list isn't complete
> however and ffmpeg might e.g. prefer slower "external" HEVC software
> decoding over its own software decoder.
>
> This patch completes the list of known software decoders, which are:
>
> OMX.ffmpeg.*
>
> see https://github.com/AOSB/android_device_lge_hammerhead/
> blob/master/media_codecs.xml#L89
>
> OMX.SEC.*
>
> see https://chromium.googlesource.com/chromium/src/+/refs/heads/
> lkgr/media/base/android/media_codec_util.cc#288
>
> OMX.qcom.video.decoder.hevcswvdec
>
> see https://github.com/moonlight-stream/moonlight-android/blob/
> master/app/src/main/java/com/limelight/binding/video/
> MediaCodecHelper.java#L83


Patch LGTM

Aman


>
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
>
Matthieu Bouron March 6, 2018, 9:39 p.m. UTC | #2
On Tue, Mar 06, 2018 at 06:00:27PM +0000, Stefan _ wrote:
> Hi,
> 
> for hwdec on Android the wrapper attempts to blacklist known software decoders also provided through the mediacodec API. The list isn't complete however and ffmpeg might e.g. prefer slower "external" HEVC software decoding over its own software decoder.
> 
> This patch completes the list of known software decoders, which are:
> 
> OMX.ffmpeg.*
> 
>  see https://github.com/AOSB/android_device_lge_hammerhead/blob/master/media_codecs.xml#L89
> 
> OMX.SEC.*
> 
>  see https://chromium.googlesource.com/chromium/src/+/refs/heads/lkgr/media/base/android/media_codec_util.cc#288
> 
> OMX.qcom.video.decoder.hevcswvdec
> 
>  see https://github.com/moonlight-stream/moonlight-android/blob/master/app/src/main/java/com/limelight/binding/video/MediaCodecHelper.java#L83

> From fbc876a8763db254d4e26d00c8b4fcf9ea7e7183 Mon Sep 17 00:00:00 2001
> From: sfan5 <sfan5@live.de>
> Date: Tue, 6 Mar 2018 18:47:35 +0100
> Subject: [PATCH] avcodec/mediacodec_wrapper: blacklist more software decoders
> 
> Additionally blacklist ffmpeg, Samsung and Qualcomm
> software implementations offered through MediaCodec.
> ---
>  libavcodec/mediacodec_wrapper.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/mediacodec_wrapper.c b/libavcodec/mediacodec_wrapper.c
> index dbc37bf463..b12528500d 100644
> --- a/libavcodec/mediacodec_wrapper.c
> +++ b/libavcodec/mediacodec_wrapper.c
> @@ -465,7 +465,12 @@ char *ff_AMediaCodecList_getCodecNameByType(const char *mime, int profile, int e
>                      goto done;
>                  }
>  
> -                if (strstr(name, "OMX.google")) {
> +                /* Skip software decoders */
> +                if (
> +                    strstr(name, "OMX.google") ||
> +                    strstr(name, "OMX.ffmpeg") ||
> +                    strstr(name, "OMX.SEC") ||
> +                    !strcmp(name, "OMX.qcom.video.decoder.hevcswvdec")) {
>                      av_freep(&name);
>                      goto done_with_type;
>                  }
> -- 
> 2.16.2
> 

LGTM.
diff mbox

Patch

From fbc876a8763db254d4e26d00c8b4fcf9ea7e7183 Mon Sep 17 00:00:00 2001
From: sfan5 <sfan5@live.de>
Date: Tue, 6 Mar 2018 18:47:35 +0100
Subject: [PATCH] avcodec/mediacodec_wrapper: blacklist more software decoders

Additionally blacklist ffmpeg, Samsung and Qualcomm
software implementations offered through MediaCodec.
---
 libavcodec/mediacodec_wrapper.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavcodec/mediacodec_wrapper.c b/libavcodec/mediacodec_wrapper.c
index dbc37bf463..b12528500d 100644
--- a/libavcodec/mediacodec_wrapper.c
+++ b/libavcodec/mediacodec_wrapper.c
@@ -465,7 +465,12 @@  char *ff_AMediaCodecList_getCodecNameByType(const char *mime, int profile, int e
                     goto done;
                 }
 
-                if (strstr(name, "OMX.google")) {
+                /* Skip software decoders */
+                if (
+                    strstr(name, "OMX.google") ||
+                    strstr(name, "OMX.ffmpeg") ||
+                    strstr(name, "OMX.SEC") ||
+                    !strcmp(name, "OMX.qcom.video.decoder.hevcswvdec")) {
                     av_freep(&name);
                     goto done_with_type;
                 }
-- 
2.16.2