summaryrefslogtreecommitdiffstats
path: root/libcamera
diff options
context:
space:
mode:
authorWu-cheng Li <wuchengli@google.com>2011-08-31 15:53:48 +0800
committerWu-cheng Li <wuchengli@google.com>2011-08-31 17:26:22 +0800
commit6f37557f029f5b7c2801dee6944c1539bde9c89d (patch)
tree59b8231f8db671503120b298ea53c19894917ce6 /libcamera
parent885021a9ca746876f7e34549454eceee214edfe8 (diff)
downloaddevice_samsung_crespo-6f37557f029f5b7c2801dee6944c1539bde9c89d.zip
device_samsung_crespo-6f37557f029f5b7c2801dee6944c1539bde9c89d.tar.gz
device_samsung_crespo-6f37557f029f5b7c2801dee6944c1539bde9c89d.tar.bz2
Fix the bug that jpeg size is always 6.8MB.
Allocate an exact size of jpeg heap before passing to camera service. bug:5160482 Change-Id: Id78f60b03a90533cb62f0c6489c9680692583c23
Diffstat (limited to 'libcamera')
-rwxr-xr-xlibcamera/SecCameraHWInterface.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/libcamera/SecCameraHWInterface.cpp b/libcamera/SecCameraHWInterface.cpp
index 7922896..875fbcd 100755
--- a/libcamera/SecCameraHWInterface.cpp
+++ b/libcamera/SecCameraHWInterface.cpp
@@ -1166,16 +1166,18 @@ int CameraHardwareSec::pictureThread()
if (JpegExifSize < 0) {
ret = UNKNOWN_ERROR;
+ ExifHeap->release(ExifHeap);
goto out;
}
- unsigned char *ExifStart = (unsigned char *)JpegHeap->data + 2;
- unsigned char *ImageStart = ExifStart + JpegExifSize;
-
- memmove(ImageStart, ExifStart, JpegImageSize - 2);
- memcpy(ExifStart, ExifHeap->data, JpegExifSize);
-
- mDataCb(CAMERA_MSG_COMPRESSED_IMAGE, JpegHeap, 0, NULL, mCallbackCookie);
+ camera_memory_t *mem = mGetMemoryCb(-1, JpegImageSize + JpegExifSize, 1, 0);
+ uint8_t *ptr = (uint8_t *) mem->data;
+ memcpy(ptr, JpegHeap->data, 2); ptr += 2;
+ memcpy(ptr, ExifHeap->data, JpegExifSize); ptr += JpegExifSize;
+ memcpy(ptr, (uint8_t *) JpegHeap->data + 2, JpegImageSize - 2);
+ mDataCb(CAMERA_MSG_COMPRESSED_IMAGE, mem, 0, NULL, mCallbackCookie);
+ mem->release(mem);
+ ExifHeap->release(ExifHeap);
}
LOG_TIME_END(0)