Implements camera error reporting.

Change-Id: I5f4f4cd1baab60053e827e0605a92a123c7a086f
This commit is contained in:
Vladimir Chtchetkine
2011-09-23 08:26:39 -07:00
parent 8fbf284cc8
commit b3ea171655
5 changed files with 30 additions and 3 deletions

View File

@@ -257,6 +257,13 @@ void CallbackNotifier::onNextFrameAvailable(const void* frame,
}
}
void CallbackNotifier::onCameraDeviceError(int err)
{
if (isMessageEnabled(CAMERA_MSG_ERROR) && mNotifyCB != NULL) {
mNotifyCB(CAMERA_MSG_ERROR, err, 0, mCBOpaque);
}
}
/****************************************************************************
* Private API
***************************************************************************/

View File

@@ -159,6 +159,12 @@ public:
nsecs_t timestamp,
EmulatedCameraDevice* camera_dev);
/* Entry point for notifications that occur in camera device.
* Param:
* err - CAMERA_ERROR_XXX error code.
*/
void onCameraDeviceError(int err);
/* Sets, or resets taking picture state.
* This state control whether or not to notify the framework about compressed
* image, shutter, and other picture related events.

View File

@@ -149,6 +149,12 @@ void EmulatedCamera::onNextFrameAvailable(const void* frame,
mCallbackNotifier.onNextFrameAvailable(frame, timestamp, camera_dev);
}
void EmulatedCamera::onCameraDeviceError(int err)
{
/* Errors are reported through the callback notifier */
mCallbackNotifier.onCameraDeviceError(err);
}
/****************************************************************************
* Camera API implementation.
***************************************************************************/
@@ -559,7 +565,8 @@ status_t EmulatedCamera::doStartPreview()
mPreviewWindow.stopPreview();
return EINVAL;
}
LOGD("Starting camera: %dx%d -> %.4s", width, height, pix_fmt);
LOGD("Starting camera: %dx%d -> %.4s(%s)",
width, height, reinterpret_cast<const char*>(&org_fmt), pix_fmt);
res = camera_dev->startDevice(width, height, org_fmt);
if (res != NO_ERROR) {
mPreviewWindow.stopPreview();

View File

@@ -94,6 +94,12 @@ public:
nsecs_t timestamp,
EmulatedCameraDevice* camera_dev);
/* Entry point for notifications that occur in camera device.
* Param:
* err - CAMERA_ERROR_XXX error code.
*/
virtual void onCameraDeviceError(int err);
/****************************************************************************
* Camera API implementation
***************************************************************************/

View File

@@ -249,12 +249,13 @@ bool EmulatedQemuCameraDevice::inWorkerThread()
/* Timestamp the current frame, and notify the camera HAL. */
mCurFrameTimestamp = systemTime(SYSTEM_TIME_MONOTONIC);
mCameraHAL->onNextFrameAvailable(mCurrentFrame, mCurFrameTimestamp, this);
return true;
} else {
LOGE("%s: Unable to get current video frame: %s",
__FUNCTION__, strerror(query_res));
mCameraHAL->onCameraDeviceError(CAMERA_ERROR_SERVER_DIED);
return false;
}
return true;
}
}; /* namespace android */