Loading services/camera/libcameraservice/api1/Camera2Client.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -859,6 +859,12 @@ status_t Camera2Client::startPreviewL(Parameters ¶ms, bool restart) { outputStreams.push(getPreviewStreamId()); if (params.isDeviceZslSupported) { // If device ZSL is supported, resume preview buffers that may be paused // during last takePicture(). mDevice->dropStreamBuffers(false, getPreviewStreamId()); } if (!params.recordingHint) { if (!restart) { res = mStreamingProcessor->updatePreviewRequest(params); Loading services/camera/libcameraservice/api1/client2/CaptureSequencer.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -553,6 +553,12 @@ CaptureSequencer::CaptureState CaptureSequencer::manageStandardCapture( return DONE; } if (l.mParameters.isDeviceZslSupported) { // If device ZSL is supported, drop all pending preview buffers to reduce the chance of // rendering preview frames newer than the still frame. client->getCameraDevice()->dropStreamBuffers(true, client->getPreviewStreamId()); } /** * Clear the streaming request for still-capture pictures * (as opposed to i.e. video snapshots) Loading services/camera/libcameraservice/common/CameraDeviceBase.h +5 −0 Original line number Diff line number Diff line Loading @@ -349,6 +349,11 @@ class CameraDeviceBase : public virtual RefBase { virtual status_t setConsumerSurfaces(int streamId, const std::vector<sp<Surface>>& consumers) = 0; /** * Drop buffers for stream of streamId if dropping is true. If dropping is false, do not * drop buffers for stream of streamId. */ virtual status_t dropStreamBuffers(bool /*dropping*/, int /*streamId*/) = 0; }; }; // namespace android Loading services/camera/libcameraservice/device3/Camera3Device.cpp +14 −0 Original line number Diff line number Diff line Loading @@ -1977,6 +1977,20 @@ status_t Camera3Device::setConsumerSurfaces(int streamId, return OK; } status_t Camera3Device::dropStreamBuffers(bool dropping, int streamId) { Mutex::Autolock il(mInterfaceLock); Mutex::Autolock l(mLock); int idx = mOutputStreams.indexOfKey(streamId); if (idx == NAME_NOT_FOUND) { ALOGE("%s: Stream %d is not found.", __FUNCTION__, streamId); return BAD_VALUE; } sp<Camera3OutputStreamInterface> stream = mOutputStreams.editValueAt(idx); return stream->dropBuffers(dropping); } /** * Camera3Device private methods */ Loading services/camera/libcameraservice/device3/Camera3Device.h +6 −0 Original line number Diff line number Diff line Loading @@ -178,6 +178,12 @@ class Camera3Device : */ status_t setConsumerSurfaces(int streamId, const std::vector<sp<Surface>>& consumers) override; /** * Drop buffers for stream of streamId if dropping is true. If dropping is false, do not * drop buffers for stream of streamId. */ status_t dropStreamBuffers(bool dropping, int streamId) override; private: // internal typedefs Loading Loading
services/camera/libcameraservice/api1/Camera2Client.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -859,6 +859,12 @@ status_t Camera2Client::startPreviewL(Parameters ¶ms, bool restart) { outputStreams.push(getPreviewStreamId()); if (params.isDeviceZslSupported) { // If device ZSL is supported, resume preview buffers that may be paused // during last takePicture(). mDevice->dropStreamBuffers(false, getPreviewStreamId()); } if (!params.recordingHint) { if (!restart) { res = mStreamingProcessor->updatePreviewRequest(params); Loading
services/camera/libcameraservice/api1/client2/CaptureSequencer.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -553,6 +553,12 @@ CaptureSequencer::CaptureState CaptureSequencer::manageStandardCapture( return DONE; } if (l.mParameters.isDeviceZslSupported) { // If device ZSL is supported, drop all pending preview buffers to reduce the chance of // rendering preview frames newer than the still frame. client->getCameraDevice()->dropStreamBuffers(true, client->getPreviewStreamId()); } /** * Clear the streaming request for still-capture pictures * (as opposed to i.e. video snapshots) Loading
services/camera/libcameraservice/common/CameraDeviceBase.h +5 −0 Original line number Diff line number Diff line Loading @@ -349,6 +349,11 @@ class CameraDeviceBase : public virtual RefBase { virtual status_t setConsumerSurfaces(int streamId, const std::vector<sp<Surface>>& consumers) = 0; /** * Drop buffers for stream of streamId if dropping is true. If dropping is false, do not * drop buffers for stream of streamId. */ virtual status_t dropStreamBuffers(bool /*dropping*/, int /*streamId*/) = 0; }; }; // namespace android Loading
services/camera/libcameraservice/device3/Camera3Device.cpp +14 −0 Original line number Diff line number Diff line Loading @@ -1977,6 +1977,20 @@ status_t Camera3Device::setConsumerSurfaces(int streamId, return OK; } status_t Camera3Device::dropStreamBuffers(bool dropping, int streamId) { Mutex::Autolock il(mInterfaceLock); Mutex::Autolock l(mLock); int idx = mOutputStreams.indexOfKey(streamId); if (idx == NAME_NOT_FOUND) { ALOGE("%s: Stream %d is not found.", __FUNCTION__, streamId); return BAD_VALUE; } sp<Camera3OutputStreamInterface> stream = mOutputStreams.editValueAt(idx); return stream->dropBuffers(dropping); } /** * Camera3Device private methods */ Loading
services/camera/libcameraservice/device3/Camera3Device.h +6 −0 Original line number Diff line number Diff line Loading @@ -178,6 +178,12 @@ class Camera3Device : */ status_t setConsumerSurfaces(int streamId, const std::vector<sp<Surface>>& consumers) override; /** * Drop buffers for stream of streamId if dropping is true. If dropping is false, do not * drop buffers for stream of streamId. */ status_t dropStreamBuffers(bool dropping, int streamId) override; private: // internal typedefs Loading