Revert "Enable FastTrack timestamps"
This reverts commit b3a486fecddc9e9264fe63d356eca0812493db27.
Reverting while investigating the root cause.
Bug: 27186414
diff --git a/include/private/media/AudioTrackShared.h b/include/private/media/AudioTrackShared.h
index cae5560..2270c85 100644
--- a/include/private/media/AudioTrackShared.h
+++ b/include/private/media/AudioTrackShared.h
@@ -119,11 +119,8 @@
typedef SingleStateQueue<AudioPlaybackRate> PlaybackRateQueue;
-
typedef SingleStateQueue<ExtendedTimestamp> ExtendedTimestampQueue;
-typedef SingleStateQueue<AudioTimestamp> TimestampQueue;
-
// ----------------------------------------------------------------------------
// Important: do not add any virtual methods, including ~
@@ -178,9 +175,7 @@
uint16_t mPad2; // unused
// server write-only, client read
- ExtendedTimestampQueue::Shared mExtendedTimestampQueue; // capture
- TimestampQueue::Shared mTimestampQueue; // playback
-
+ ExtendedTimestampQueue::Shared mExtendedTimestampQueue;
public:
volatile int32_t mFlags; // combinations of CBLK_*
@@ -338,10 +333,7 @@
size_t frameSize, bool clientInServer = false)
: ClientProxy(cblk, buffers, frameCount, frameSize, true /*isOut*/,
clientInServer),
- mPlaybackRateMutator(&cblk->mPlaybackRateQueue),
- mTimestampObserver(&cblk->mTimestampQueue) {
- }
-
+ mPlaybackRateMutator(&cblk->mPlaybackRateQueue) { }
virtual ~AudioTrackClientProxy() { }
// No barriers on the following operations, so the ordering of loads/stores
@@ -365,20 +357,6 @@
mPlaybackRateMutator.push(playbackRate);
}
- status_t getTimestamp(AudioTimestamp *timestamp) {
- if (timestamp == nullptr) {
- return BAD_VALUE;
- }
- (void) mTimestampObserver.poll(mTimestamp);
- // if no data is pushed by server, mTimestamp should be initialized by its constructor
- // to all zero elements.
- if (mTimestamp.mTime.tv_sec == 0 && mTimestamp.mTime.tv_nsec == 0) {
- return WOULD_BLOCK;
- }
- *timestamp = mTimestamp;
- return OK;
- }
-
virtual void flush();
virtual uint32_t getUnderrunFrames() const {
@@ -396,8 +374,6 @@
private:
PlaybackRateQueue::Mutator mPlaybackRateMutator;
- TimestampQueue::Observer mTimestampObserver;
- AudioTimestamp mTimestamp;
};
class StaticAudioTrackClientProxy : public AudioTrackClientProxy {
@@ -546,8 +522,7 @@
size_t frameSize, bool clientInServer = false, uint32_t sampleRate = 0)
: ServerProxy(cblk, buffers, frameCount, frameSize, true /*isOut*/, clientInServer),
mPlaybackRateObserver(&cblk->mPlaybackRateQueue),
- mUnderrunCount(0), mUnderrunning(false),
- mTimestampMutator(&cblk->mTimestampQueue) {
+ mUnderrunCount(0), mUnderrunning(false) {
mCblk->mSampleRate = sampleRate;
mPlaybackRate = AUDIO_PLAYBACK_RATE_DEFAULT;
}
@@ -587,11 +562,6 @@
// Return the playback speed and pitch read atomically. Not multi-thread safe on server side.
AudioPlaybackRate getPlaybackRate();
- // Expose timestamp to client proxy. Should only be called by a single thread.
- void setTimestamp(const AudioTimestamp ×tamp) {
- mTimestampMutator.push(timestamp);
- }
-
private:
AudioPlaybackRate mPlaybackRate; // last observed playback rate
PlaybackRateQueue::Observer mPlaybackRateObserver;
@@ -599,8 +569,6 @@
// The server keeps a copy here where it is safe from the client.
uint32_t mUnderrunCount; // echoed to mCblk
bool mUnderrunning; // used to detect edge of underrun
-
- TimestampQueue::Mutator mTimestampMutator;
};
class StaticAudioTrackServerProxy : public AudioTrackServerProxy {
diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp
index bd229c8..b2a5f14 100644
--- a/media/libmedia/AudioTrack.cpp
+++ b/media/libmedia/AudioTrack.cpp
@@ -2169,6 +2169,11 @@
// Set false here to cover all the error return cases.
mPreviousTimestampValid = false;
+ // FIXME not implemented for fast tracks; should use proxy and SSQ
+ if (mFlags & AUDIO_OUTPUT_FLAG_FAST) {
+ return INVALID_OPERATION;
+ }
+
switch (mState) {
case STATE_ACTIVE:
case STATE_PAUSED:
@@ -2198,10 +2203,7 @@
// The presented frame count must always lag behind the consumed frame count.
// To avoid a race, read the presented frames first. This ensures that presented <= consumed.
-
- // FastTrack timestamps are read through shared memory; otherwise use Binder.
- status_t status = (mFlags & AUDIO_OUTPUT_FLAG_FAST) ?
- mProxy->getTimestamp(×tamp) : mAudioTrack->getTimestamp(timestamp);
+ status_t status = mAudioTrack->getTimestamp(timestamp);
if (status != NO_ERROR) {
ALOGV_IF(status != WOULD_BLOCK, "getTimestamp error:%#x", status);
return status;
diff --git a/services/audioflinger/PlaybackTracks.h b/services/audioflinger/PlaybackTracks.h
index fe3cc53..c81bbf9 100644
--- a/services/audioflinger/PlaybackTracks.h
+++ b/services/audioflinger/PlaybackTracks.h
@@ -89,7 +89,6 @@
// ExtendedAudioBufferProvider interface
virtual size_t framesReady() const;
virtual size_t framesReleased() const;
- virtual void onTimestamp(const AudioTimestamp ×tamp);
bool isPausing() const { return mState == PAUSING; }
bool isPaused() const { return mState == PAUSED; }
diff --git a/services/audioflinger/Tracks.cpp b/services/audioflinger/Tracks.cpp
index 1a48e07..b719046 100644
--- a/services/audioflinger/Tracks.cpp
+++ b/services/audioflinger/Tracks.cpp
@@ -596,11 +596,6 @@
return mAudioTrackServerProxy->framesReleased();
}
-void AudioFlinger::PlaybackThread::Track::onTimestamp(const AudioTimestamp ×tamp)
-{
- mAudioTrackServerProxy->setTimestamp(timestamp);
-}
-
// Don't call for fast tracks; the framesReady() could result in priority inversion
bool AudioFlinger::PlaybackThread::Track::isReady() const {
if (mFillingUpStatus != FS_FILLING || isStopped() || isPausing()) {
@@ -863,7 +858,7 @@
status_t AudioFlinger::PlaybackThread::Track::getTimestamp(AudioTimestamp& timestamp)
{
- // FastTrack timestamps are read through SSQ
+ // Client should implement this using SSQ; the unpresented frame count in latch is irrelevant
if (isFastTrack()) {
return INVALID_OPERATION;
}