From d3c5b081863ad5930971d90aee2f3a61f8424d88 Mon Sep 17 00:00:00 2001 From: Yin-Chia Yeh Date: Mon, 15 Sep 2014 14:50:06 -0700 Subject: Camera2: handle one more videosnapshot failure Handle one more corner case. Also remove redundant re-try path. Bug: 17484683 Change-Id: I0b3e1223f4f28022e7ec6abe028ca3c2623829de --- .../camera/libcameraservice/api1/Camera2Client.cpp | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'services') diff --git a/services/camera/libcameraservice/api1/Camera2Client.cpp b/services/camera/libcameraservice/api1/Camera2Client.cpp index 10038c5..fe2f299 100644 --- a/services/camera/libcameraservice/api1/Camera2Client.cpp +++ b/services/camera/libcameraservice/api1/Camera2Client.cpp @@ -1091,7 +1091,7 @@ status_t Camera2Client::startRecordingL(Parameters ¶ms, bool restart) { } if (recordingStreamNeedsUpdate) { - // Need to stop stream here in case updateRecordingStream fails + // Need to stop stream here so updateProcessorStream won't trigger configureStream // Right now camera device cannot handle configureStream failure gracefully // when device is streaming res = mStreamingProcessor->stopStream(); @@ -1110,18 +1110,6 @@ status_t Camera2Client::startRecordingL(Parameters ¶ms, bool restart) { &StreamingProcessor::updateRecordingStream>(mStreamingProcessor, params); - // updateRecordingStream might trigger a configureStream call and device might fail - // configureStream due to jpeg size > video size. Try again with jpeg size overridden - // to video size. - // TODO: This may not be needed after we add stop streaming above. Remove that if - // it's the case. - if (res == BAD_VALUE) { - overrideVideoSnapshotSize(params); - res = updateProcessorStream< - StreamingProcessor, - &StreamingProcessor::updateRecordingStream>(mStreamingProcessor, - params); - } if (res != OK) { ALOGE("%s: Camera %d: Unable to update recording stream: %s (%d)", __FUNCTION__, mCameraId, strerror(-res), res); @@ -1380,6 +1368,12 @@ status_t Camera2Client::takePicture(int msgType) { int lastJpegStreamId = mJpegProcessor->getStreamId(); res = updateProcessorStream(mJpegProcessor, l.mParameters); + // If video snapshot fail to configureStream, try override video snapshot size to + // video size + if (res == BAD_VALUE && l.mParameters.state == Parameters::VIDEO_SNAPSHOT) { + overrideVideoSnapshotSize(l.mParameters); + res = updateProcessorStream(mJpegProcessor, l.mParameters); + } if (res != OK) { ALOGE("%s: Camera %d: Can't set up still image stream: %s (%d)", __FUNCTION__, mCameraId, strerror(-res), res); -- cgit v1.1