blob: ad03b534e7bd6b718cfb4b1708c5d615653e6789 [file] [log] [blame]
Eino-Ville Talvalafd58f1a2013-03-06 16:20:06 -08001/*
Shuzhen Wangc28189a2017-11-27 23:05:10 -08002 * Copyright (C) 2013-2018 The Android Open Source Project
Eino-Ville Talvalafd58f1a2013-03-06 16:20:06 -08003 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef ANDROID_SERVERS_CAMERA3_OUTPUT_STREAM_H
18#define ANDROID_SERVERS_CAMERA3_OUTPUT_STREAM_H
19
Yin-Chia Yeh14ef48d2020-02-10 15:06:37 -080020#include <mutex>
Eino-Ville Talvalafd58f1a2013-03-06 16:20:06 -080021#include <utils/RefBase.h>
Zhijun He125684a2015-12-26 15:07:30 -080022#include <gui/IProducerListener.h>
Eino-Ville Talvalafd58f1a2013-03-06 16:20:06 -080023#include <gui/Surface.h>
24
Shuzhen Wang686f6442017-06-20 16:16:04 -070025#include "utils/LatencyHistogram.h"
Eino-Ville Talvalafd58f1a2013-03-06 16:20:06 -080026#include "Camera3Stream.h"
Igor Murashkine3a9f962013-05-08 18:03:15 -070027#include "Camera3IOStreamBase.h"
Igor Murashkin2fba5842013-04-22 14:03:54 -070028#include "Camera3OutputStreamInterface.h"
Zhijun He125684a2015-12-26 15:07:30 -080029#include "Camera3BufferManager.h"
Eino-Ville Talvalafd58f1a2013-03-06 16:20:06 -080030
31namespace android {
32
33namespace camera3 {
34
Zhijun He125684a2015-12-26 15:07:30 -080035class Camera3BufferManager;
36
37/**
38 * Stream info structure that holds the necessary stream info for buffer manager to use for
39 * buffer allocation and management.
40 */
41struct StreamInfo {
42 int streamId;
43 int streamSetId;
44 uint32_t width;
45 uint32_t height;
46 uint32_t format;
47 android_dataspace dataSpace;
Emilian Peev050f5dc2017-05-18 14:43:56 +010048 uint64_t combinedUsage;
Zhijun He125684a2015-12-26 15:07:30 -080049 size_t totalBufferCount;
50 bool isConfigured;
Shuzhen Wang83bff122020-11-20 15:51:39 -080051 bool isMultiRes;
Chih-Hung Hsiehd19d9942016-08-29 14:21:14 -070052 explicit StreamInfo(int id = CAMERA3_STREAM_ID_INVALID,
Zhijun He125684a2015-12-26 15:07:30 -080053 int setId = CAMERA3_STREAM_SET_ID_INVALID,
54 uint32_t w = 0,
55 uint32_t h = 0,
56 uint32_t fmt = 0,
57 android_dataspace ds = HAL_DATASPACE_UNKNOWN,
Emilian Peev050f5dc2017-05-18 14:43:56 +010058 uint64_t usage = 0,
Zhijun He125684a2015-12-26 15:07:30 -080059 size_t bufferCount = 0,
Shuzhen Wang83bff122020-11-20 15:51:39 -080060 bool configured = false,
61 bool multiRes = false) :
Zhijun He125684a2015-12-26 15:07:30 -080062 streamId(id),
63 streamSetId(setId),
64 width(w),
65 height(h),
66 format(fmt),
67 dataSpace(ds),
68 combinedUsage(usage),
69 totalBufferCount(bufferCount),
Shuzhen Wang83bff122020-11-20 15:51:39 -080070 isConfigured(configured),
71 isMultiRes(multiRes) {}
Zhijun He125684a2015-12-26 15:07:30 -080072};
73
Eino-Ville Talvalafd58f1a2013-03-06 16:20:06 -080074/**
75 * A class for managing a single stream of output data from the camera device.
76 */
Igor Murashkin2fba5842013-04-22 14:03:54 -070077class Camera3OutputStream :
Igor Murashkine3a9f962013-05-08 18:03:15 -070078 public Camera3IOStreamBase,
Igor Murashkin2fba5842013-04-22 14:03:54 -070079 public Camera3OutputStreamInterface {
Eino-Ville Talvalafd58f1a2013-03-06 16:20:06 -080080 public:
81 /**
82 * Set up a stream for formats that have 2 dimensions, such as RAW and YUV.
Zhijun He125684a2015-12-26 15:07:30 -080083 * A valid stream set id needs to be set to support buffer sharing between multiple
84 * streams.
Eino-Ville Talvalafd58f1a2013-03-06 16:20:06 -080085 */
Eino-Ville Talvala727d1722015-06-09 13:44:19 -070086 Camera3OutputStream(int id, sp<Surface> consumer,
Eino-Ville Talvala3d82c0d2015-02-23 15:19:19 -080087 uint32_t width, uint32_t height, int format,
Emilian Peevf4816702020-04-03 15:44:51 -070088 android_dataspace dataSpace, camera_stream_rotation_t rotation,
Shuzhen Wangc28189a2017-11-27 23:05:10 -080089 nsecs_t timestampOffset, const String8& physicalCameraId,
Jayant Chowdhary13f9b2f2020-12-02 22:46:15 -080090 const std::unordered_set<int32_t> &sensorPixelModesUsed,
Shuzhen Wang83bff122020-11-20 15:51:39 -080091 int setId = CAMERA3_STREAM_SET_ID_INVALID, bool isMultiResolution = false);
Eino-Ville Talvalafd58f1a2013-03-06 16:20:06 -080092 /**
93 * Set up a stream for formats that have a variable buffer size for the same
94 * dimensions, such as compressed JPEG.
Zhijun He125684a2015-12-26 15:07:30 -080095 * A valid stream set id needs to be set to support buffer sharing between multiple
96 * streams.
Eino-Ville Talvalafd58f1a2013-03-06 16:20:06 -080097 */
Eino-Ville Talvala727d1722015-06-09 13:44:19 -070098 Camera3OutputStream(int id, sp<Surface> consumer,
Eino-Ville Talvala3d82c0d2015-02-23 15:19:19 -080099 uint32_t width, uint32_t height, size_t maxSize, int format,
Emilian Peevf4816702020-04-03 15:44:51 -0700100 android_dataspace dataSpace, camera_stream_rotation_t rotation,
Shuzhen Wangc28189a2017-11-27 23:05:10 -0800101 nsecs_t timestampOffset, const String8& physicalCameraId,
Jayant Chowdhary13f9b2f2020-12-02 22:46:15 -0800102 const std::unordered_set<int32_t> &sensorPixelModesUsed,
Shuzhen Wang83bff122020-11-20 15:51:39 -0800103 int setId = CAMERA3_STREAM_SET_ID_INVALID, bool isMultiResolution = false);
Zhijun He5d677d12016-05-29 16:52:39 -0700104 /**
105 * Set up a stream with deferred consumer for formats that have 2 dimensions, such as
106 * RAW and YUV. The consumer must be set before using this stream for output. A valid
107 * stream set id needs to be set to support buffer sharing between multiple streams.
108 */
109 Camera3OutputStream(int id, uint32_t width, uint32_t height, int format,
Emilian Peev050f5dc2017-05-18 14:43:56 +0100110 uint64_t consumerUsage, android_dataspace dataSpace,
Emilian Peevf4816702020-04-03 15:44:51 -0700111 camera_stream_rotation_t rotation, nsecs_t timestampOffset,
Shuzhen Wangc28189a2017-11-27 23:05:10 -0800112 const String8& physicalCameraId,
Jayant Chowdhary13f9b2f2020-12-02 22:46:15 -0800113 const std::unordered_set<int32_t> &sensorPixelModesUsed,
Shuzhen Wang83bff122020-11-20 15:51:39 -0800114 int setId = CAMERA3_STREAM_SET_ID_INVALID, bool isMultiResolution = false);
Zhijun He5d677d12016-05-29 16:52:39 -0700115
Eino-Ville Talvalafd58f1a2013-03-06 16:20:06 -0800116 virtual ~Camera3OutputStream();
117
118 /**
119 * Camera3Stream interface
120 */
121
Eino-Ville Talvalafd58f1a2013-03-06 16:20:06 -0800122 virtual void dump(int fd, const Vector<String16> &args) const;
123
124 /**
125 * Set the transform on the output stream; one of the
126 * HAL_TRANSFORM_* / NATIVE_WINDOW_TRANSFORM_* constants.
127 */
128 status_t setTransform(int transform);
129
Chien-Yu Chen85a64552015-08-28 15:46:12 -0700130 /**
131 * Return if this output stream is for video encoding.
132 */
133 bool isVideoStream() const;
Shuzhen Wang13a69632016-01-26 09:51:07 -0800134 /**
135 * Return if this output stream is consumed by hardware composer.
136 */
137 bool isConsumedByHWComposer() const;
Chien-Yu Chen85a64552015-08-28 15:46:12 -0700138
Zhijun He5d677d12016-05-29 16:52:39 -0700139 /**
Zhijun Hef0645c12016-08-02 00:58:11 -0700140 * Return if this output stream is consumed by hardware texture.
141 */
142 bool isConsumedByHWTexture() const;
143
144 /**
Zhijun He5d677d12016-05-29 16:52:39 -0700145 * Return if the consumer configuration of this stream is deferred.
146 */
Shuzhen Wang0129d522016-10-30 22:43:41 -0700147 virtual bool isConsumerConfigurationDeferred(size_t surface_id) const;
Zhijun He5d677d12016-05-29 16:52:39 -0700148
149 /**
Shuzhen Wang758c2152017-01-10 18:26:18 -0800150 * Set the consumer surfaces to the output stream.
Zhijun He5d677d12016-05-29 16:52:39 -0700151 */
Shuzhen Wang758c2152017-01-10 18:26:18 -0800152 virtual status_t setConsumers(const std::vector<sp<Surface>>& consumers);
Zhijun He5d677d12016-05-29 16:52:39 -0700153
Shuzhen Wang0160ddd2019-08-15 09:11:56 -0700154 class BufferProducerListener : public SurfaceListener {
Zhijun He125684a2015-12-26 15:07:30 -0800155 public:
Shuzhen Wang0160ddd2019-08-15 09:11:56 -0700156 BufferProducerListener(wp<Camera3OutputStream> parent, bool needsReleaseNotify)
157 : mParent(parent), mNeedsReleaseNotify(needsReleaseNotify) {}
Zhijun He125684a2015-12-26 15:07:30 -0800158
Shuzhen Wang0160ddd2019-08-15 09:11:56 -0700159 /**
160 * Implementation of IProducerListener, used to notify this stream that the consumer
161 * has returned a buffer and it is ready to return to Camera3BufferManager for reuse.
162 */
163 virtual void onBufferReleased();
164 virtual bool needsReleaseNotify() { return mNeedsReleaseNotify; }
165 virtual void onBuffersDiscarded(const std::vector<sp<GraphicBuffer>>& buffers);
Zhijun He125684a2015-12-26 15:07:30 -0800166
167 private:
Shuzhen Wang0160ddd2019-08-15 09:11:56 -0700168 wp<Camera3OutputStream> mParent;
169 bool mNeedsReleaseNotify;
Zhijun He125684a2015-12-26 15:07:30 -0800170 };
171
Eino-Ville Talvala77c1a352016-06-13 12:32:43 -0700172 virtual status_t detachBuffer(sp<GraphicBuffer>* buffer, int* fenceFd);
173
Shuzhen Wangbee0f0a2017-01-24 14:51:37 -0800174 /**
175 * Notify that the buffer is being released to the buffer queue instead of
176 * being queued to the consumer.
177 */
178 virtual status_t notifyBufferReleased(ANativeWindowBuffer *anwBuffer);
Shuzhen Wang0129d522016-10-30 22:43:41 -0700179
Zhijun He125684a2015-12-26 15:07:30 -0800180 /**
Chien-Yu Chena936ac22017-10-23 15:59:49 -0700181 * Drop buffers if dropping is true. If dropping is false, do not drop buffers.
182 */
183 virtual status_t dropBuffers(bool dropping) override;
184
185 /**
Shuzhen Wang5c22c152017-12-31 17:12:25 -0800186 * Query the physical camera id for the output stream.
187 */
188 virtual const String8& getPhysicalCameraId() const override;
189
190 /**
Zhijun He125684a2015-12-26 15:07:30 -0800191 * Set the graphic buffer manager to get/return the stream buffers.
192 *
193 * It is only legal to call this method when stream is in STATE_CONSTRUCTED state.
194 */
195 status_t setBufferManager(sp<Camera3BufferManager> bufferManager);
196
Emilian Peev40ead602017-09-26 15:46:36 +0100197 /**
198 * Query the ouput surface id.
199 */
200 virtual ssize_t getSurfaceId(const sp<Surface> &/*surface*/) { return 0; }
201
Yin-Chia Yeh58b1b4e2018-10-15 12:18:36 -0700202 virtual status_t getUniqueSurfaceIds(const std::vector<size_t>&,
203 /*out*/std::vector<size_t>*) { return INVALID_OPERATION; };
204
Emilian Peev40ead602017-09-26 15:46:36 +0100205 /**
206 * Update the stream output surfaces.
207 */
208 virtual status_t updateStream(const std::vector<sp<Surface>> &outputSurfaces,
209 const std::vector<OutputStreamInfo> &outputInfo,
210 const std::vector<size_t> &removedSurfaceIds,
211 KeyedVector<sp<Surface>, size_t> *outputMap/*out*/);
212
Emilian Peev35ae8262018-11-08 13:11:32 +0000213 /**
Yin-Chia Yeh14ef48d2020-02-10 15:06:37 -0800214 * Set the batch size for buffer operations. The output stream will request
215 * buffers from buffer queue on a batch basis. Currently only video streams
216 * are allowed to set the batch size. Also if the stream is managed by
217 * buffer manager (Surface group in Java API) then batching is also not
218 * supported. Changing batch size on the fly while there is already batched
219 * buffers in the stream is also not supported.
220 * If the batch size is larger than the max dequeue count set
221 * by the camera HAL, the batch size will be set to the max dequeue count
222 * instead.
223 */
224 virtual status_t setBatchSize(size_t batchSize = 1) override;
225
226 /**
Emilian Peev35ae8262018-11-08 13:11:32 +0000227 * Apply ZSL related consumer usage quirk.
228 */
229 static void applyZSLUsageQuirk(int format, uint64_t *consumerUsage /*inout*/);
230
Shuzhen Wangabbcb6b2020-12-09 22:32:44 -0800231 void setImageDumpMask(int mask) { mImageDumpMask = mask; }
232
Igor Murashkine3a9f962013-05-08 18:03:15 -0700233 protected:
Emilian Peevf4816702020-04-03 15:44:51 -0700234 Camera3OutputStream(int id, camera_stream_type_t type,
Eino-Ville Talvala3d82c0d2015-02-23 15:19:19 -0800235 uint32_t width, uint32_t height, int format,
Emilian Peevf4816702020-04-03 15:44:51 -0700236 android_dataspace dataSpace, camera_stream_rotation_t rotation,
Shuzhen Wangc28189a2017-11-27 23:05:10 -0800237 const String8& physicalCameraId,
Jayant Chowdhary13f9b2f2020-12-02 22:46:15 -0800238 const std::unordered_set<int32_t> &sensorPixelModesUsed,
Emilian Peev050f5dc2017-05-18 14:43:56 +0100239 uint64_t consumerUsage = 0, nsecs_t timestampOffset = 0,
Shuzhen Wang83bff122020-11-20 15:51:39 -0800240 int setId = CAMERA3_STREAM_SET_ID_INVALID, bool isMultiResolution = false);
Igor Murashkine3a9f962013-05-08 18:03:15 -0700241
Zhijun He124ccf42013-05-22 14:01:30 -0700242 /**
243 * Note that we release the lock briefly in this function
244 */
Igor Murashkine3a9f962013-05-08 18:03:15 -0700245 virtual status_t returnBufferCheckedLocked(
Emilian Peevf4816702020-04-03 15:44:51 -0700246 const camera_stream_buffer &buffer,
Igor Murashkine3a9f962013-05-08 18:03:15 -0700247 nsecs_t timestamp,
248 bool output,
Yin-Chia Yeh58b1b4e2018-10-15 12:18:36 -0700249 const std::vector<size_t>& surface_ids,
Igor Murashkine3a9f962013-05-08 18:03:15 -0700250 /*out*/
251 sp<Fence> *releaseFenceOut);
252
Zhijun He0a210512014-07-24 13:45:15 -0700253 virtual status_t disconnectLocked();
254
Emilian Peev050f5dc2017-05-18 14:43:56 +0100255 status_t getEndpointUsageForSurface(uint64_t *usage,
Shuzhen Wang0129d522016-10-30 22:43:41 -0700256 const sp<Surface>& surface) const;
257 status_t configureConsumerQueueLocked();
258
259 // Consumer as the output of camera HAL
Eino-Ville Talvala727d1722015-06-09 13:44:19 -0700260 sp<Surface> mConsumer;
Zhijun He5d677d12016-05-29 16:52:39 -0700261
Emilian Peev050f5dc2017-05-18 14:43:56 +0100262 uint64_t getPresetConsumerUsage() const { return mConsumerUsage; }
Zhijun Hef0645c12016-08-02 00:58:11 -0700263
264 static const nsecs_t kDequeueBufferTimeout = 1000000000; // 1 sec
265
Shuzhen Wangbee0f0a2017-01-24 14:51:37 -0800266 status_t getBufferLockedCommon(ANativeWindowBuffer** anb, int* fenceFd);
267
268
Shuzhen Wang0129d522016-10-30 22:43:41 -0700269 private:
270
Eino-Ville Talvalafd58f1a2013-03-06 16:20:06 -0800271 int mTransform;
Eino-Ville Talvalafd58f1a2013-03-06 16:20:06 -0800272
Igor Murashkine3a9f962013-05-08 18:03:15 -0700273 virtual status_t setTransformLocked(int transform);
Eino-Ville Talvalafd58f1a2013-03-06 16:20:06 -0800274
Ruchit Sharmae0711f22014-08-18 13:48:24 -0400275 bool mTraceFirstBuffer;
276
Eino-Ville Talvala727d1722015-06-09 13:44:19 -0700277 // Name of Surface consumer
278 String8 mConsumerName;
279
Shuzhen Wangc28dccc2016-02-11 23:48:46 -0800280 // Whether consumer assumes MONOTONIC timestamp
281 bool mUseMonoTimestamp;
Shuzhen Wang13a69632016-01-26 09:51:07 -0800282
Eino-Ville Talvalafd58f1a2013-03-06 16:20:06 -0800283 /**
Zhijun He125684a2015-12-26 15:07:30 -0800284 * GraphicBuffer manager this stream is registered to. Used to replace the buffer
285 * allocation/deallocation role of BufferQueue.
286 */
287 sp<Camera3BufferManager> mBufferManager;
288
289 /**
Shuzhen Wang0160ddd2019-08-15 09:11:56 -0700290 * Buffer producer listener, used to handle notification when a buffer is released
291 * from consumer side, or a set of buffers are discarded by the consumer.
Zhijun He125684a2015-12-26 15:07:30 -0800292 */
Shuzhen Wang0160ddd2019-08-15 09:11:56 -0700293 sp<BufferProducerListener> mBufferProducerListener;
Zhijun He125684a2015-12-26 15:07:30 -0800294
295 /**
296 * Flag indicating if the buffer manager is used to allocate the stream buffers
297 */
298 bool mUseBufferManager;
Shuzhen Wangc28dccc2016-02-11 23:48:46 -0800299
300 /**
301 * Timestamp offset for video and hardware composer consumed streams
302 */
303 nsecs_t mTimestampOffset;
304
Zhijun He125684a2015-12-26 15:07:30 -0800305 /**
Zhijun He5d677d12016-05-29 16:52:39 -0700306 * Consumer end point usage flag set by the constructor for the deferred
307 * consumer case.
308 */
Emilian Peev050f5dc2017-05-18 14:43:56 +0100309 uint64_t mConsumerUsage;
Zhijun He5d677d12016-05-29 16:52:39 -0700310
Chien-Yu Chena936ac22017-10-23 15:59:49 -0700311 // Whether to drop valid buffers.
312 bool mDropBuffers;
313
Yin-Chia Yeh14ef48d2020-02-10 15:06:37 -0800314
Yin-Chia Yeh14ef48d2020-02-10 15:06:37 -0800315
316 // The batch size for buffer operation
Shuzhen Wangc7629462021-07-12 15:02:58 -0700317 std::atomic_size_t mBatchSize = 1;
Yin-Chia Yeh14ef48d2020-02-10 15:06:37 -0800318
Shuzhen Wangc7629462021-07-12 15:02:58 -0700319 // Protecting batch states below, must be acquired after mLock
320 std::mutex mBatchLock;
Yin-Chia Yeh14ef48d2020-02-10 15:06:37 -0800321 // Prefetched buffers (ready to be handed to client)
322 std::vector<Surface::BatchBuffer> mBatchedBuffers;
Yin-Chia Yeh14ef48d2020-02-10 15:06:37 -0800323 // ---- End of mBatchLock protected scope ----
324
Zhijun He5d677d12016-05-29 16:52:39 -0700325 /**
Eino-Ville Talvalafd58f1a2013-03-06 16:20:06 -0800326 * Internal Camera3Stream interface
327 */
Emilian Peevf4816702020-04-03 15:44:51 -0700328 virtual status_t getBufferLocked(camera_stream_buffer *buffer,
Shuzhen Wangbee0f0a2017-01-24 14:51:37 -0800329 const std::vector<size_t>& surface_ids);
330
Yin-Chia Yeh14ef48d2020-02-10 15:06:37 -0800331 virtual status_t getBuffersLocked(/*out*/std::vector<OutstandingBuffer>* buffers) override;
332
Eino-Ville Talvalafd58f1a2013-03-06 16:20:06 -0800333 virtual status_t returnBufferLocked(
Emilian Peevf4816702020-04-03 15:44:51 -0700334 const camera_stream_buffer &buffer,
Yin-Chia Yeh58b1b4e2018-10-15 12:18:36 -0700335 nsecs_t timestamp, const std::vector<size_t>& surface_ids);
Eino-Ville Talvalafd58f1a2013-03-06 16:20:06 -0800336
Shuzhen Wangbee0f0a2017-01-24 14:51:37 -0800337 virtual status_t queueBufferToConsumer(sp<ANativeWindow>& consumer,
Yin-Chia Yeh58b1b4e2018-10-15 12:18:36 -0700338 ANativeWindowBuffer* buffer, int anwReleaseFence,
339 const std::vector<size_t>& surface_ids);
Shuzhen Wangbee0f0a2017-01-24 14:51:37 -0800340
Eino-Ville Talvalafd58f1a2013-03-06 16:20:06 -0800341 virtual status_t configureQueueLocked();
Eino-Ville Talvalab2f5b192013-07-30 14:36:03 -0700342
Emilian Peev050f5dc2017-05-18 14:43:56 +0100343 virtual status_t getEndpointUsage(uint64_t *usage) const;
Eino-Ville Talvalab2f5b192013-07-30 14:36:03 -0700344
Yin-Chia Yeh89954d92017-05-21 17:28:53 -0700345 /**
346 * Private methods
347 */
Yin-Chia Yeh017d49c2017-03-31 19:11:00 -0700348 void onBuffersRemovedLocked(const std::vector<sp<GraphicBuffer>>&);
Yin-Chia Yeh89954d92017-05-21 17:28:53 -0700349 status_t detachBufferLocked(sp<GraphicBuffer>* buffer, int* fenceFd);
Yin-Chia Yehbf1b8b92019-03-06 14:56:08 -0800350 // Call this after each dequeueBuffer/attachBuffer/detachNextBuffer call to get update on
351 // removed buffers. Set notifyBufferManager to false when the call is initiated by buffer
352 // manager so buffer manager doesn't need to be notified.
353 void checkRemovedBuffersLocked(bool notifyBufferManager = true);
354
355 // Check return status of IGBP calls and set abandoned state accordingly
356 void checkRetAndSetAbandonedLocked(status_t res);
Yin-Chia Yeh017d49c2017-03-31 19:11:00 -0700357
Yin-Chia Yeha1b56c82019-03-27 15:50:39 -0700358 // If the status indicates abandonded stream, only log when state hasn't been updated to
359 // STATE_ABANDONED
360 static bool shouldLogError(status_t res, StreamState state);
361
Shuzhen Wangabbcb6b2020-12-09 22:32:44 -0800362 // Dump images to disk before returning to consumer
363 void dumpImageToDisk(nsecs_t timestamp, ANativeWindowBuffer* anwBuffer, int fence);
364
Yin-Chia Yeh14ef48d2020-02-10 15:06:37 -0800365 void returnPrefetchedBuffersLocked();
366
Shuzhen Wang686f6442017-06-20 16:16:04 -0700367 static const int32_t kDequeueLatencyBinSize = 5; // in ms
368 CameraLatencyHistogram mDequeueBufferLatency;
369
Shuzhen Wangabbcb6b2020-12-09 22:32:44 -0800370 int mImageDumpMask = 0;
371
Eino-Ville Talvalafd58f1a2013-03-06 16:20:06 -0800372}; // class Camera3OutputStream
373
374} // namespace camera3
375
376} // namespace android
377
378#endif