diff options
author | James Dong <jdong@google.com> | 2011-10-18 22:17:34 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2011-10-18 22:17:34 -0700 |
commit | ca9f7f2d484ba0296db49406e3ef908bc7e119c1 (patch) | |
tree | a81c3b11ef0d2950a566b1dc83e319f51e05cab7 | |
parent | 2ce99907b2f4369bb76f2698c6d414cdbfb36224 (diff) | |
parent | c4ff709bd714286ea4b1eaf8d932c43a02d5430d (diff) | |
download | frameworks_av-ca9f7f2d484ba0296db49406e3ef908bc7e119c1.zip frameworks_av-ca9f7f2d484ba0296db49406e3ef908bc7e119c1.tar.gz frameworks_av-ca9f7f2d484ba0296db49406e3ef908bc7e119c1.tar.bz2 |
am 5264f600: Merge "Bail out after kMaxColorFormatSupported calls to OMX_GetParameter(). Avoid infinite loop in querying omx component about the supported color format." into ics-mr0
* commit '5264f6003bbcb8ca70df034379154914260cc322':
Bail out after kMaxColorFormatSupported calls to OMX_GetParameter(). Avoid infinite loop in querying omx component about the supported color format.
-rwxr-xr-x | media/libstagefright/OMXCodec.cpp | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/media/libstagefright/OMXCodec.cpp b/media/libstagefright/OMXCodec.cpp index 86bd267..f9cb882 100755 --- a/media/libstagefright/OMXCodec.cpp +++ b/media/libstagefright/OMXCodec.cpp @@ -52,6 +52,13 @@ namespace android { // buffers after 3 seconds. const static int64_t kBufferFilledEventTimeOutNs = 3000000000LL; +// OMX Spec defines less than 50 color formats. If the query for +// color format is executed for more than kMaxColorFormatSupported, +// the query will fail to avoid looping forever. +// 1000 is more than enough for us to tell whether the omx +// component in question is buggy or not. +const static uint32_t kMaxColorFormatSupported = 1000; + struct CodecInfo { const char *mime; const char *codec; @@ -819,6 +826,11 @@ status_t OMXCodec::setVideoPortFormatType( } ++index; + if (index >= kMaxColorFormatSupported) { + CODEC_LOGE("color format %d or compression format %d is not supported", + colorFormat, compressionFormat); + return UNKNOWN_ERROR; + } } if (!found) { @@ -902,22 +914,19 @@ status_t OMXCodec::isColorFormatSupported( // the incremented index (bug 2897413). CHECK_EQ(index, portFormat.nIndex); if (portFormat.eColorFormat == colorFormat) { - LOGV("Found supported color format: %d", portFormat.eColorFormat); + CODEC_LOGV("Found supported color format: %d", portFormat.eColorFormat); return OK; // colorFormat is supported! } ++index; portFormat.nIndex = index; - // OMX Spec defines less than 50 color formats - // 1000 is more than enough for us to tell whether the omx - // component in question is buggy or not. - if (index >= 1000) { - LOGE("More than %ld color formats are supported???", index); + if (index >= kMaxColorFormatSupported) { + CODEC_LOGE("More than %ld color formats are supported???", index); break; } } - LOGE("color format %d is not supported", colorFormat); + CODEC_LOGE("color format %d is not supported", colorFormat); return UNKNOWN_ERROR; } |