[vlc-commits] Revert "mediacodec: fail in case of unsupported resolution"

Thomas Guillem git at videolan.org
Mon Jul 18 18:10:35 CEST 2016


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Mon Jul 18 18:08:29 2016 +0200| [bdd77f830735032b4bc1289d5920db6a26a2841a] | committer: Thomas Guillem

Revert "mediacodec: fail in case of unsupported resolution"

People start to complain that they can't play "unsupported resolution" anymore.
I guess that the upper limit is too low on most devices.

This reverts commit 3e21d7ceb8833ef2a8670ce12a569455ff4f1455.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=bdd77f830735032b4bc1289d5920db6a26a2841a
---

 modules/codec/omxil/mediacodec.c     |   13 ++++--------
 modules/codec/omxil/mediacodec.h     |    3 +--
 modules/codec/omxil/mediacodec_jni.c |   38 ++++++----------------------------
 modules/codec/omxil/mediacodec_ndk.c |    9 ++++----
 4 files changed, 15 insertions(+), 48 deletions(-)

diff --git a/modules/codec/omxil/mediacodec.c b/modules/codec/omxil/mediacodec.c
index e02b6cd..56c432b 100644
--- a/modules/codec/omxil/mediacodec.c
+++ b/modules/codec/omxil/mediacodec.c
@@ -522,7 +522,7 @@ static int StartMediaCodec(decoder_t *p_dec)
             {
                 p_sys->u.video.i_h264_profile = i_profile;
                 if (p_sys->api->configure(p_sys->api,
-                                          p_sys->u.video.i_h264_profile, 0, 0) != 0 )
+                                          p_sys->u.video.i_h264_profile) != 0 )
                     return VLC_EGENERIC;
             }
         }
@@ -679,23 +679,18 @@ static int OpenDecoder(vlc_object_t *p_this, pf_MediaCodecApi_init pf_init)
         free(api);
         return VLC_EGENERIC;
     }
