diff options
author | Yin-Chia Yeh <yinchiayeh@google.com> | 2015-01-20 23:57:20 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-01-20 23:57:20 +0000 |
commit | 656d738cab67349f4b5a45473a0c48cf89c68fd0 (patch) | |
tree | d5eb6ee4d17b03dc48bb4e881f8c80483e1a6ec2 /services/camera | |
parent | 1d6aedb3581f1ef2ce9862b1b1d03c9fd3cfff83 (diff) | |
parent | a789e51942c7572e0c9f54326d6d9d0ff65d6941 (diff) | |
download | frameworks_av-656d738cab67349f4b5a45473a0c48cf89c68fd0.zip frameworks_av-656d738cab67349f4b5a45473a0c48cf89c68fd0.tar.gz frameworks_av-656d738cab67349f4b5a45473a0c48cf89c68fd0.tar.bz2 |
am a789e519: am 0c4e56d0: Camera: make sure jpeg buffer size isn\'t too small
* commit 'a789e51942c7572e0c9f54326d6d9d0ff65d6941':
Camera: make sure jpeg buffer size isn't too small
Diffstat (limited to 'services/camera')
-rw-r--r-- | services/camera/libcameraservice/device3/Camera3Device.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/services/camera/libcameraservice/device3/Camera3Device.cpp b/services/camera/libcameraservice/device3/Camera3Device.cpp index bba3905..53e6fa9 100644 --- a/services/camera/libcameraservice/device3/Camera3Device.cpp +++ b/services/camera/libcameraservice/device3/Camera3Device.cpp @@ -361,16 +361,15 @@ ssize_t Camera3Device::getJpegBufferSize(uint32_t width, uint32_t height) const return BAD_VALUE; } maxJpegBufferSize = jpegBufMaxSize.data.i32[0]; + assert(kMinJpegBufferSize < maxJpegBufferSize); // Calculate final jpeg buffer size for the given resolution. float scaleFactor = ((float) (width * height)) / (maxJpegResolution.width * maxJpegResolution.height); - ssize_t jpegBufferSize = scaleFactor * maxJpegBufferSize; - // Bound the buffer size to [MIN_JPEG_BUFFER_SIZE, maxJpegBufferSize]. + ssize_t jpegBufferSize = scaleFactor * (maxJpegBufferSize - kMinJpegBufferSize) + + kMinJpegBufferSize; if (jpegBufferSize > maxJpegBufferSize) { jpegBufferSize = maxJpegBufferSize; - } else if (jpegBufferSize < kMinJpegBufferSize) { - jpegBufferSize = kMinJpegBufferSize; } return jpegBufferSize; |