From 96ff5c48a81f3f45c384113480bf5e28620a72ae Mon Sep 17 00:00:00 2001 From: Zhijun He Date: Mon, 13 Oct 2014 22:20:37 -0700 Subject: Camera2Client: avoid two consecutive sets of configure_streams calls When mediaRecorder starts without an active preview stream, Camera2Client starts preview then immediately start recording, which could cause the second configure_streams to call into HAL before any preview request is sent. This could cause HAL to run into bad state. This change work around this issue by making sure the first preview request is submitted to the HAL before start recording. Bug: 17915062 Change-Id: I94ae64ee76487603695a469240da601ddcb29a66 --- services/camera/libcameraservice/api1/Camera2Client.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'services') diff --git a/services/camera/libcameraservice/api1/Camera2Client.cpp b/services/camera/libcameraservice/api1/Camera2Client.cpp index 3610362..2a6aa7b 100644 --- a/services/camera/libcameraservice/api1/Camera2Client.cpp +++ b/services/camera/libcameraservice/api1/Camera2Client.cpp @@ -995,6 +995,10 @@ status_t Camera2Client::startRecordingL(Parameters ¶ms, bool restart) { case Parameters::STOPPED: res = startPreviewL(params, false); if (res != OK) return res; + // Make sure first preview request is submitted to the HAL device to avoid + // two consecutive set of configure_streams being called into the HAL. + // TODO: Refactor this to avoid initial preview configuration. + syncWithDevice(); break; case Parameters::PREVIEW: // Ready to go -- cgit v1.1