xref: /aosp_15_r20/frameworks/av/services/camera/libcameraservice/device3/Camera3Stream.h (revision ec779b8e0859a360c3d303172224686826e6e0e1)
1 /*
2  * Copyright (C) 2013-2018 The Android Open Source Project
3  *
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_STREAM_H
18 #define ANDROID_SERVERS_CAMERA3_STREAM_H
19 
20 #include <gui/Flags.h>
21 #include <gui/Surface.h>
22 #include <utils/RefBase.h>
23 #include <utils/String16.h>
24 #include <utils/List.h>
25 
26 #include "utils/LatencyHistogram.h"
27 #include "Camera3StreamBufferListener.h"
28 #include "Camera3StreamInterface.h"
29 
30 namespace android {
31 
32 namespace camera3 {
33 
34 /**
35  * A class for managing a single stream of input or output data from the camera
36  * device.
37  *
38  * The stream has an internal state machine to track whether it's
39  * connected/configured/etc.
40  *
41  * States:
42  *
43  *  STATE_ERROR: A serious error has occurred, stream is unusable. Outstanding
44  *    buffers may still be returned.
45  *
46  *  STATE_CONSTRUCTED: The stream is ready for configuration, but buffers cannot
47  *    be gotten yet. Not connected to any endpoint, no buffers are registered
48  *    with the HAL.
49  *
50  *  STATE_IN_CONFIG: Configuration has started, but not yet concluded. During this
51  *    time, the usage, max_buffers, and priv fields of camera_stream returned by
52  *    startConfiguration() may be modified.
53  *
54  *  STATE_IN_RE_CONFIG: Configuration has started, and the stream has been
55  *    configured before. Need to track separately from IN_CONFIG to avoid
56  *    re-registering buffers with HAL.
57  *
58  *  STATE_CONFIGURED: Stream is configured, and has registered buffers with the
59  *    HAL (if necessary). The stream's getBuffer/returnBuffer work. The priv
60  *    pointer may still be modified.
61  *
62  *  STATE_PREPARING: The stream's buffers are being pre-allocated for use.  On
63  *    older HALs, this is done as part of configuration, but in newer HALs
64  *    buffers may be allocated at time of first use. But some use cases require
65  *    buffer allocation upfront, to minmize disruption due to lengthy allocation
66  *    duration.  In this state, only prepareNextBuffer() and cancelPrepare()
67  *    may be called.
68  *
69  *  STATE_IN_IDLE: This is a temporary state only intended to be used for input
70  *    streams and only for the case where we need to re-configure the camera device
71  *    while the input stream has an outstanding buffer. All other streams should not
72  *    be able to switch to this state. For them this is invalid and should be handled
73  *    as an unknown state.
74  *
75  * Transition table:
76  *
77  *    <none>               => STATE_CONSTRUCTED:
78  *        When constructed with valid arguments
79  *    <none>               => STATE_ERROR:
80  *        When constructed with invalid arguments
81  *    STATE_CONSTRUCTED    => STATE_IN_CONFIG:
82  *        When startConfiguration() is called
83  *    STATE_IN_CONFIG      => STATE_CONFIGURED:
84  *        When finishConfiguration() is called
85  *    STATE_IN_CONFIG      => STATE_ERROR:
86  *        When finishConfiguration() fails to allocate or register buffers.
87  *    STATE_CONFIGURED     => STATE_IN_RE_CONFIG:  *
88  *        When startConfiguration() is called again, after making sure stream is
89  *        idle with waitUntilIdle().
90  *    STATE_IN_RE_CONFIG   => STATE_CONFIGURED:
91  *        When finishConfiguration() is called.
92  *    STATE_IN_RE_CONFIG   => STATE_ERROR:
93  *        When finishConfiguration() fails to allocate or register buffers.
94  *    STATE_CONFIGURED     => STATE_CONSTRUCTED:
95  *        When disconnect() is called after making sure stream is idle with
96  *        waitUntilIdle().
97  *    STATE_CONFIGURED     => STATE_PREPARING:
98  *        When startPrepare is called before the stream has a buffer
99  *        queued back into it for the first time.
100  *    STATE_PREPARING      => STATE_CONFIGURED:
101  *        When sufficient prepareNextBuffer calls have been made to allocate
102  *        all stream buffers, or cancelPrepare is called.
103  *    STATE_CONFIGURED     => STATE_ABANDONED:
104  *        When the buffer queue of the stream is abandoned.
105  *    STATE_CONFIGURED     => STATE_IN_IDLE:
106  *        Only for an input stream which has an outstanding buffer.
107  *    STATE_IN_IDLE     => STATE_CONFIGURED:
108  *        After the internal re-configuration, the input should revert back to
109  *        the configured state.
110  *
111  * Status Tracking:
112  *    Each stream is tracked by StatusTracker as a separate component,
113  *    depending on the handed out buffer count. The state must be STATE_CONFIGURED
114  *    in order for the component to be marked.
115  *
116  *    It's marked in one of two ways:
117  *
118  *    - ACTIVE: One or more buffers have been handed out (with #getBuffer).
119  *    - IDLE: All buffers have been returned (with #returnBuffer), and their
120  *          respective release_fence(s) have been signaled. The only exception to this
121  *          rule is an input stream that moves to "STATE_IN_IDLE" during internal
122  *          re-configuration.
123  *
124  *    A typical use case is output streams. When the HAL has any buffers
125  *    dequeued, the stream is marked ACTIVE. When the HAL returns all buffers
126  *    (e.g. if no capture requests are active), the stream is marked IDLE.
127  *    In this use case, the app consumer does not affect the component status.
128  *
129  */
130 class Camera3Stream :
131         protected camera_stream,
132         public virtual Camera3StreamInterface,
133         public virtual RefBase {
134   public:
135 
136     virtual ~Camera3Stream();
137 
138     static Camera3Stream*       cast(camera_stream *stream);
139     static const Camera3Stream* cast(const camera_stream *stream);
140 
141     // Queue corresponding HDR metadata to given native window.
142     static void queueHDRMetadata(buffer_handle_t buffer, sp<ANativeWindow>& anw,
143             int64_t dynamicRangeProfile);
144 
145     /**
146      * Get the stream's ID
147      */
148     int              getId() const;
149 
150     /**
151      * Get the output stream set id.
152      */
153     int              getStreamSetId() const;
154     /**
155      * Is this stream part of a multi-resolution stream set
156      */
157     bool             isMultiResolution() const;
158     /**
159      * Get the HAL stream group id for a multi-resolution stream set
160      */
161     int              getHalStreamGroupId() const;
162 
163     /**
164      * Get the stream's dimensions and format
165      */
166     uint32_t           getWidth() const;
167     uint32_t           getHeight() const;
168     int                getFormat() const;
169     android_dataspace  getDataSpace() const;
170     int32_t            getColorSpace() const;
171     uint64_t           getUsage() const;
172     void               setUsage(uint64_t usage);
173     void               setFormatOverride(bool formatOverridden);
174     bool               isFormatOverridden() const;
175     int                getOriginalFormat() const;
176     int64_t            getDynamicRangeProfile() const;
177     void               setDataSpaceOverride(bool dataSpaceOverridden);
178     bool               isDataSpaceOverridden() const;
179     android_dataspace  getOriginalDataSpace() const;
180     int                getMaxHalBuffers() const;
181     const std::string& physicalCameraId() const;
182     int64_t            getStreamUseCase() const;
183     int                getTimestampBase() const;
184     bool               isDeviceTimeBaseRealtime() const;
185 
186     void              setOfflineProcessingSupport(bool) override;
187     bool              getOfflineProcessingSupport() const override;
188 
asHalStream()189     camera_stream*   asHalStream() override {
190         return this;
191     }
192 
193     /**
194      * Start the stream configuration process. Returns a handle to the stream's
195      * information to be passed into the HAL device's configure_streams call.
196      *
197      * Until finishConfiguration() is called, no other methods on the stream may be
198      * called. The usage and max_buffers fields of camera_stream may be modified
199      * between start/finishConfiguration, but may not be changed after that.
200      *
201      * Returns NULL in case of error starting configuration.
202      */
203     camera_stream*  startConfiguration();
204 
205     /**
206      * Check if the stream is mid-configuration (start has been called, but not
207      * finish).  Used for lazy completion of configuration.
208      */
209     bool             isConfiguring() const;
210 
211     /**
212      * Completes the stream configuration process. The stream information
213      * structure returned by startConfiguration() may no longer be modified
214      * after this call, but can still be read until the destruction of the
215      * stream.
216      *
217      * streamReconfigured: set to true when a stream is being reconfigured.
218      *
219      * Returns:
220      *   OK on a successful configuration
221      *   NO_INIT in case of a serious error from the HAL device
222      *   NO_MEMORY in case of an error registering buffers
223      *   INVALID_OPERATION in case connecting to the consumer failed or consumer
224      *       doesn't exist yet.
225      */
226     status_t         finishConfiguration(/*out*/bool* streamReconfigured = nullptr);
227 
228     /**
229      * Cancels the stream configuration process. This returns the stream to the
230      * initial state, allowing it to be configured again later.
231      * This is done if the HAL rejects the proposed combined stream configuration
232      */
233     status_t         cancelConfiguration();
234 
235     /**
236      * Determine whether the stream has already become in-use (has received
237      * a valid filled buffer), which determines if a stream can still have
238      * prepareNextBuffer called on it.
239      */
240     bool             isUnpreparable();
241 
242     /**
243      * Mark the stream as unpreparable.
244      */
245     void             markUnpreparable() override;
246 
247     /**
248      * Start stream preparation. May only be called in the CONFIGURED state,
249      * when no valid buffers have yet been returned to this stream. Prepares
250      * up to maxCount buffers, or the maximum number of buffers needed by the
251      * pipeline if maxCount is ALLOCATE_PIPELINE_MAX.
252      *
253      * If no prepartion is necessary, returns OK and does not transition to
254      * PREPARING state. Otherwise, returns NOT_ENOUGH_DATA and transitions
255      * to PREPARING.
256      *
257      * This call performs no allocation, so is quick to call.
258      *
259      * blockRequest specifies whether prepare will block upcoming capture
260      * request. This flag should only be set to false if the caller guarantees
261      * the whole buffer preparation process is done before capture request
262      * comes in.
263      *
264      * Returns:
265      *    OK if no more buffers need to be preallocated
266      *    NOT_ENOUGH_DATA if calls to prepareNextBuffer are needed to finish
267      *        buffer pre-allocation, and transitions to the PREPARING state.
268      *    NO_INIT in case of a serious error from the HAL device
269      *    INVALID_OPERATION if called when not in CONFIGURED state, or a
270      *        valid buffer has already been returned to this stream.
271      */
272     status_t         startPrepare(int maxCount, bool blockRequest);
273 
274     /**
275      * Check if the request on a stream is blocked by prepare.
276      */
277     bool             isBlockedByPrepare() const;
278 
279     /**
280      * Continue stream buffer preparation by allocating the next
281      * buffer for this stream.  May only be called in the PREPARED state.
282      *
283      * Returns OK and transitions to the CONFIGURED state if all buffers
284      * are allocated after the call concludes. Otherwise returns NOT_ENOUGH_DATA.
285      *
286      * This call allocates one buffer, which may take several milliseconds for
287      * large buffers.
288      *
289      * Returns:
290      *    OK if no more buffers need to be preallocated, and transitions
291      *        to the CONFIGURED state.
292      *    NOT_ENOUGH_DATA if more calls to prepareNextBuffer are needed to finish
293      *        buffer pre-allocation.
294      *    NO_INIT in case of a serious error from the HAL device
295      *    INVALID_OPERATION if called when not in CONFIGURED state, or a
296      *        valid buffer has already been returned to this stream.
297      */
298     status_t         prepareNextBuffer();
299 
300     /**
301      * Cancel stream preparation early. In case allocation needs to be
302      * stopped, this method transitions the stream back to the CONFIGURED state.
303      * Buffers that have been allocated with prepareNextBuffer remain that way,
304      * but a later use of prepareNextBuffer will require just as many
305      * calls as if the earlier prepare attempt had not existed.
306      *
307      * Returns:
308      *    OK if cancellation succeeded, and transitions to the CONFIGURED state
309      *    INVALID_OPERATION if not in the PREPARING state
310      *    NO_INIT in case of a serious error from the HAL device
311      */
312     status_t        cancelPrepare();
313 
314     /**
315      * Tear down memory for this stream. This frees all unused gralloc buffers
316      * allocated for this stream, but leaves it ready for operation afterward.
317      *
318      * May only be called in the CONFIGURED state, and keeps the stream in
319      * the CONFIGURED state.
320      *
321      * Returns:
322      *    OK if teardown succeeded.
323      *    INVALID_OPERATION if not in the CONFIGURED state
324      *    NO_INIT in case of a serious error from the HAL device
325      */
326     status_t       tearDown();
327 
328     /**
329      * Fill in the camera_stream_buffer with the next valid buffer for this
330      * stream, to hand over to the HAL.
331      *
332      * Multiple surfaces could share the same HAL stream, but a request may
333      * be only for a subset of surfaces. In this case, the
334      * Camera3StreamInterface object needs the surface ID information to acquire
335      * buffers for those surfaces.
336      *
337      * This method may only be called once finishConfiguration has been called.
338      * For bidirectional streams, this method applies to the output-side
339      * buffers.
340      *
341      */
342     status_t         getBuffer(camera_stream_buffer *buffer,
343             nsecs_t waitBufferTimeout,
344             const std::vector<size_t>& surface_ids = std::vector<size_t>());
345 
346     /**
347      * Return a buffer to the stream after use by the HAL.
348      *
349      * Multiple surfaces could share the same HAL stream, but a request may
350      * be only for a subset of surfaces. In this case, the
351      * Camera3StreamInterface object needs the surface ID information to attach
352      * buffers for those surfaces.
353      *
354      * This method may only be called for buffers provided by getBuffer().
355      * For bidirectional streams, this method applies to the output-side buffers
356      */
357     status_t         returnBuffer(const camera_stream_buffer &buffer,
358             nsecs_t timestamp, nsecs_t readoutTimestamp, bool timestampIncreasing,
359             const std::vector<size_t>& surface_ids = std::vector<size_t>(),
360             uint64_t frameNumber = 0, int32_t transform = -1);
361 
362     /**
363      * Fill in the camera_stream_buffer with the next valid buffer for this
364      * stream, to hand over to the HAL.
365      *
366      * This method may only be called once finishConfiguration has been called.
367      * For bidirectional streams, this method applies to the input-side
368      * buffers.
369      *
370      * This method also returns the size of the returned input buffer.
371      *
372      * Normally this call will block until the handed out buffer count is less than the stream
373      * max buffer count; if respectHalLimit is set to false, this is ignored.
374      */
375     status_t         getInputBuffer(camera_stream_buffer *buffer,
376                              Size* size, bool respectHalLimit = true);
377 
378     /**
379      * Return a buffer to the stream after use by the HAL.
380      *
381      * This method may only be called for buffers provided by getBuffer().
382      * For bidirectional streams, this method applies to the input-side buffers
383      */
384     status_t         returnInputBuffer(const camera_stream_buffer &buffer);
385 
386 #if WB_CAMERA3_AND_PROCESSORS_WITH_DEPENDENCIES
387     status_t         getInputSurface(sp<Surface> *producer);
388 #else
389     // get the buffer producer of the input buffer queue.
390     // only apply to input streams.
391     status_t         getInputBufferProducer(sp<IGraphicBufferProducer> *producer);
392 #endif
393 
394     /**
395      * Whether any of the stream's buffers are currently in use by the HAL,
396      * including buffers that have been returned but not yet had their
397      * release fence signaled.
398      */
399     bool             hasOutstandingBuffers() const;
400 
401     /**
402      * Get number of buffers currently handed out to HAL
403      */
404     size_t           getOutstandingBuffersCount() const;
405 
406     enum {
407         TIMEOUT_NEVER = -1
408     };
409 
410     /**
411      * Set the status tracker to notify about idle transitions
412      */
413     virtual status_t setStatusTracker(sp<StatusTracker> statusTracker);
414 
415     /**
416      * Toggle the state of hal buffer manager
417      */
setHalBufferManager(bool)418     virtual void setHalBufferManager(bool /*enabled*/) {/* No-op */ }
419 
420     /**
421      * Disconnect stream from its non-HAL endpoint. After this,
422      * start/finishConfiguration must be called before the stream can be used
423      * again. This cannot be called if the stream has outstanding dequeued
424      * buffers.
425      */
426     status_t         disconnect();
427 
428     /**
429      * Debug dump of the stream's state.
430      */
431     virtual void     dump(int fd, const Vector<String16> &args);
432 
433     /**
434      * Add a camera3 buffer listener. Adding the same listener twice has
435      * no effect.
436      */
437     void             addBufferListener(
438             wp<Camera3StreamBufferListener> listener);
439 
440     /**
441      * Remove a camera3 buffer listener. Removing the same listener twice
442      * or the listener that was never added has no effect.
443      */
444     void             removeBufferListener(
445             const sp<Camera3StreamBufferListener>& listener);
446 
447 
448     // Setting listener will remove previous listener (if exists)
449     virtual void     setBufferFreedListener(
450             wp<Camera3StreamBufferFreedListener> listener) override;
451 
452     /**
453      * Return if the buffer queue of the stream is abandoned.
454      */
455     bool             isAbandoned() const;
456 
457     /**
458      * Switch a configured stream with possibly outstanding buffers in idle
459      * state. Configuration for such streams will be skipped assuming there
460      * are no changes to the stream parameters.
461      */
462     status_t         forceToIdle();
463 
464     /**
465      * Restore a forced idle stream to configured state, marking it active
466      * in case it contains outstanding buffers.
467      */
468     status_t         restoreConfiguredState();
469 
470     /**
471      * Notify buffer stream listeners about incoming request with particular frame number.
472      */
473     void fireBufferRequestForFrameNumber(uint64_t frameNumber,
474             const CameraMetadata& settings) override;
475 
476   protected:
477     const int mId;
478     /**
479      * Stream set id, used to indicate which group of this stream belongs to for buffer sharing
480      * across multiple streams.
481      *
482      * The default value is set to CAMERA3_STREAM_SET_ID_INVALID, which indicates that this stream
483      * doesn't intend to share buffers with any other streams, and this stream will fall back to
484      * the existing BufferQueue mechanism to manage the buffer allocations and buffer circulation.
485      * When a valid stream set id is set, this stream intends to use the Camera3BufferManager to
486      * manage the buffer allocations; the BufferQueue will only handle the buffer transaction
487      * between the producer and consumer. For this case, upon successfully registration, the streams
488      * with the same stream set id will potentially share the buffers allocated by
489      * Camera3BufferManager.
490      */
491     const int mSetId;
492 
493     const std::string mName;
494     // Zero for formats with fixed buffer size for given dimensions.
495     const size_t mMaxSize;
496 
497     enum StreamState {
498         STATE_ERROR,
499         STATE_CONSTRUCTED,
500         STATE_IN_CONFIG,
501         STATE_IN_RECONFIG,
502         STATE_CONFIGURED,
503         STATE_PREPARING,
504         STATE_ABANDONED,
505         STATE_IN_IDLE
506     } mState;
507 
508     mutable Mutex mLock;
509 
510     Camera3Stream(int id, camera_stream_type type,
511             uint32_t width, uint32_t height, size_t maxSize, int format,
512             android_dataspace dataSpace, camera_stream_rotation_t rotation,
513             const std::string& physicalCameraId,
514             const std::unordered_set<int32_t> &sensorPixelModesUsed,
515             int setId, bool isMultiResolution, int64_t dynamicRangeProfile,
516             int64_t streamUseCase, bool deviceTimeBaseIsRealtime, int timestampBase,
517             int32_t colorSpace);
518 
519     wp<Camera3StreamBufferFreedListener> mBufferFreedListener;
520 
521     /**
522      * Interface to be implemented by derived classes
523      */
524 
525     // getBuffer / returnBuffer implementations
526 
527     // Since camera_stream_buffer includes a raw pointer to the stream,
528     // cast to camera_stream*, implementations must increment the
529     // refcount of the stream manually in getBufferLocked, and decrement it in
530     // returnBufferLocked.
531     virtual status_t getBufferLocked(camera_stream_buffer *buffer,
532             const std::vector<size_t>& surface_ids = std::vector<size_t>());
533     virtual status_t returnBufferLocked(const camera_stream_buffer &buffer,
534             nsecs_t timestamp, nsecs_t readoutTimestamp, int32_t transform,
535             const std::vector<size_t>& surface_ids = std::vector<size_t>());
536 
537     virtual status_t getInputBufferLocked(camera_stream_buffer *buffer, Size* size);
538 
539     virtual status_t returnInputBufferLocked(
540             const camera_stream_buffer &buffer);
541     virtual bool     hasOutstandingBuffersLocked() const = 0;
542 #if WB_CAMERA3_AND_PROCESSORS_WITH_DEPENDENCIES
543     virtual status_t getInputSurfaceLocked(sp<Surface> *surface);
544 #else
545     // Get the buffer producer of the input buffer queue. Only apply to input streams.
546     virtual status_t getInputBufferProducerLocked(sp<IGraphicBufferProducer> *producer);
547 #endif
548 
549     // Can return -ENOTCONN when we are already disconnected (not an error)
550     virtual status_t disconnectLocked() = 0;
551 
552     // Configure the buffer queue interface to the other end of the stream,
553     // after the HAL has provided usage and max_buffers values. After this call,
554     // the stream must be ready to produce all buffers for registration with
555     // HAL.
556     // Returns NO_INIT or DEAD_OBJECT if the queue has been abandoned.
557     virtual status_t configureQueueLocked() = 0;
558 
559     // Get the total number of buffers in the queue
560     virtual size_t   getBufferCountLocked() = 0;
561 
562     // Get handout output buffer count.
563     virtual size_t   getHandoutOutputBufferCountLocked() const = 0;
564 
565     // Get handout input buffer count.
566     virtual size_t   getHandoutInputBufferCountLocked() = 0;
567 
568     // Get cached output buffer count.
569     virtual size_t   getCachedOutputBufferCountLocked() const = 0;
570     virtual size_t   getMaxCachedOutputBuffersLocked() const = 0;
571 
572     // Get the usage flags for the other endpoint, or return
573     // INVALID_OPERATION if they cannot be obtained.
574     virtual status_t getEndpointUsage(uint64_t *usage) = 0;
575 
576     // Return whether the buffer is in the list of outstanding buffers.
577     bool isOutstandingBuffer(const camera_stream_buffer& buffer) const;
578 
579     // Tracking for idle state
580     wp<StatusTracker> mStatusTracker;
581     // Status tracker component ID
582     int mStatusId;
583 
584     // Tracking for stream prepare - whether this stream can still have
585     // prepareNextBuffer called on it.
586     bool mStreamUnpreparable;
587 
588     uint64_t mUsage;
589 
590     Condition mOutputBufferReturnedSignal;
591 
592   private:
593     // Previously configured stream properties (post HAL override)
594     uint64_t mOldUsage;
595     uint32_t mOldMaxBuffers;
596     int mOldFormat;
597     android_dataspace mOldDataSpace;
598 
599     Condition mInputBufferReturnedSignal;
600     static const nsecs_t kWaitForBufferDuration = 3000000000LL; // 3000 ms
601 
602     void fireBufferListenersLocked(const camera_stream_buffer& buffer,
603             bool acquired, bool output, nsecs_t timestamp = 0, uint64_t frameNumber = 0);
604     List<wp<Camera3StreamBufferListener> > mBufferListenerList;
605 
606     status_t        cancelPrepareLocked();
607 
608     // Remove the buffer from the list of outstanding buffers.
609     void removeOutstandingBuffer(const camera_stream_buffer& buffer);
610 
611     // Tracking for PREPARING state
612 
613     // State of buffer preallocation. Only true if either prepareNextBuffer
614     // has been called sufficient number of times, or stream configuration
615     // had to register buffers with the HAL
616     bool mPrepared;
617     bool mPrepareBlockRequest;
618 
619     Vector<camera_stream_buffer_t> mPreparedBuffers;
620     size_t mPreparedBufferIdx;
621 
622     // Number of buffers allocated on last prepare call.
623     size_t mLastMaxCount;
624 
625     mutable Mutex mOutstandingBuffersLock;
626     // Outstanding buffers dequeued from the stream's buffer queue.
627     List<buffer_handle_t> mOutstandingBuffers;
628 
629     // Latency histogram of the wait time for handout buffer count to drop below
630     // max_buffers.
631     static const int32_t kBufferLimitLatencyBinSize = 33; //in ms
632     CameraLatencyHistogram mBufferLimitLatency;
633 
634     //Keep track of original format when the stream is created in case it gets overridden
635     bool mFormatOverridden;
636     const int mOriginalFormat;
637 
638     //Keep track of original dataSpace in case it gets overridden
639     bool mDataSpaceOverridden;
640     const android_dataspace mOriginalDataSpace;
641 
642     std::string mPhysicalCameraId;
643     nsecs_t mLastTimestamp;
644 
645     bool mIsMultiResolution = false;
646     bool mSupportOfflineProcessing = false;
647 
648     bool mDeviceTimeBaseIsRealtime;
649     int mTimestampBase;
650 }; // class Camera3Stream
651 
652 }; // namespace camera3
653 
654 }; // namespace android
655 
656 #endif
657