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/PlaybackTracks.h b/services/audioflinger/PlaybackTracks.h
index fe3cc53..fa61af2 100644
--- a/services/audioflinger/PlaybackTracks.h
+++ b/services/audioflinger/PlaybackTracks.h
@@ -88,8 +88,8 @@
// ExtendedAudioBufferProvider interface
virtual size_t framesReady() const;
- virtual size_t framesReleased() const;
- virtual void onTimestamp(const AudioTimestamp ×tamp);
+ virtual int64_t framesReleased() const;
+ virtual void onTimestamp(const ExtendedTimestamp ×tamp);
bool isPausing() const { return mState == PAUSING; }
bool isPaused() const { return mState == PAUSED; }
@@ -101,15 +101,15 @@
void flushAck();
bool isResumePending();
void resumeAck();
- void updateTrackFrameInfo(uint32_t trackFramesReleased, uint32_t sinkFramesWritten,
- AudioTimestamp *timeStamp = NULL);
+ void updateTrackFrameInfo(int64_t trackFramesReleased, int64_t sinkFramesWritten,
+ const ExtendedTimestamp &timeStamp);
sp<IMemory> sharedBuffer() const { return mSharedBuffer; }
// framesWritten is cumulative, never reset, and is shared all tracks
// audioHalFrames is derived from output latency
// FIXME parameters not needed, could get them from the thread
- bool presentationComplete(size_t framesWritten, size_t audioHalFrames);
+ bool presentationComplete(int64_t framesWritten, size_t audioHalFrames);
public:
void triggerEvents(AudioSystem::sync_event_t type);
@@ -142,9 +142,9 @@
// zero means not monitoring
// access these three variables only when holding thread lock.
- LinearMap<uint32_t> mFrameMap; // track frame to server frame mapping
- bool mSinkTimestampValid; // valid cached timestamp
- AudioTimestamp mSinkTimestamp;
+ LinearMap<int64_t> mFrameMap; // track frame to server frame mapping
+
+ ExtendedTimestamp mSinkTimestamp;
private:
// The following fields are only for fast tracks, and should be in a subclass