Fix callback sequence on picture taking

Also fixes a bug in JPEG converter.

Change-Id: I5bbeec96ec2bb0a9a6a333a3798880bb0b837c65
This commit is contained in:
Vladimir Chtchetkine
2011-09-21 10:56:35 -07:00
parent 318ae8e9fe
commit 1f37cd45f6
3 changed files with 27 additions and 20 deletions

View File

@@ -503,15 +503,16 @@ status_t EmulatedCamera::doStartPreview()
{
LOGV("%s", __FUNCTION__);
EmulatedCameraDevice* camera_dev = getCameraDevice();
if (camera_dev->isStarted()) {
camera_dev->stopDeliveringFrames();
camera_dev->stopDevice();
}
status_t res = mPreviewWindow.startPreview();
if (res != NO_ERROR) {
return res;
}
if (getCameraDevice()->isStarted()) {
return NO_ERROR;
}
EmulatedCameraDevice* camera_dev = getCameraDevice();
/* Make sure camera device is connected. */
if (!camera_dev->isConnected()) {
@@ -573,15 +574,17 @@ status_t EmulatedCamera::doStopPreview()
LOGV("%s", __FUNCTION__);
status_t res = NO_ERROR;
/* Stop the camera. */
if (getCameraDevice()->isStarted()) {
getCameraDevice()->stopDeliveringFrames();
res = getCameraDevice()->stopDevice();
}
if (mPreviewWindow.isPreviewEnabled()) {
/* Stop the camera. */
if (getCameraDevice()->isStarted()) {
getCameraDevice()->stopDeliveringFrames();
res = getCameraDevice()->stopDevice();
}
if (res == NO_ERROR) {
/* Disable preview as well. */
mPreviewWindow.stopPreview();
if (res == NO_ERROR) {
/* Disable preview as well. */
mPreviewWindow.stopPreview();
}
}
return NO_ERROR;