diff options
author | Zhijun He <zhijunhe@google.com> | 2014-01-21 12:15:56 -0800 |
---|---|---|
committer | Eino-Ville Talvala <etalvala@google.com> | 2014-03-10 20:31:08 +0000 |
commit | bc69c8ba9a8fc881603669205a56d0ca1b572a95 (patch) | |
tree | 55c526333f2b036d4827170ff7250c99e30feaf3 | |
parent | 6db20dcb54dad932a3ea2e3a5dca41fce5802eb4 (diff) | |
download | frameworks_av-bc69c8ba9a8fc881603669205a56d0ca1b572a95.zip frameworks_av-bc69c8ba9a8fc881603669205a56d0ca1b572a95.tar.gz frameworks_av-bc69c8ba9a8fc881603669205a56d0ca1b572a95.tar.bz2 |
DO NOT MERGE: Camera: delete preview callback when preview size is changed
Preview callback stream is left configured even the preview size is changed.
This makes the callback stream unnecessarily configured even in recording mode,
which could cause distorted preview for some devices.
Bug: 12210027
Bug: 12591410
Change-Id: If50cddfe5562e91aec1feb1760eccb82ddb21730
-rw-r--r-- | services/camera/libcameraservice/api1/Camera2Client.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/services/camera/libcameraservice/api1/Camera2Client.cpp b/services/camera/libcameraservice/api1/Camera2Client.cpp index abcbd06..b093946 100644 --- a/services/camera/libcameraservice/api1/Camera2Client.cpp +++ b/services/camera/libcameraservice/api1/Camera2Client.cpp @@ -733,6 +733,7 @@ status_t Camera2Client::startPreviewL(Parameters ¶ms, bool restart) { return OK; } params.state = Parameters::STOPPED; + int lastPreviewStreamId = mStreamingProcessor->getPreviewStreamId(); res = mStreamingProcessor->updatePreviewStream(params); if (res != OK) { @@ -741,6 +742,8 @@ status_t Camera2Client::startPreviewL(Parameters ¶ms, bool restart) { return res; } + bool previewStreamChanged = mStreamingProcessor->getPreviewStreamId() != lastPreviewStreamId; + // We could wait to create the JPEG output stream until first actual use // (first takePicture call). However, this would substantially increase the // first capture latency on HAL3 devices, and potentially on some HAL2 @@ -790,6 +793,19 @@ status_t Camera2Client::startPreviewL(Parameters ¶ms, bool restart) { return res; } outputStreams.push(getCallbackStreamId()); + } else if (previewStreamChanged && mCallbackProcessor->getStreamId() != NO_STREAM) { + /** + * Delete the unused callback stream when preview stream is changed and + * preview is not enabled. Don't need stop preview stream as preview is in + * STOPPED state now. + */ + ALOGV("%s: Camera %d: Delete unused preview callback stream.", __FUNCTION__, mCameraId); + res = mCallbackProcessor->deleteStream(); + if (res != OK) { + ALOGE("%s: Camera %d: Unable to delete callback stream %s (%d)", + __FUNCTION__, mCameraId, strerror(-res), res); + return res; + } } if (params.zslMode && !params.recordingHint) { res = updateProcessorStream(mZslProcessor, params); |