summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarco Nelissen <marcone@google.com>2015-06-03 07:26:52 -0700
committerMarco Nelissen <marcone@google.com>2015-06-03 07:26:52 -0700
commit11aaefb57fdd0076eb5484c3c5bd3bff5f6cb5e0 (patch)
tree90e161fbf88f1213b3b12c4d5a41c38e035e4df2
parent054219874873b41f1c815552987c10465c34ba2b (diff)
downloadframeworks_av-11aaefb57fdd0076eb5484c3c5bd3bff5f6cb5e0.zip
frameworks_av-11aaefb57fdd0076eb5484c3c5bd3bff5f6cb5e0.tar.gz
frameworks_av-11aaefb57fdd0076eb5484c3c5bd3bff5f6cb5e0.tar.bz2
SoftAVCDec: Added support for level greater than level at init
Bug: 21144884 Change-Id: Idda3fbf6c30e99d6df2b1e53a1f65c8ec55586ce
-rwxr-xr-x[-rw-r--r--]media/libstagefright/codecs/avcdec/SoftAVCDec.cpp51
-rwxr-xr-x[-rw-r--r--]media/libstagefright/codecs/avcdec/SoftAVCDec.h1
2 files changed, 41 insertions, 11 deletions
diff --git a/media/libstagefright/codecs/avcdec/SoftAVCDec.cpp b/media/libstagefright/codecs/avcdec/SoftAVCDec.cpp
index 08e956a..8ac337a 100644..100755
--- a/media/libstagefright/codecs/avcdec/SoftAVCDec.cpp
+++ b/media/libstagefright/codecs/avcdec/SoftAVCDec.cpp
@@ -121,6 +121,7 @@ SoftAVC::SoftAVC(
mIvColorFormat(IV_YUV_420P),
mNewWidth(mWidth),
mNewHeight(mHeight),
+ mNewLevel(0),
mChangingResolution(false) {
initPorts(
kNumBuffers, INPUT_BUF_SIZE, kNumBuffers, CODEC_MIME_TYPE);
@@ -303,18 +304,22 @@ status_t SoftAVC::initDecoder() {
uint32_t displayHeight = outputBufferHeight();
uint32_t displaySizeY = displayStride * displayHeight;
- if (displaySizeY > (1920 * 1088)) {
- i4_level = 50;
- } else if (displaySizeY > (1280 * 720)) {
- i4_level = 40;
- } else if (displaySizeY > (720 * 576)) {
- i4_level = 31;
- } else if (displaySizeY > (624 * 320)) {
- i4_level = 30;
- } else if (displaySizeY > (352 * 288)) {
- i4_level = 21;
+ if(mNewLevel == 0){
+ if (displaySizeY > (1920 * 1088)) {
+ i4_level = 50;
+ } else if (displaySizeY > (1280 * 720)) {
+ i4_level = 40;
+ } else if (displaySizeY > (720 * 576)) {
+ i4_level = 31;
+ } else if (displaySizeY > (624 * 320)) {
+ i4_level = 30;
+ } else if (displaySizeY > (352 * 288)) {
+ i4_level = 21;
+ } else {
+ i4_level = 20;
+ }
} else {
- i4_level = 20;
+ i4_level = mNewLevel;
}
{
@@ -691,6 +696,7 @@ void SoftAVC::onQueueFilled(OMX_U32 portIndex) {
bool unsupportedDimensions =
(IVD_STREAM_WIDTH_HEIGHT_NOT_SUPPORTED == (s_dec_op.u4_error_code & 0xFF));
bool resChanged = (IVD_RES_CHANGED == (s_dec_op.u4_error_code & 0xFF));
+ bool unsupportedLevel = (IH264D_UNSUPPORTED_LEVEL == (s_dec_op.u4_error_code & 0xFF));
GETTIME(&mTimeEnd, NULL);
/* Compute time taken for decode() */
@@ -722,6 +728,18 @@ void SoftAVC::onQueueFilled(OMX_U32 portIndex) {
return;
}
+ if (unsupportedLevel && !mFlushNeeded) {
+
+ mNewLevel = 51;
+
+ CHECK_EQ(reInitDecoder(), (status_t)OK);
+
+ setDecodeArgs(&s_dec_ip, &s_dec_op, inHeader, outHeader, timeStampIx);
+
+ ivdec_api_function(mCodecCtx, (void *)&s_dec_ip, (void *)&s_dec_op);
+ return;
+ }
+
// If the decoder is in the changing resolution mode and there is no output present,
// that means the switching is done and it's ready to reset the decoder and the plugin.
if (mChangingResolution && !s_dec_op.u4_output_present) {
@@ -745,6 +763,17 @@ void SoftAVC::onQueueFilled(OMX_U32 portIndex) {
continue;
}
+ if (unsupportedLevel) {
+
+ if (mFlushNeeded) {
+ setFlushMode();
+ }
+
+ mNewLevel = 51;
+ mInitNeeded = true;
+ continue;
+ }
+
if ((0 < s_dec_op.u4_pic_wd) && (0 < s_dec_op.u4_pic_ht)) {
uint32_t width = s_dec_op.u4_pic_wd;
uint32_t height = s_dec_op.u4_pic_ht;
diff --git a/media/libstagefright/codecs/avcdec/SoftAVCDec.h b/media/libstagefright/codecs/avcdec/SoftAVCDec.h
index 191a71d..2067810 100644..100755
--- a/media/libstagefright/codecs/avcdec/SoftAVCDec.h
+++ b/media/libstagefright/codecs/avcdec/SoftAVCDec.h
@@ -100,6 +100,7 @@ private:
bool mInitNeeded;
uint32_t mNewWidth;
uint32_t mNewHeight;
+ uint32_t mNewLevel;
// The input stream has changed to a different resolution, which is still supported by the
// codec. So the codec is switching to decode the new resolution.
bool mChangingResolution;