diff options
| author | Zhijun He <zhijunhe@google.com> | 2013-09-11 21:31:54 +0000 |
|---|---|---|
| committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-09-11 21:31:54 +0000 |
| commit | e550446dcfb96e76715e77e044359b2769ca2676 (patch) | |
| tree | 96bc2c7425df435afba0869411e555f05d9ddb49 /media/jni/android_media_ImageReader.cpp | |
| parent | f8a910fbd5b72e3350740d224b36db49dc3170e6 (diff) | |
| parent | 37682135da2fd90e7bc6a89a418862d1f4ca15fd (diff) | |
| download | frameworks_base-e550446dcfb96e76715e77e044359b2769ca2676.zip frameworks_base-e550446dcfb96e76715e77e044359b2769ca2676.tar.gz frameworks_base-e550446dcfb96e76715e77e044359b2769ca2676.tar.bz2 | |
Merge "ImageReader: Skip size check for BLOB format" into klp-dev
Diffstat (limited to 'media/jni/android_media_ImageReader.cpp')
| -rw-r--r-- | media/jni/android_media_ImageReader.cpp | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/media/jni/android_media_ImageReader.cpp b/media/jni/android_media_ImageReader.cpp index 92edb8a..94f20bc 100644 --- a/media/jni/android_media_ImageReader.cpp +++ b/media/jni/android_media_ImageReader.cpp @@ -738,7 +738,7 @@ static jboolean ImageReader_imageSetup(JNIEnv* env, jobject thiz, int outputWidth = buffer->width; int outputHeight = buffer->height; - // Correct with/height when crop is set. + // Correct width/height when crop is set. if (buffer->crop.getWidth() > 0) { outputWidth = buffer->crop.getWidth() + 1; } @@ -748,12 +748,19 @@ static jboolean ImageReader_imageSetup(JNIEnv* env, jobject thiz, int imageReaderWidth = ctx->getBufferWidth(); int imageReaderHeight = ctx->getBufferHeight(); - if (imageReaderWidth != outputWidth - || imageReaderHeight != outputHeight) { - // Spew warning for now, since MediaCodec decoder has a bug to setup the right crop - // TODO: make it throw exception once the decoder bug is fixed. - ALOGW("Producer buffer size: %dx%d, doesn't match ImageReader configured size: %dx%d", - outputWidth, outputHeight, imageReaderWidth, imageReaderHeight); + if ((buffer->format != HAL_PIXEL_FORMAT_BLOB) && + (imageReaderWidth != outputWidth || imageReaderHeight > outputHeight)) { + /** + * For video decoder, the buffer height is actually the vertical stride, + * which is always >= actual image height. For future, decoder need provide + * right crop rectangle to CpuConsumer to indicate the actual image height, + * see bug 9563986. After this bug is fixed, we can enforce the height equal + * check. Right now, only make sure buffer height is no less than ImageReader + * height. + */ + jniThrowExceptionFmt(env, "java/lang/IllegalStateException", + "Producer buffer size: %dx%d, doesn't match ImageReader configured size: %dx%d", + outputWidth, outputHeight, imageReaderWidth, imageReaderHeight); } if (ctx->getBufferFormat() != buffer->format) { |
