summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorChien-Yu Chen <cychen@google.com>2015-07-07 17:19:15 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-07-07 17:19:16 +0000
commit637709460ea75e927a5802899d6547bca3b5e7be (patch)
treef1b1552144d3a31cc948a35c94a461bbc197b404 /services
parenta0169a073d88efefbfb35fa0ea8e94f7b31d7469 (diff)
parent944f843015c440837abb029356108a81b4095e53 (diff)
downloadframeworks_av-637709460ea75e927a5802899d6547bca3b5e7be.zip
frameworks_av-637709460ea75e927a5802899d6547bca3b5e7be.tar.gz
frameworks_av-637709460ea75e927a5802899d6547bca3b5e7be.tar.bz2
Merge "CameraModule: fix getCameraInfo()" into mnc-dev
Diffstat (limited to 'services')
-rw-r--r--services/camera/libcameraservice/common/CameraModule.cpp19
-rw-r--r--services/camera/libcameraservice/common/CameraModule.h2
2 files changed, 15 insertions, 6 deletions
diff --git a/services/camera/libcameraservice/common/CameraModule.cpp b/services/camera/libcameraservice/common/CameraModule.cpp
index 85d4488..1ae01ae 100644
--- a/services/camera/libcameraservice/common/CameraModule.cpp
+++ b/services/camera/libcameraservice/common/CameraModule.cpp
@@ -154,6 +154,18 @@ CameraModule::CameraModule(camera_module_t *module) {
mCameraInfoMap.setCapacity(getNumberOfCameras());
}
+CameraModule::~CameraModule()
+{
+ while (mCameraInfoMap.size() > 0) {
+ camera_info cameraInfo = mCameraInfoMap.editValueAt(0);
+ if (cameraInfo.static_camera_characteristics != NULL) {
+ free_camera_metadata(
+ const_cast<camera_metadata_t*>(cameraInfo.static_camera_characteristics));
+ }
+ mCameraInfoMap.removeItemsAt(0);
+ }
+}
+
int CameraModule::init() {
if (getModuleApiVersion() >= CAMERA_MODULE_API_VERSION_2_4 &&
mModule->init != NULL) {
@@ -192,12 +204,9 @@ int CameraModule::getCameraInfo(int cameraId, struct camera_info *info) {
CameraMetadata m;
m = rawInfo.static_camera_characteristics;
deriveCameraCharacteristicsKeys(rawInfo.device_version, m);
- mCameraCharacteristicsMap.add(cameraId, m);
cameraInfo = rawInfo;
- cameraInfo.static_camera_characteristics =
- mCameraCharacteristicsMap.valueFor(cameraId).getAndLock();
- mCameraInfoMap.add(cameraId, cameraInfo);
- index = mCameraInfoMap.indexOfKey(cameraId);
+ cameraInfo.static_camera_characteristics = m.release();
+ index = mCameraInfoMap.add(cameraId, cameraInfo);
}
assert(index != NAME_NOT_FOUND);
diff --git a/services/camera/libcameraservice/common/CameraModule.h b/services/camera/libcameraservice/common/CameraModule.h
index c21092e..36822c7 100644
--- a/services/camera/libcameraservice/common/CameraModule.h
+++ b/services/camera/libcameraservice/common/CameraModule.h
@@ -33,6 +33,7 @@ namespace android {
class CameraModule {
public:
CameraModule(camera_module_t *module);
+ virtual ~CameraModule();
// Must be called after construction
// Returns OK on success, NO_INIT on failure
@@ -60,7 +61,6 @@ private:
camera_module_t *mModule;
KeyedVector<int, camera_info> mCameraInfoMap;
- KeyedVector<int, CameraMetadata> mCameraCharacteristicsMap;
Mutex mCameraInfoLock;
};