13399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi/*
23399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi * Copyright (C) 2011 The Android Open Source Project
33399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi *
43399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi * Licensed under the Apache License, Version 2.0 (the "License");
53399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi * you may not use this file except in compliance with the License.
63399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi * You may obtain a copy of the License at
73399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi *
83399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi *      http://www.apache.org/licenses/LICENSE-2.0
93399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi *
103399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi * Unless required by applicable law or agreed to in writing, software
113399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi * distributed under the License is distributed on an "AS IS" BASIS,
123399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
133399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi * See the License for the specific language governing permissions and
143399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi * limitations under the License.
153399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi */
163399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi
171a2fafbaa36390a06cc9a066fcbe147c8c47ea77Pannag Sanketi#ifndef ANDROID_GUI_SURFACEMEDIASOURCE_H
181a2fafbaa36390a06cc9a066fcbe147c8c47ea77Pannag Sanketi#define ANDROID_GUI_SURFACEMEDIASOURCE_H
193399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi
203399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi#include <gui/ISurfaceTexture.h>
21bdddc659a941afdb7f4958f582c6901c07246097Daniel Lam#include <gui/BufferQueue.h>
223399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi
233399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi#include <utils/threads.h>
243399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi#include <utils/Vector.h>
253399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi#include <media/stagefright/MediaSource.h>
263399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi#include <media/stagefright/MediaBuffer.h>
273399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi
283399b7267185646c69b04352211fca4fad9d7547Pannag Sanketinamespace android {
293399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi// ----------------------------------------------------------------------------
303399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi
313399b7267185646c69b04352211fca4fad9d7547Pannag Sanketiclass IGraphicBufferAlloc;
323399b7267185646c69b04352211fca4fad9d7547Pannag Sanketiclass String8;
333399b7267185646c69b04352211fca4fad9d7547Pannag Sanketiclass GraphicBuffer;
343399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi
35bdddc659a941afdb7f4958f582c6901c07246097Daniel Lam// ASSUMPTIONS
36bdddc659a941afdb7f4958f582c6901c07246097Daniel Lam// 1. SurfaceMediaSource is initialized with width*height which
37bdddc659a941afdb7f4958f582c6901c07246097Daniel Lam// can never change.  However, deqeueue buffer does not currently
38bdddc659a941afdb7f4958f582c6901c07246097Daniel Lam// enforce this as in BufferQueue, dequeue can be used by SurfaceTexture
39bdddc659a941afdb7f4958f582c6901c07246097Daniel Lam// which can modify the default width and heght.  Also neither the width
40bdddc659a941afdb7f4958f582c6901c07246097Daniel Lam// nor height can be 0.
41bdddc659a941afdb7f4958f582c6901c07246097Daniel Lam// 2. setSynchronousMode is never used (basically no one should call
42bdddc659a941afdb7f4958f582c6901c07246097Daniel Lam// setSynchronousMode(false)
43bdddc659a941afdb7f4958f582c6901c07246097Daniel Lam// 3. setCrop, setTransform, setScalingMode should never be used
44bdddc659a941afdb7f4958f582c6901c07246097Daniel Lam// 4. queueBuffer returns a filled buffer to the SurfaceMediaSource. In addition, a
45bdddc659a941afdb7f4958f582c6901c07246097Daniel Lam// timestamp must be provided for the buffer. The timestamp is in
46bdddc659a941afdb7f4958f582c6901c07246097Daniel Lam// nanoseconds, and must be monotonically increasing. Its other semantics
47bdddc659a941afdb7f4958f582c6901c07246097Daniel Lam// (zero point, etc) are client-dependent and should be documented by the
48bdddc659a941afdb7f4958f582c6901c07246097Daniel Lam// client.
49bdddc659a941afdb7f4958f582c6901c07246097Daniel Lam// 5. Once disconnected, SurfaceMediaSource can be reused (can not
50bdddc659a941afdb7f4958f582c6901c07246097Daniel Lam// connect again)
51bdddc659a941afdb7f4958f582c6901c07246097Daniel Lam// 6. Stop is a hard stop, the last few frames held by the encoder
52bdddc659a941afdb7f4958f582c6901c07246097Daniel Lam// may be dropped.  It is possible to wait for the buffers to be
53bdddc659a941afdb7f4958f582c6901c07246097Daniel Lam// returned (but not implemented)
54bdddc659a941afdb7f4958f582c6901c07246097Daniel Lam
5596fc6cc65ca93009a759a3a874b82a35771b9714Andreas Huber#define DEBUG_PENDING_BUFFERS   0
5696fc6cc65ca93009a759a3a874b82a35771b9714Andreas Huber
57bdddc659a941afdb7f4958f582c6901c07246097Daniel Lamclass SurfaceMediaSource : public MediaSource,
58bdddc659a941afdb7f4958f582c6901c07246097Daniel Lam                                public MediaBufferObserver,
59bdddc659a941afdb7f4958f582c6901c07246097Daniel Lam                                protected BufferQueue::ConsumerListener {
603399b7267185646c69b04352211fca4fad9d7547Pannag Sanketipublic:
61bdddc659a941afdb7f4958f582c6901c07246097Daniel Lam    enum { MIN_UNDEQUEUED_BUFFERS = 4};
623399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi
633399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi    struct FrameAvailableListener : public virtual RefBase {
643399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi        // onFrameAvailable() is called from queueBuffer() is the FIFO is
651a2fafbaa36390a06cc9a066fcbe147c8c47ea77Pannag Sanketi        // empty. You can use SurfaceMediaSource::getQueuedCount() to
663399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi        // figure out if there are more frames waiting.
673399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi        // This is called without any lock held can be called concurrently by
683399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi        // multiple threads.
693399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi        virtual void onFrameAvailable() = 0;
703399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi    };
713399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi
72bdddc659a941afdb7f4958f582c6901c07246097Daniel Lam    SurfaceMediaSource(uint32_t bufferWidth, uint32_t bufferHeight);
733399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi
741a2fafbaa36390a06cc9a066fcbe147c8c47ea77Pannag Sanketi    virtual ~SurfaceMediaSource();
753399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi
763399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi    // For the MediaSource interface for use by StageFrightRecorder:
773399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi    virtual status_t start(MetaData *params = NULL);
78a0ead0a2d2ce1d114ad3a17d755dddce831abb40Jamie Gennis    virtual status_t stop();
79a0ead0a2d2ce1d114ad3a17d755dddce831abb40Jamie Gennis    virtual status_t read(MediaBuffer **buffer,
80a0ead0a2d2ce1d114ad3a17d755dddce831abb40Jamie Gennis            const ReadOptions *options = NULL);
813399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi    virtual sp<MetaData> getFormat();
823399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi
833399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi    // Get / Set the frame rate used for encoding. Default fps = 30
84b33f3407bab0970a7f9241680723a1140b177c50Pannag Sanketi    status_t setFrameRate(int32_t fps) ;
85b33f3407bab0970a7f9241680723a1140b177c50Pannag Sanketi    int32_t getFrameRate( ) const;
863399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi
873399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi    // The call for the StageFrightRecorder to tell us that
883399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi    // it is done using the MediaBuffer data so that its state
893399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi    // can be set to FREE for dequeuing
903399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi    virtual void signalBufferReturned(MediaBuffer* buffer);
913399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi    // end of MediaSource interface
923399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi
933399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi    // getTimestamp retrieves the timestamp associated with the image
94a361483bb5dbd3bbf132c5b99b2df7d197c3fc50Pannag Sanketi    // set by the most recent call to read()
953399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi    //
963399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi    // The timestamp is in nanoseconds, and is monotonically increasing. Its
973399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi    // other semantics (zero point, etc) are source-dependent and should be
983399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi    // documented by the source.
993399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi    int64_t getTimestamp();
1003399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi
1013399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi    // setFrameAvailableListener sets the listener object that will be notified
1023399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi    // when a new frame becomes available.
1033399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi    void setFrameAvailableListener(const sp<FrameAvailableListener>& listener);
1043399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi
1053399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi    // dump our state in a String
1063399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi    void dump(String8& result) const;
1073399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi    void dump(String8& result, const char* prefix, char* buffer,
1083399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi                                                    size_t SIZE) const;
1093399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi
110b33f3407bab0970a7f9241680723a1140b177c50Pannag Sanketi    // isMetaDataStoredInVideoBuffers tells the encoder whether we will
111b33f3407bab0970a7f9241680723a1140b177c50Pannag Sanketi    // pass metadata through the buffers. Currently, it is force set to true
112b33f3407bab0970a7f9241680723a1140b177c50Pannag Sanketi    bool isMetaDataStoredInVideoBuffers() const;
113b33f3407bab0970a7f9241680723a1140b177c50Pannag Sanketi
114bdddc659a941afdb7f4958f582c6901c07246097Daniel Lam    sp<BufferQueue> getBufferQueue() const { return mBufferQueue; }
115bdddc659a941afdb7f4958f582c6901c07246097Daniel Lam
11666e72bc85fb762876baff60ef29de729da93cf26Andreas Huber    // To be called before start()
11766e72bc85fb762876baff60ef29de729da93cf26Andreas Huber    status_t setMaxAcquiredBufferCount(size_t count);
11866e72bc85fb762876baff60ef29de729da93cf26Andreas Huber
1190868deae404604b577892413c128d55a2bafc56eAndreas Huber    // To be called before start()
1200868deae404604b577892413c128d55a2bafc56eAndreas Huber    status_t setUseAbsoluteTimestamps();
1210868deae404604b577892413c128d55a2bafc56eAndreas Huber
122b33f3407bab0970a7f9241680723a1140b177c50Pannag Sanketiprotected:
1233399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi
124bdddc659a941afdb7f4958f582c6901c07246097Daniel Lam    // Implementation of the BufferQueue::ConsumerListener interface.  These
125bdddc659a941afdb7f4958f582c6901c07246097Daniel Lam    // calls are used to notify the SurfaceTexture of asynchronous events in the
126bdddc659a941afdb7f4958f582c6901c07246097Daniel Lam    // BufferQueue.
127bdddc659a941afdb7f4958f582c6901c07246097Daniel Lam    virtual void onFrameAvailable();
128bdddc659a941afdb7f4958f582c6901c07246097Daniel Lam
129bdddc659a941afdb7f4958f582c6901c07246097Daniel Lam    // Used as a hook to BufferQueue::disconnect()
130bdddc659a941afdb7f4958f582c6901c07246097Daniel Lam    // This is called by the client side when it is done
131bdddc659a941afdb7f4958f582c6901c07246097Daniel Lam    // TODO: Currently, this also sets mStopped to true which
132bdddc659a941afdb7f4958f582c6901c07246097Daniel Lam    // is needed for unblocking the encoder which might be
133bdddc659a941afdb7f4958f582c6901c07246097Daniel Lam    // waiting to read more frames. So if on the client side,
134bdddc659a941afdb7f4958f582c6901c07246097Daniel Lam    // the same thread supplies the frames and also calls stop
135bdddc659a941afdb7f4958f582c6901c07246097Daniel Lam    // on the encoder, the client has to call disconnect before
136bdddc659a941afdb7f4958f582c6901c07246097Daniel Lam    // it calls stop.
137bdddc659a941afdb7f4958f582c6901c07246097Daniel Lam    // In the case of the camera,
138bdddc659a941afdb7f4958f582c6901c07246097Daniel Lam    // that need not be required since the thread supplying the
139bdddc659a941afdb7f4958f582c6901c07246097Daniel Lam    // frames is separate than the one calling stop.
140bdddc659a941afdb7f4958f582c6901c07246097Daniel Lam    virtual void onBuffersReleased();
141bdddc659a941afdb7f4958f582c6901c07246097Daniel Lam
1423399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi    static bool isExternalFormat(uint32_t format);
1433399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi
1443399b7267185646c69b04352211fca4fad9d7547Pannag Sanketiprivate:
145bdddc659a941afdb7f4958f582c6901c07246097Daniel Lam    // mBufferQueue is the exchange point between the producer and
146bdddc659a941afdb7f4958f582c6901c07246097Daniel Lam    // this consumer
147bdddc659a941afdb7f4958f582c6901c07246097Daniel Lam    sp<BufferQueue> mBufferQueue;
1483399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi
149bdddc659a941afdb7f4958f582c6901c07246097Daniel Lam    // mBufferSlot caches GraphicBuffers from the buffer queue
150bdddc659a941afdb7f4958f582c6901c07246097Daniel Lam    sp<GraphicBuffer> mBufferSlot[BufferQueue::NUM_BUFFER_SLOTS];
1513399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi
1523399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi
153bdddc659a941afdb7f4958f582c6901c07246097Daniel Lam    // The permenent width and height of SMS buffers
154bdddc659a941afdb7f4958f582c6901c07246097Daniel Lam    int mWidth;
155bdddc659a941afdb7f4958f582c6901c07246097Daniel Lam    int mHeight;
1563399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi
1573399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi    // mCurrentSlot is the buffer slot index of the buffer that is currently
1583399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi    // being used by buffer consumer
1591a2fafbaa36390a06cc9a066fcbe147c8c47ea77Pannag Sanketi    // (e.g. StageFrightRecorder in the case of SurfaceMediaSource or GLTexture
1603399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi    // in the case of SurfaceTexture).
1613399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi    // It is initialized to INVALID_BUFFER_SLOT,
1623399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi    // indicating that no buffer slot is currently bound to the texture. Note,
1633399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi    // however, that a value of INVALID_BUFFER_SLOT does not necessarily mean
1643399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi    // that no buffer is bound to the texture. A call to setBufferCount will
1653399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi    // reset mCurrentTexture to INVALID_BUFFER_SLOT.
1663399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi    int mCurrentSlot;
1673399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi
1682cd25a9056cc150b9fd3ac9b0bca37a1334ffd47Jamie Gennis    // mCurrentBuffers is a list of the graphic buffers that are being used by
1692cd25a9056cc150b9fd3ac9b0bca37a1334ffd47Jamie Gennis    // buffer consumer (i.e. the video encoder). It's possible that these
1702cd25a9056cc150b9fd3ac9b0bca37a1334ffd47Jamie Gennis    // buffers are not associated with any buffer slots, so we must track them
1712cd25a9056cc150b9fd3ac9b0bca37a1334ffd47Jamie Gennis    // separately.  Buffers are added to this list in read, and removed from
1722cd25a9056cc150b9fd3ac9b0bca37a1334ffd47Jamie Gennis    // this list in signalBufferReturned
1732cd25a9056cc150b9fd3ac9b0bca37a1334ffd47Jamie Gennis    Vector<sp<GraphicBuffer> > mCurrentBuffers;
1743399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi
17500f41327264fa2e59cc05abaa5c554b2a32938e1Andreas Huber    size_t mNumPendingBuffers;
17600f41327264fa2e59cc05abaa5c554b2a32938e1Andreas Huber
17796fc6cc65ca93009a759a3a874b82a35771b9714Andreas Huber#if DEBUG_PENDING_BUFFERS
17896fc6cc65ca93009a759a3a874b82a35771b9714Andreas Huber    Vector<MediaBuffer *> mPendingBuffers;
17996fc6cc65ca93009a759a3a874b82a35771b9714Andreas Huber#endif
18096fc6cc65ca93009a759a3a874b82a35771b9714Andreas Huber
1813399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi    // mCurrentTimestamp is the timestamp for the current texture. It
1823399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi    // gets set to mLastQueuedTimestamp each time updateTexImage is called.
1833399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi    int64_t mCurrentTimestamp;
1843399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi
1853399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi    // mFrameAvailableListener is the listener object that will be called when a
1863399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi    // new frame becomes available. If it is not NULL it will be called from
1873399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi    // queueBuffer.
1883399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi    sp<FrameAvailableListener> mFrameAvailableListener;
1893399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi
1903399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi    // mMutex is the mutex used to prevent concurrent access to the member
1911a2fafbaa36390a06cc9a066fcbe147c8c47ea77Pannag Sanketi    // variables of SurfaceMediaSource objects. It must be locked whenever the
1923399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi    // member variables are accessed.
1933399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi    mutable Mutex mMutex;
1943399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi
1953399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi    ////////////////////////// For MediaSource
1963399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi    // Set to a default of 30 fps if not specified by the client side
1973399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi    int32_t mFrameRate;
1983399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi
1990e1d71641624c641a0a1abe4098943f5a42c6f94Andreas Huber    // mStarted is a flag to check if the recording is going on
2000e1d71641624c641a0a1abe4098943f5a42c6f94Andreas Huber    bool mStarted;
2010c5c7d2b119d2350c186ae9902919bcf28c3e277Pannag Sanketi
2020c5c7d2b119d2350c186ae9902919bcf28c3e277Pannag Sanketi    // mNumFramesReceived indicates the number of frames recieved from
2030c5c7d2b119d2350c186ae9902919bcf28c3e277Pannag Sanketi    // the client side
2040c5c7d2b119d2350c186ae9902919bcf28c3e277Pannag Sanketi    int mNumFramesReceived;
2050c5c7d2b119d2350c186ae9902919bcf28c3e277Pannag Sanketi    // mNumFramesEncoded indicates the number of frames passed on to the
2060c5c7d2b119d2350c186ae9902919bcf28c3e277Pannag Sanketi    // encoder
2070c5c7d2b119d2350c186ae9902919bcf28c3e277Pannag Sanketi    int mNumFramesEncoded;
2083399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi
209df4a59c61103e7e0e9332e167a0be67da5d82ff3Eino-Ville Talvala    // mFirstFrameTimestamp is the timestamp of the first received frame.
210df4a59c61103e7e0e9332e167a0be67da5d82ff3Eino-Ville Talvala    // It is used to offset the output timestamps so recording starts at time 0.
211df4a59c61103e7e0e9332e167a0be67da5d82ff3Eino-Ville Talvala    int64_t mFirstFrameTimestamp;
212df4a59c61103e7e0e9332e167a0be67da5d82ff3Eino-Ville Talvala    // mStartTimeNs is the start time passed into the source at start, used to
213df4a59c61103e7e0e9332e167a0be67da5d82ff3Eino-Ville Talvala    // offset timestamps.
214df4a59c61103e7e0e9332e167a0be67da5d82ff3Eino-Ville Talvala    int64_t mStartTimeNs;
215df4a59c61103e7e0e9332e167a0be67da5d82ff3Eino-Ville Talvala
21600f41327264fa2e59cc05abaa5c554b2a32938e1Andreas Huber    size_t mMaxAcquiredBufferCount;
21700f41327264fa2e59cc05abaa5c554b2a32938e1Andreas Huber
2180868deae404604b577892413c128d55a2bafc56eAndreas Huber    bool mUseAbsoluteTimestamps;
2190868deae404604b577892413c128d55a2bafc56eAndreas Huber
2203399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi    // mFrameAvailableCondition condition used to indicate whether there
2213399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi    // is a frame available for dequeuing
2223399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi    Condition mFrameAvailableCondition;
2233399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi
22400f41327264fa2e59cc05abaa5c554b2a32938e1Andreas Huber    Condition mMediaBuffersAvailableCondition;
22500f41327264fa2e59cc05abaa5c554b2a32938e1Andreas Huber
2263399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi    // Avoid copying and equating and default constructor
2271a2fafbaa36390a06cc9a066fcbe147c8c47ea77Pannag Sanketi    DISALLOW_IMPLICIT_CONSTRUCTORS(SurfaceMediaSource);
2283399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi};
2293399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi
2303399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi// ----------------------------------------------------------------------------
2313399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi}; // namespace android
2323399b7267185646c69b04352211fca4fad9d7547Pannag Sanketi
2331a2fafbaa36390a06cc9a066fcbe147c8c47ea77Pannag Sanketi#endif // ANDROID_GUI_SURFACEMEDIASOURCE_H
234