summaryrefslogtreecommitdiffstats
path: root/camera/ANativeWindowDisplayAdapter.cpp
diff options
context:
space:
mode:
authorSundar Raman <sunds@ti.com>2011-08-25 17:21:34 -0700
committerIliyan Malchev <malchev@google.com>2011-08-26 12:39:42 -0700
commit520dc9cdc3d3e9117d0829787824056e7a65aa1d (patch)
tree1bab00c8be956b3d2702174deb8ab6432082fdeb /camera/ANativeWindowDisplayAdapter.cpp
parent1d75d885061e90365591ea8ffcd15955bcb2db67 (diff)
downloadhardware_ti_omap4-520dc9cdc3d3e9117d0829787824056e7a65aa1d.tar.gz
hardware_ti_omap4-520dc9cdc3d3e9117d0829787824056e7a65aa1d.tar.bz2
hardware_ti_omap4-520dc9cdc3d3e9117d0829787824056e7a65aa1d.zip
Camera HAL: Do not call cancelBuffer when destroying the display adapter
When a NULL window is passed in setPreviewDisplay, we try to do cancelBuffer to return the buffers to the ANativeWindow if there is a valid reference to DisplayAdapter. However, the CameraService already sets the ANativeWindow reference to NULL before calling setPreviewWindow method of the Camera HAL so the cancel_buffer crashes. So, we do not call cancel_buffer as the preview window is destroyed anyway by Camera Service. Change-Id: Ie07f5fd3ca5bb5a31cb25a174ee1acc2988628af Signed-off-by: Sundar Raman <sunds@ti.com>
Diffstat (limited to 'camera/ANativeWindowDisplayAdapter.cpp')
-rw-r--r--camera/ANativeWindowDisplayAdapter.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/camera/ANativeWindowDisplayAdapter.cpp b/camera/ANativeWindowDisplayAdapter.cpp
index 7a16abf..f880e6f 100644
--- a/camera/ANativeWindowDisplayAdapter.cpp
+++ b/camera/ANativeWindowDisplayAdapter.cpp
@@ -404,7 +404,7 @@ int ANativeWindowDisplayAdapter::enableDisplay(int width, int height, struct tim
return NO_ERROR;
}
-int ANativeWindowDisplayAdapter::disableDisplay()
+int ANativeWindowDisplayAdapter::disableDisplay(bool cancel_buffer)
{
status_t ret = NO_ERROR;
@@ -456,7 +456,8 @@ int ANativeWindowDisplayAdapter::disableDisplay()
mPreviewWidth = 0;
mPreviewHeight = 0;
-
+ if(cancel_buffer)
+ {
if (mANativeWindow)
for(unsigned int i = 0; i < mFramesWithCameraAdapterMap.size(); i++) {
int value = mFramesWithCameraAdapterMap.valueAt(i);
@@ -474,6 +475,11 @@ int ANativeWindowDisplayAdapter::disableDisplay()
}
else
LOGE("mANativeWindow is NULL");
+ }
+ else
+ {
+ mANativeWindow = NULL;
+ }
///Clear the frames with camera adapter map
mFramesWithCameraAdapterMap.clear();
@@ -508,7 +514,7 @@ void ANativeWindowDisplayAdapter::destroy()
if ( mDisplayEnabled )
{
CAMHAL_LOGDA("WARNING: Calling destroy of Display adapter when display enabled. Disabling display..");
- disableDisplay();
+ disableDisplay(false);
}
mBufferCount = 0;