-
-    if (api->configure(api, i_h264_profile,
-                       p_dec->fmt_in.video.i_width,
-                       p_dec->fmt_in.video.i_height) != 0)
+    if (api->configure(api, i_h264_profile) != 0)
     {
         /* If the device can't handle video/wvc1,
          * it can probably handle video/x-ms-wmv */
         if (!strcmp(mime, "video/wvc1") && p_dec->fmt_in.i_codec == VLC_CODEC_VC1)
         {
             api->psz_mime = "video/x-ms-wmv";
-            if (api->configure(api, i_h264_profile,
-                               p_dec->fmt_in.video.i_width,
-                               p_dec->fmt_in.video.i_height) != 0)
+            if (api->configure(api, i_h264_profile) != 0)
             {
                 api->clean(api);
                 free(api);
-                return VLC_EGENERIC;
+                return (VLC_EGENERIC);
             }
         }
         else
diff --git a/modules/codec/omxil/mediacodec.h b/modules/codec/omxil/mediacodec.h
index e8607f3..e68b66f 100644
--- a/modules/codec/omxil/mediacodec.h
+++ b/modules/codec/omxil/mediacodec.h
@@ -119,8 +119,7 @@ struct mc_api
     bool b_direct_rendering;
 
     void (*clean)(mc_api *);
-    int (*configure)(mc_api *, size_t i_h264_profile,
-                     unsigned int i_width, unsigned int i_height);
+    int (*configure)(mc_api *, size_t i_h264_profile);
     int (*start)(mc_api *, union mc_api_args *p_args);
     int (*stop)(mc_api *);
     int (*flush)(mc_api *);
diff --git a/modules/codec/omxil/mediacodec_jni.c b/modules/codec/omxil/mediacodec_jni.c
index 3683d54..66fd122 100644
--- a/modules/codec/omxil/mediacodec_jni.c
+++ b/modules/codec/omxil/mediacodec_jni.c
@@ -37,8 +37,8 @@
 
 #include "mediacodec.h"
 
-char* MediaCodec_GetName(vlc_object_t *, const char *, size_t,
-                         unsigned int, unsigned int);
+char* MediaCodec_GetName(vlc_object_t *p_obj, const char *psz_mime,
+                         size_t h264_profile);
 
 #define THREAD_NAME "mediacodec_jni"
 
@@ -59,7 +59,6 @@ struct jfields
     jmethodID tostring;
     jmethodID get_codec_count, get_codec_info_at, is_encoder, get_capabilities_for_type;
     jfieldID profile_levels_field, profile_field, level_field;
-    jmethodID get_video_capabilities, is_size_supported;
     jmethodID get_supported_types, get_name;
     jmethodID create_by_codec_name, configure, start, stop, flush, release;
     jmethodID get_output_format;
@@ -118,10 +117,7 @@ static const struct member members[] = {
     { "profileLevels", "[Landroid/media/MediaCodecInfo$CodecProfileLevel;", "android/media/MediaCodecInfo$CodecCapabilities", OFF(profile_levels_field), FIELD, true },
     { "profile", "I", "android/media/MediaCodecInfo$CodecProfileLevel", OFF(profile_field), FIELD, true },
     { "level", "I", "android/media/MediaCodecInfo$CodecProfileLevel", OFF(level_field), FIELD, true },
-    { "getVideoCapabilities", "()Landroid/media/MediaCodecInfo$VideoCapabilities;",
-      "android/media/MediaCodecInfo$CodecCapabilities", OFF(get_video_capabilities), METHOD, false },
-    { "isSizeSupported", "(II)Z",
-      "android/media/MediaCodecInfo$VideoCapabilities", OFF(is_size_supported), METHOD, false },
+
     { "createByCodecName", "(Ljava/lang/String;)Landroid/media/MediaCodec;", "android/media/MediaCodec", OFF(create_by_codec_name), STATIC_METHOD, true },
     { "configure", "(Landroid/media/MediaFormat;Landroid/view/Surface;Landroid/media/MediaCrypto;I)V", "android/media/MediaCodec", OFF(configure), METHOD, true },
     { "start", "()V", "android/media/MediaCodec", OFF(start), METHOD, true },
@@ -313,8 +309,7 @@ struct mc_api_sys
  * MediaCodec_GetName
  *****************************************************************************/
 char* MediaCodec_GetName(vlc_object_t *p_obj, const char *psz_mime,
-                         size_t h264_profile, unsigned int i_width,
-                         unsigned int i_height)
+                         size_t h264_profile)
 {
     JNIEnv *env;
     int num_codecs;
@@ -338,7 +333,6 @@ char* MediaCodec_GetName(vlc_object_t *p_obj, const char *psz_mime,
     for (int i = 0; i < num_codecs; i++)
     {
         jobject codec_capabilities = NULL;
-        jobject video_capabilities = NULL;
         jobject profile_levels = NULL;
         jobject info = NULL;
         jobject name = NULL;
@@ -374,23 +368,6 @@ char* MediaCodec_GetName(vlc_object_t *p_obj, const char *psz_mime,
             profile_levels = (*env)->GetObjectField(env, codec_capabilities, jfields.profile_levels_field);
             if (profile_levels)
                 profile_levels_len = (*env)->GetArrayLength(env, profile_levels);
-
-            if (i_width != 0 && i_height != 0 && jfields.get_video_capabilities && jfields.is_size_supported)
-            {
-                video_capabilities = (*env)->CallObjectMethod(env, codec_capabilities,
-                                                              jfields.get_video_capabilities);
-                if (video_capabilities)
-                {
-                    if ( !(*env)->CallBooleanMethod(env, video_capabilities,
-                                                    jfields.is_size_supported,
-                                                    i_width, i_height))
-                    {
-                        msg_Err(p_obj, "Video size %d * %d not supported",
-                                i_width, i_height);
-                        goto loopclean;
-                    }
-                }
-            }
         }
         msg_Dbg(p_obj, "Number of profile levels: %d", profile_levels_len);
 
@@ -456,8 +433,6 @@ loopclean:
             (*env)->DeleteLocalRef(env, codec_capabilities);
         if (info)
             (*env)->DeleteLocalRef(env, info);
-        if (video_capabilities)
-            (*env)->DeleteLocalRef(env, video_capabilities);
         if (found)
             break;
     }
@@ -968,12 +943,11 @@ static void Clean(mc_api *api)
 /*****************************************************************************
  * Configure
  *****************************************************************************/
-static int Configure(mc_api *api, size_t i_h264_profile, unsigned int i_width,
-                     unsigned int i_height)
+static int Configure(mc_api *api, size_t i_h264_profile)
 {
     free(api->psz_name);
     api->psz_name = MediaCodec_GetName(api->p_obj, api->psz_mime,
-                                       i_h264_profile, i_width, i_height);
+                                       i_h264_profile);
     if (!api->psz_name)
         return MC_API_ERROR;
     api->i_quirks = OMXCodec_GetQuirks(api->i_cat, api->i_codec, api->psz_name,
diff --git a/modules/codec/omxil/mediacodec_ndk.c b/modules/codec/omxil/mediacodec_ndk.c
index a1fd6a3..4c23966 100644
--- a/modules/codec/omxil/mediacodec_ndk.c
+++ b/modules/codec/omxil/mediacodec_ndk.c
@@ -38,8 +38,8 @@
 
 #include "mediacodec.h"
 
-char* MediaCodec_GetName(vlc_object_t *, const char *, size_t,
-                         unsigned int, unsigned int);
+char* MediaCodec_GetName(vlc_object_t *p_obj, const char *psz_mime,
+                         size_t h264_profile);
 
 #define THREAD_NAME "mediacodec_ndk"
 
@@ -564,12 +564,11 @@ static void Clean(mc_api *api)
 /*****************************************************************************
  * Configure
  *****************************************************************************/
-static int Configure(mc_api * api, size_t i_h264_profile, unsigned int i_width,
-                     unsigned int i_height)
+static int Configure(mc_api * api, size_t i_h264_profile)
 {
     free(api->psz_name);
     api->psz_name = MediaCodec_GetName(api->p_obj, api->psz_mime,
-                                       i_h264_profile, i_width, i_height);
+                                       i_h264_profile);
     if (!api->psz_name)
         return MC_API_ERROR;
     api->i_quirks = OMXCodec_GetQuirks(api->i_cat, api->i_codec, api->psz_name,



More information about the vlc-commits mailing list