Start point for track sink frame map
When start the track, add current track sink frame info to mFrameMap. If
the HAL returns a position that is smaller than the first written frame,
the timestamp will be interpolated instead of using a larger value
(first written frame's position).
Bug: 238936281
Test: On device
Change-Id: Ib816b62a5724a0f48a449c2fdfdaa0b6936d710e
diff --git a/services/audioflinger/Threads.h b/services/audioflinger/Threads.h
index fc37bd2..b55504b 100644
--- a/services/audioflinger/Threads.h
+++ b/services/audioflinger/Threads.h
@@ -1177,7 +1177,7 @@
volatile int32_t mSuspended;
int64_t mBytesWritten;
- int64_t mFramesWritten; // not reset on standby
+ std::atomic<int64_t> mFramesWritten; // not reset on standby
int64_t mLastFramesWritten = -1; // track changes in timestamp
// server frames written.
int64_t mSuspendedFrames; // not reset on standby
@@ -1391,6 +1391,7 @@
virtual bool hasFastMixer() const = 0;
virtual FastTrackUnderruns getFastTrackUnderruns(size_t fastIndex __unused) const
{ FastTrackUnderruns dummy; return dummy; }
+ const std::atomic<int64_t>& framesWritten() const { return mFramesWritten; }
protected:
// accessed by both binder threads and within threadLoop(), lock on mutex needed