summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorRichard Fitzgerald <rf@opensource.wolfsonmicro.com>2013-05-14 12:12:21 +0100
committerEric Laurent <elaurent@google.com>2013-07-25 14:08:09 -0700
commitb1a270d1e926fb9a01b4265a7675ed0c2c8f4868 (patch)
tree091d06b02bc126ff1bb2dd1fabc9be829582ae69 /include
parentbfb1b832079bbb9426f72f3863199a54aefd02da (diff)
downloadframeworks_av-b1a270d1e926fb9a01b4265a7675ed0c2c8f4868.zip
frameworks_av-b1a270d1e926fb9a01b4265a7675ed0c2c8f4868.tar.gz
frameworks_av-b1a270d1e926fb9a01b4265a7675ed0c2c8f4868.tar.bz2
libmedia: offloaded playback support
- start() returns a status so that upper layers can recreate a non offloaded track in case of error. - Added states to handle offloaded tracks specific: - waiting for stream end (drain) notification by audio flinger - allow pause while waiting for stream end notification - getPosition() queries the render position directly from audio HAL. - disable APIs not applicable to offloaded tracks - Modified track restoring behavior for invalidated offloaded tracks: just send the callback and wait for upper layers to create a new track. - Added wait for stream end management in audio track client proxy. Similar to obtainBuffer and should be factored in. Change-Id: I0fc48117946364cb255afd653195498891f622bd Signed-off-by: Eric Laurent <elaurent@google.com>
Diffstat (limited to 'include')
-rw-r--r--include/media/AudioTrack.h12
-rw-r--r--include/private/media/AudioTrackShared.h3
2 files changed, 10 insertions, 5 deletions
diff --git a/include/media/AudioTrack.h b/include/media/AudioTrack.h
index 58e0deb..da13a7f 100644
--- a/include/media/AudioTrack.h
+++ b/include/media/AudioTrack.h
@@ -277,7 +277,7 @@ public:
* make it active. If set, the callback will start being called.
* If the track was previously paused, volume is ramped up over the first mix buffer.
*/
- void start();
+ status_t start();
/* Stop a track.
* In static buffer mode, the track is stopped immediately.
@@ -635,11 +635,12 @@ protected:
void setLoop_l(uint32_t loopStart, uint32_t loopEnd, int loopCount);
audio_io_handle_t getOutput_l();
- status_t getPosition_l(uint32_t *position);
-
// FIXME enum is faster than strcmp() for parameter 'from'
status_t restoreTrack_l(const char *from);
+ bool isOffloaded() const
+ { return (mFlags & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD) != 0; }
+
// may be changed if IAudioTrack is re-created
sp<IAudioTrack> mAudioTrack;
sp<IMemory> mCblkMemory;
@@ -676,7 +677,9 @@ protected:
STATE_ACTIVE,
STATE_STOPPED,
STATE_PAUSED,
+ STATE_PAUSED_STOPPING,
STATE_FLUSHED,
+ STATE_STOPPING,
} mState;
callback_t mCbf; // callback handler for events, or NULL
@@ -694,7 +697,7 @@ protected:
// 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()
- int mObservedSequence; // last observed value of mSequence
+ uint32_t mObservedSequence; // last observed value of mSequence
sp<IMemory> mSharedBuffer;
uint32_t mLoopPeriod; // in frames, zero means looping is disabled
@@ -736,6 +739,7 @@ private:
sp<DeathNotifier> mDeathNotifier;
uint32_t mSequence; // incremented for each new IAudioTrack attempt
+ audio_io_handle_t mOutput; // cached output io handle
};
class TimedAudioTrack : public AudioTrack
diff --git a/include/private/media/AudioTrackShared.h b/include/private/media/AudioTrackShared.h
index 6129c80..b890180 100644
--- a/include/private/media/AudioTrackShared.h
+++ b/include/private/media/AudioTrackShared.h
@@ -296,6 +296,7 @@ public:
bool getStreamEndDone() const;
+ status_t waitStreamEndDone(const struct timespec *requested);
};
class StaticAudioTrackClientProxy : public AudioTrackClientProxy {
@@ -379,8 +380,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
};