diff options
author | Eino-Ville Talvala <etalvala@google.com> | 2013-06-10 15:12:01 -0700 |
---|---|---|
committer | Eino-Ville Talvala <etalvala@google.com> | 2013-06-11 14:44:47 -0700 |
commit | a9c64a9398ac2e6173f99e252f305808a34cab1c (patch) | |
tree | 324ccc6b93f727f08febe50abe63d102ede9e6fa /services | |
parent | ba696bbff88d5627beaa0be95be78ba30138983d (diff) | |
download | frameworks_av-a9c64a9398ac2e6173f99e252f305808a34cab1c.zip frameworks_av-a9c64a9398ac2e6173f99e252f305808a34cab1c.tar.gz frameworks_av-a9c64a9398ac2e6173f99e252f305808a34cab1c.tar.bz2 |
Camera2/3: Create JPEG stream unconditionally.
Instead of creating the JPEG output stream only at first use,
create it at time of preview start. This is important for reducing
the first-capture latency on HAL3 devices, and for ZSL on them.
Bug: 9339858
Change-Id: I4296f706cfd151c47ef315149e87d01fe554aaa4
Diffstat (limited to 'services')
-rw-r--r-- | services/camera/libcameraservice/Camera2Client.cpp | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/services/camera/libcameraservice/Camera2Client.cpp b/services/camera/libcameraservice/Camera2Client.cpp index 081fdec..a1971e3 100644 --- a/services/camera/libcameraservice/Camera2Client.cpp +++ b/services/camera/libcameraservice/Camera2Client.cpp @@ -682,6 +682,22 @@ status_t Camera2Client::startPreviewL(Parameters ¶ms, bool restart) { return res; } + // 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 + // devices. So create it unconditionally at preview start. As a drawback, + // this increases gralloc memory consumption for applications that don't + // ever take a picture. + // TODO: Find a better compromise, though this likely would involve HAL + // changes. + res = updateProcessorStream(mJpegProcessor, params); + if (res != OK) { + ALOGE("%s: Camera %d: Can't pre-configure still image " + "stream: %s (%d)", + __FUNCTION__, mCameraId, strerror(-res), res); + return res; + } + Vector<uint8_t> outputStreams; bool callbacksEnabled = params.previewCallbackFlags & CAMERA_FRAME_CALLBACK_FLAG_ENABLE_MASK; @@ -719,18 +735,6 @@ status_t Camera2Client::startPreviewL(Parameters ¶ms, bool restart) { res = mStreamingProcessor->startStream(StreamingProcessor::PREVIEW, outputStreams); } else { - // With recording hint set, we're going to be operating under the - // assumption that the user will record video. To optimize recording - // startup time, create the necessary output streams for recording and - // video snapshot now if they don't already exist. - res = updateProcessorStream(mJpegProcessor, params); - if (res != OK) { - ALOGE("%s: Camera %d: Can't pre-configure still image " - "stream: %s (%d)", - __FUNCTION__, mCameraId, strerror(-res), res); - return res; - } - if (!restart) { res = mStreamingProcessor->updateRecordingRequest(params); if (res != OK) { |