diff options
author | Eino-Ville Talvala <etalvala@google.com> | 2013-07-01 18:20:02 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-07-01 18:20:02 +0000 |
commit | 8f13428cb29a9b610a9e9a0f5fea437cd2d3f032 (patch) | |
tree | c913526f2f967ddf112582e8da281852b4844d5a | |
parent | 2c1648df9d2d623c602fee17048abc82c9e44d55 (diff) | |
parent | c7ba4a5c938d191bf0e477fc9b9aa4f0cba986ef (diff) | |
download | frameworks_av-8f13428cb29a9b610a9e9a0f5fea437cd2d3f032.zip frameworks_av-8f13428cb29a9b610a9e9a0f5fea437cd2d3f032.tar.gz frameworks_av-8f13428cb29a9b610a9e9a0f5fea437cd2d3f032.tar.bz2 |
Merge "Camera2Api: Creating a JPEG stream needs to use the right size"
-rw-r--r-- | services/camera/libcameraservice/photography/CameraDeviceClient.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/services/camera/libcameraservice/photography/CameraDeviceClient.cpp b/services/camera/libcameraservice/photography/CameraDeviceClient.cpp index 3209a56..bd6b60a 100644 --- a/services/camera/libcameraservice/photography/CameraDeviceClient.cpp +++ b/services/camera/libcameraservice/photography/CameraDeviceClient.cpp @@ -337,8 +337,23 @@ status_t CameraDeviceClient::createStream(int width, int height, int format, // after each call, but only once we are done with all. int streamId = -1; - res = mDevice->createStream(anw, width, height, format, /*size*/1, - &streamId); + if (format == HAL_PIXEL_FORMAT_BLOB) { + // JPEG buffers need to be sized for maximum possible compressed size + CameraMetadata staticInfo = mDevice->info(); + camera_metadata_entry_t entry = staticInfo.find(ANDROID_JPEG_MAX_SIZE); + if (entry.count == 0) { + ALOGE("%s: Camera %d: Can't find maximum JPEG size in " + "static metadata!", __FUNCTION__, mCameraId); + return INVALID_OPERATION; + } + int32_t maxJpegSize = entry.data.i32[0]; + res = mDevice->createStream(anw, width, height, format, maxJpegSize, + &streamId); + } else { + // All other streams are a known size + res = mDevice->createStream(anw, width, height, format, /*size*/0, + &streamId); + } if (res == OK) { mStreamMap.add(bufferProducer->asBinder(), streamId); |