summaryrefslogtreecommitdiffstats
path: root/include/private
diff options
context:
space:
mode:
Diffstat (limited to 'include/private')
-rw-r--r--include/private/media/AudioTrackShared.h26
1 files changed, 18 insertions, 8 deletions
diff --git a/include/private/media/AudioTrackShared.h b/include/private/media/AudioTrackShared.h
index 0592683..6d778dd 100644
--- a/include/private/media/AudioTrackShared.h
+++ b/include/private/media/AudioTrackShared.h
@@ -31,6 +31,7 @@ namespace android {
// ----------------------------------------------------------------------------
+// for audio_track_cblk_t::mFlags
#define CBLK_UNDERRUN 0x01 // set by server immediately on output underrun, cleared by client
#define CBLK_FORCEREADY 0x02 // set: track is considered ready immediately by AudioFlinger,
// clear: track is ready when buffer full
@@ -89,8 +90,11 @@ struct audio_track_cblk_t
// The data members are grouped so that members accessed frequently and in the same context
// are in the same line of data cache.
- volatile uint32_t server; // updated asynchronously by server,
- // "for entertainment purposes only"
+ uint32_t mServer; // Number of filled frames consumed by server (mIsOut),
+ // or filled frames provided by server (!mIsOut).
+ // It is updated asynchronously by server without a barrier.
+ // The value should be used "for entertainment purposes only",
+ // which means don't make important decisions based on it.
size_t frameCount_; // used during creation to pass actual track buffer size
// from AudioFlinger to client, and not referenced again
@@ -118,13 +122,11 @@ private:
// client write-only, server read-only
uint16_t mSendLevel; // Fixed point U4.12 so 0x1000 means 1.0
- uint8_t mPad2; // unused
+ uint16_t mPad2; // unused
public:
- // read-only for client, server writes once at initialization and is then read-only
- uint8_t mName; // normal tracks: track name, fast tracks: track index
- volatile int32_t flags;
+ volatile int32_t mFlags; // combinations of CBLK_*
// Cache line boundary (32 bytes)
@@ -235,7 +237,7 @@ public:
void interrupt();
size_t getPosition() {
- return mEpoch + mCblk->server;
+ return mEpoch + mCblk->mServer;
}
void setEpoch(size_t epoch) {
@@ -291,6 +293,12 @@ public:
virtual uint32_t getUnderrunFrames() const {
return mCblk->u.mStreaming.mUnderrunFrames;
}
+
+ bool clearStreamEndDone(); // and return previous value
+
+ bool getStreamEndDone() const;
+
+ status_t waitStreamEndDone(const struct timespec *requested);
};
class StaticAudioTrackClientProxy : public AudioTrackClientProxy {
@@ -374,8 +382,8 @@ public:
protected:
size_t mAvailToClient; // estimated frames available to client prior to releaseBuffer()
-private:
int32_t mFlush; // our copy of cblk->u.mStreaming.mFlush, for streaming output only
+private:
bool mDeferWake; // whether another releaseBuffer() is expected soon
};
@@ -405,6 +413,8 @@ public:
// should avoid doing a state queue poll from within framesReady().
// FIXME Change AudioFlinger to not call framesReady() from normal mixer thread.
virtual void framesReadyIsCalledByMultipleThreads() { }
+
+ bool setStreamEndDone(); // and return previous value
};
class StaticAudioTrackServerProxy : public AudioTrackServerProxy {