From 0452d58f2085dfb1414e768d30ee622da23df4a5 Mon Sep 17 00:00:00 2001 From: kldoc Date: Sat, 22 Oct 2016 11:58:35 +0800 Subject: [PATCH] Camera HAL V1 Create a flag to revert commit https://github.com/omnirom/android_frameworks_av/commit/9501a1e1ff0a173cd85c59723ba458d07e1fca96 This is needed to fix video recording on devices using Camera HAL V1 Change-Id: Icaae2772592eb3d1e74071f91fd6259b1662a9de --- media/libstagefright/Android.mk | 5 +++++ media/libstagefright/CameraSource.cpp | 5 ++++- services/camera/libcameraservice/Android.mk | 4 ++++ services/camera/libcameraservice/api1/CameraClient.cpp | 2 ++ 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/media/libstagefright/Android.mk b/media/libstagefright/Android.mk index 50f6962..0d9a5b7 100644 --- a/media/libstagefright/Android.mk +++ b/media/libstagefright/Android.mk @@ -147,6 +147,11 @@ endif LOCAL_CLANG := true LOCAL_SANITIZE := unsigned-integer-overflow signed-integer-overflow +ifeq ($(TARGET_HAS_CAMERA_HAL_V1),true) + LOCAL_CFLAGS += -DTARGET_HAS_CAMERA_HAL_V1 +endif + + LOCAL_MODULE:= libstagefright LOCAL_MODULE_TAGS := optional diff --git a/media/libstagefright/CameraSource.cpp b/media/libstagefright/CameraSource.cpp index 0e2fb41..bd71e5f 100644 --- a/media/libstagefright/CameraSource.cpp +++ b/media/libstagefright/CameraSource.cpp @@ -1138,10 +1138,13 @@ void CameraSource::releaseRecordingFrameHandle(native_handle_t* handle) { int64_t token = IPCThreadState::self()->clearCallingIdentity(); mCamera->releaseRecordingFrameHandle(handle); IPCThreadState::self()->restoreCallingIdentity(token); - } else { + } + #ifndef TARGET_HAS_CAMERA_HAL_V1 + else { native_handle_close(handle); native_handle_delete(handle); } + #endif } void CameraSource::recordingFrameHandleCallbackTimestamp(int64_t timestampUs, diff --git a/services/camera/libcameraservice/Android.mk b/services/camera/libcameraservice/Android.mk index ebe65e4..f00459a 100644 --- a/services/camera/libcameraservice/Android.mk +++ b/services/camera/libcameraservice/Android.mk @@ -81,4 +81,8 @@ LOCAL_CFLAGS += -Wall -Wextra -Werror LOCAL_MODULE:= libcameraservice +ifeq ($(TARGET_HAS_CAMERA_HAL_V1),true) + LOCAL_CFLAGS += -DTARGET_HAS_CAMERA_HAL_V1 +endif + include $(BUILD_SHARED_LIBRARY) diff --git a/services/camera/libcameraservice/api1/CameraClient.cpp b/services/camera/libcameraservice/api1/CameraClient.cpp index 0d87fdd..f8a6e38 100644 --- a/services/camera/libcameraservice/api1/CameraClient.cpp +++ b/services/camera/libcameraservice/api1/CameraClient.cpp @@ -524,8 +524,10 @@ void CameraClient::releaseRecordingFrameHandle(native_handle_t *handle) { mHardware->releaseRecordingFrame(dataPtr); + #ifndef TARGET_HAS_CAMERA_HAL_V1 native_handle_close(handle); native_handle_delete(handle); + #endif } status_t CameraClient::setVideoBufferMode(int32_t videoBufferMode) { -- 2.9.3