Implement server side playback timestamps with 64 bit accuracy
Provide server timestamps if the HAL doesn't provide it.
Provide monotonic - boottime translation.
Integrate record timestamps and playback timestamps together.
Bug: 17472992
Bug: 22871200
Bug: 26400089
Bug: 26682703
Change-Id: If1974f94232fcce7ba0bbcdf63d9e54ed51918ff
diff --git a/services/audioflinger/FastMixer.h b/services/audioflinger/FastMixer.h
index e38878e..3cc7c9f 100644
--- a/services/audioflinger/FastMixer.h
+++ b/services/audioflinger/FastMixer.h
@@ -38,7 +38,9 @@
FastMixerStateQueue* sq();
virtual void setMasterMono(bool mono) { mMasterMono.store(mono); /* memory_order_seq_cst */ }
-
+ virtual void setBoottimeOffset(int64_t boottimeOffset) {
+ mBoottimeOffset.store(boottimeOffset); /* memory_order_seq_cst */
+ }
private:
FastMixerStateQueue mSQ;
@@ -79,14 +81,15 @@
unsigned mSampleRate;
int mFastTracksGen;
FastMixerDumpState mDummyFastMixerDumpState;
- uint32_t mTotalNativeFramesWritten; // copied to dumpState->mFramesWritten
+ int64_t mTotalNativeFramesWritten; // copied to dumpState->mFramesWritten
// next 2 fields are valid only when timestampStatus == NO_ERROR
- AudioTimestamp mTimestamp;
- uint32_t mNativeFramesWrittenButNotPresented;
+ ExtendedTimestamp mTimestamp;
+ int64_t mNativeFramesWrittenButNotPresented;
// accessed without lock between multiple threads.
std::atomic_bool mMasterMono;
+ std::atomic_int_fast64_t mBoottimeOffset;
}; // class FastMixer
} // namespace android