From dfb89914d47a5df8b9ed7e6326848ea89195d9f3 Mon Sep 17 00:00:00 2001 From: James Dong Date: Wed, 15 Sep 2010 21:07:52 -0700 Subject: [PATCH] Fixed a bug in the query to the supported profiles and levels According to OMX spec, the levels returned is the max level settings. In fact, we could not enum all the levels. Change-Id: Ib1cba74100512800a5761c7567894c7ea5b5a452 --- media/libstagefright/OMXCodec.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp index 3d25a4bdb35a8..cd70a3d46111f 100644 --- a/media/libstagefright/OMXCodec.cpp +++ b/media/libstagefright/OMXCodec.cpp @@ -1035,7 +1035,7 @@ status_t OMXCodec::getVideoProfileLevel( mNode, OMX_IndexParamVideoProfileLevelQuerySupported, ¶m, sizeof(param)); - if (err != OK) return err; + if (err != OK) break; int32_t supportedProfile = static_cast(param.eProfile); int32_t supportedLevel = static_cast(param.eLevel); @@ -1043,7 +1043,10 @@ status_t OMXCodec::getVideoProfileLevel( supportedProfile, supportedLevel); if (profile == supportedProfile && - level == supportedLevel) { + level <= supportedLevel) { + // We can further check whether the level is a valid + // value; but we will leave that to the omx encoder component + // via OMX_SetParameter call. profileLevel.mProfile = profile; profileLevel.mLevel = level; return OK;