summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorRuben Brunk <rubenbrunk@google.com>2014-06-20 00:24:56 -0700
committerRuben Brunk <rubenbrunk@google.com>2014-06-20 15:59:00 -0700
commit91b9aabc9fa0c058ecc4a8b3f486540c28fe1cc0 (patch)
tree7dcc48c4f6af7f6defa76a23558b095d37ca177b /media
parent5776aafc7e70c0b79c4bee2bc50f44121b37c962 (diff)
downloadframeworks_base-91b9aabc9fa0c058ecc4a8b3f486540c28fe1cc0.zip
frameworks_base-91b9aabc9fa0c058ecc4a8b3f486540c28fe1cc0.tar.gz
frameworks_base-91b9aabc9fa0c058ecc4a8b3f486540c28fe1cc0.tar.bz2
camera2: Switch to using YV12 for ImageReader.
Bug: 15116722 - Also fixes incorrect frame number for single captures. Change-Id: I8552124d18ad176e6724f089a1e3a3f49a5eeec4
Diffstat (limited to 'media')
-rw-r--r--media/jni/android_media_ImageReader.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/media/jni/android_media_ImageReader.cpp b/media/jni/android_media_ImageReader.cpp
index 36cfb0f..41ed9e1 100644
--- a/media/jni/android_media_ImageReader.cpp
+++ b/media/jni/android_media_ImageReader.cpp
@@ -767,11 +767,12 @@ static jint ImageReader_imageSetup(JNIEnv* env, jobject thiz,
int imgReaderFmt = ctx->getBufferFormat();
int bufFmt = buffer->format;
if (imgReaderFmt != bufFmt) {
- // Special casing for when producer switches format
- if (imgReaderFmt == HAL_PIXEL_FORMAT_YCbCr_420_888 && bufFmt ==
- HAL_PIXEL_FORMAT_YCrCb_420_SP) {
- ctx->setBufferFormat(HAL_PIXEL_FORMAT_YCrCb_420_SP);
- ALOGV("%s: Overriding NV21 to YUV_420_888.", __FUNCTION__);
+ // Special casing for when producer switches to a format compatible with flexible YUV
+ // (HAL_PIXEL_FORMAT_YCbCr_420_888).
+ if (imgReaderFmt == HAL_PIXEL_FORMAT_YCbCr_420_888 && (bufFmt ==
+ HAL_PIXEL_FORMAT_YCrCb_420_SP || bufFmt == HAL_PIXEL_FORMAT_YV12)) {
+ ctx->setBufferFormat(bufFmt);
+ ALOGV("%s: Overriding buffer format YUV_420_888 to %x.", __FUNCTION__, bufFmt);
} else {
// Return the buffer to the queue.
consumer->unlockBuffer(*buffer);