diff options
Diffstat (limited to 'services/audioflinger/TrackBase.h')
-rw-r--r-- | services/audioflinger/TrackBase.h | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/services/audioflinger/TrackBase.h b/services/audioflinger/TrackBase.h index cd201d9..5f13be3 100644 --- a/services/audioflinger/TrackBase.h +++ b/services/audioflinger/TrackBase.h @@ -34,7 +34,9 @@ public: RESUMING, ACTIVE, PAUSING, - PAUSED + PAUSED, + STARTING_1, // for RecordTrack only + STARTING_2, // for RecordTrack only }; TrackBase(ThreadBase *thread, @@ -46,8 +48,11 @@ public: const sp<IMemory>& sharedBuffer, int sessionId, int uid, - bool isOut); + IAudioFlinger::track_flags_t flags, + bool isOut, + bool useReadOnlyHeap = false); virtual ~TrackBase(); + virtual status_t initCheck() const { return getCblk() != 0 ? NO_ERROR : NO_MEMORY; } virtual status_t start(AudioSystem::sync_event_t event, int triggerSession) = 0; @@ -58,6 +63,9 @@ public: int uid() const { return mUid; } virtual status_t setSyncEvent(const sp<SyncEvent>& event); + sp<IMemory> getBuffers() const { return mBufferMemory; } + bool isFastTrack() const { return (mFlags & IAudioFlinger::TRACK_FAST) != 0; } + protected: TrackBase(const TrackBase&); TrackBase& operator = (const TrackBase&); @@ -78,15 +86,6 @@ protected: virtual uint32_t sampleRate() const { return mSampleRate; } - // Return a pointer to the start of a contiguous slice of the track buffer. - // Parameter 'offset' is the requested start position, expressed in - // monotonically increasing frame units relative to the track epoch. - // Parameter 'frames' is the requested length, also in frame units. - // Always returns non-NULL. It is the caller's responsibility to - // verify that this will be successful; the result of calling this - // function with invalid 'offset' or 'frames' is undefined. - void* getBuffer(uint32_t offset, uint32_t frames) const; - bool isStopped() const { return (mState == STOPPED || mState == FLUSHED); } @@ -118,6 +117,7 @@ protected: /*const*/ sp<Client> mClient; // see explanation at ~TrackBase() why not const sp<IMemory> mCblkMemory; audio_track_cblk_t* mCblk; + sp<IMemory> mBufferMemory; // currently non-0 for fast RecordTrack only void* mBuffer; // start of track buffer, typically in shared memory // except for OutputTrack when it is in local memory // we don't really need a lock for these @@ -136,6 +136,7 @@ protected: const int mSessionId; int mUid; Vector < sp<SyncEvent> >mSyncEvents; + const IAudioFlinger::track_flags_t mFlags; const bool mIsOut; ServerProxy* mServerProxy; const int mId; |