Bug 973790 - only call ClearCurrentFrame() when closing down the camera hardware, r=dhylands

This commit is contained in:
Mike Habicher 2014-02-19 23:18:55 -05:00
parent 9e32e131fd
commit 8b4193c3a5
2 changed files with 23 additions and 4 deletions

View File

@ -215,11 +215,18 @@ nsGonkCameraControl::SetConfigurationImpl(const Configuration& aConfig)
MOZ_ASSERT(NS_GetCurrentThread() == mCameraThread); MOZ_ASSERT(NS_GetCurrentThread() == mCameraThread);
// Stop any currently running preview // Stop any currently running preview
StopPreviewImpl(); nsresult rv = PausePreview();
if (NS_FAILED(rv)) {
// warn, but plow ahead
NS_WARNING("PausePreview() in SetConfigurationImpl() failed");
}
DOM_CAMERA_LOGT("%s:%d\n", __func__, __LINE__); DOM_CAMERA_LOGT("%s:%d\n", __func__, __LINE__);
nsresult rv = SetConfigurationInternal(aConfig); rv = SetConfigurationInternal(aConfig);
NS_ENSURE_SUCCESS(rv, rv); if (NS_WARN_IF(NS_FAILED(rv))) {
StopPreviewImpl();
return rv;
}
// Restart the preview // Restart the preview
DOM_CAMERA_LOGT("%s:%d\n", __func__, __LINE__); DOM_CAMERA_LOGT("%s:%d\n", __func__, __LINE__);
@ -506,11 +513,22 @@ nsGonkCameraControl::StopPreviewImpl()
DOM_CAMERA_LOGI("Stopping preview (this=%p)\n", this); DOM_CAMERA_LOGI("Stopping preview (this=%p)\n", this);
mCameraHw->StopPreview(); mCameraHw->StopPreview();
OnPreviewStateChange(CameraControlListener::kPreviewStopped); OnPreviewStateChange(CameraControlListener::kPreviewStopped);
return NS_OK; return NS_OK;
} }
nsresult
nsGonkCameraControl::PausePreview()
{
RETURN_IF_NO_CAMERA_HW();
DOM_CAMERA_LOGI("Pausing preview (this=%p)\n", this);
mCameraHw->StopPreview();
OnPreviewStateChange(CameraControlListener::kPreviewPaused);
return NS_OK;
}
nsresult nsresult
nsGonkCameraControl::AutoFocusImpl(bool aCancelExistingCall) nsGonkCameraControl::AutoFocusImpl(bool aCancelExistingCall)
{ {

View File

@ -116,6 +116,7 @@ protected:
nsresult SetupRecording(int aFd, int aRotation, int64_t aMaxFileSizeBytes, int64_t aMaxVideoLengthMs); nsresult SetupRecording(int aFd, int aRotation, int64_t aMaxFileSizeBytes, int64_t aMaxVideoLengthMs);
nsresult SetupVideoMode(const nsAString& aProfile); nsresult SetupVideoMode(const nsAString& aProfile);
nsresult SetPreviewSize(const Size& aSize); nsresult SetPreviewSize(const Size& aSize);
nsresult PausePreview();
friend class SetPictureSize; friend class SetPictureSize;
friend class SetThumbnailSize; friend class SetThumbnailSize;