summaryrefslogtreecommitdiffstats
path: root/include/media/AudioTrack.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/media/AudioTrack.h')
-rw-r--r--include/media/AudioTrack.h34
1 files changed, 19 insertions, 15 deletions
diff --git a/include/media/AudioTrack.h b/include/media/AudioTrack.h
index fd51b8f..2e1ed6c 100644
--- a/include/media/AudioTrack.h
+++ b/include/media/AudioTrack.h
@@ -79,9 +79,7 @@ public:
size_t size; // input/output in bytes == frameCount * frameSize
// on input it is unused
// on output is the number of bytes actually filled
- // FIXME this is redundant with respect to frameCount,
- // and TRANSFER_OBTAIN mode is broken for 8-bit data
- // since we don't define the frame format
+ // FIXME this is redundant with respect to frameCount.
union {
void* raw;
@@ -154,9 +152,9 @@ public:
* streamType: Select the type of audio stream this track is attached to
* (e.g. AUDIO_STREAM_MUSIC).
* sampleRate: Data source sampling rate in Hz.
- * format: Audio format. For mixed tracks, any PCM format supported by server is OK
- * or AUDIO_FORMAT_PCM_8_BIT which is handled on client side. For direct
- * and offloaded tracks, the possible format(s) depends on the output sink.
+ * format: Audio format. For mixed tracks, any PCM format supported by server is OK.
+ * For direct and offloaded tracks, the possible format(s) depends on the
+ * output sink.
* channelMask: Channel mask, such that audio_is_output_channel(channelMask) is true.
* frameCount: Minimum size of track PCM buffer in frames. This defines the
* application's contribution to the
@@ -193,7 +191,6 @@ public:
/* Creates an audio track and registers it with AudioFlinger.
* With this constructor, the track is configured for static buffer mode.
- * The format must not be 8-bit linear PCM.
* Data to be rendered is passed in a shared memory buffer
* identified by the argument sharedBuffer, which must be non-0.
* The memory should be initialized to the desired data before calling start().
@@ -614,6 +611,7 @@ protected:
void pause(); // suspend thread from execution at next loop boundary
void resume(); // allow thread to execute, if not requested to exit
+ void wake(); // wake to handle changed notification conditions.
private:
void pauseInternal(nsecs_t ns = 0LL);
@@ -628,7 +626,9 @@ protected:
bool mPaused; // whether thread is requested to pause at next loop entry
bool mPausedInt; // whether thread internally requests pause
nsecs_t mPausedNs; // if mPausedInt then associated timeout, otherwise ignored
- bool mIgnoreNextPausedInt; // whether to ignore next mPausedInt request
+ bool mIgnoreNextPausedInt; // skip any internal pause and go immediately
+ // to processAudioBuffer() as state may have changed
+ // since pause time calculated.
};
// body of AudioTrackThread::threadLoop()
@@ -680,7 +680,7 @@ protected:
float mVolume[2];
float mSendLevel;
- mutable uint32_t mSampleRate; // mutable because getSampleRate() can update it.
+ mutable uint32_t mSampleRate; // mutable because getSampleRate() can update it
size_t mFrameCount; // corresponds to current IAudioTrack, value is
// reported back by AudioFlinger to the client
size_t mReqFrameCount; // frame count to request the first or next time
@@ -698,10 +698,7 @@ protected:
const audio_offload_info_t* mOffloadInfo;
audio_attributes_t mAttributes;
- // mFrameSize is equal to mFrameSizeAF for non-PCM or 16-bit PCM data. For 8-bit PCM data, it's
- // twice as large as mFrameSize because data is expanded to 16-bit before it's stored in buffer.
- size_t mFrameSize; // app-level frame size
- size_t mFrameSizeAF; // AudioFlinger frame size
+ size_t mFrameSize; // frame size in bytes
status_t mStatus;
@@ -732,13 +729,20 @@ protected:
bool mRefreshRemaining; // processAudioBuffer() should refresh
// mRemainingFrames and mRetryOnPartialBuffer
+ // used for static track cbf and restoration
+ int32_t mLoopCount; // last setLoop loopCount; zero means disabled
+ uint32_t mLoopStart; // last setLoop loopStart
+ uint32_t mLoopEnd; // last setLoop loopEnd
+ int32_t mLoopCountNotified; // the last loopCount notified by callback.
+ // mLoopCountNotified counts down, matching
+ // the remaining loop count for static track
+ // playback.
+
// These are private to processAudioBuffer(), and are not protected by a lock
uint32_t mRemainingFrames; // number of frames to request in obtainBuffer()
bool mRetryOnPartialBuffer; // sleep and retry after partial obtainBuffer()
uint32_t mObservedSequence; // last observed value of mSequence
- uint32_t mLoopPeriod; // in frames, zero means looping is disabled
-
uint32_t mMarkerPosition; // in wrapping (overflow) frame units
bool mMarkerReached;
uint32_t mNewPosition; // in frames