Implements camera error reporting.
Change-Id: I5f4f4cd1baab60053e827e0605a92a123c7a086f
This commit is contained in:
@@ -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
|
||||
***************************************************************************/
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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
|
||||
***************************************************************************/
|
||||
|
||||
@@ -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 */
|
||||
|
||||
Reference in New Issue
Block a user