AudioTrack: presentationComplete by time for Direct Tracks.
Test: Directed app - test_directtracks
Bug: 190579093
Change-Id: I604b65b2dbc190011442e6ab45e16b22512f74bd
diff --git a/services/audioflinger/PlaybackTracks.h b/services/audioflinger/PlaybackTracks.h
index 51a41af..0929055 100644
--- a/services/audioflinger/PlaybackTracks.h
+++ b/services/audioflinger/PlaybackTracks.h
@@ -222,10 +222,23 @@
sp<IMemory> sharedBuffer() const { return mSharedBuffer; }
+ // presentationComplete checked by frames. (Mixed Tracks).
// 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(int64_t framesWritten, size_t audioHalFrames);
+
+ // presentationComplete checked by time. (Direct Tracks).
+ bool presentationComplete(uint32_t latencyMs);
+
+ void resetPresentationComplete() {
+ mPresentationCompleteFrames = 0;
+ mPresentationCompleteTimeNs = 0;
+ }
+
+ // notifyPresentationComplete is called when presentationComplete() detects
+ // that the track is finished stopping.
+ void notifyPresentationComplete();
+
void signalClientFlag(int32_t flag);
public:
@@ -256,9 +269,6 @@
int32_t *mAuxBuffer;
int mAuxEffectId;
bool mHasVolumeController;
- size_t mPresentationCompleteFrames; // number of frames written to the
- // audio HAL when this track will be fully rendered
- // zero means not monitoring
// access these three variables only when holding thread lock.
LinearMap<int64_t> mFrameMap; // track frame to server frame mapping
@@ -294,6 +304,14 @@
for (auto& tp : mTeePatches) { f(tp.patchTrack); }
};
+ size_t mPresentationCompleteFrames = 0; // (Used for Mixed tracks)
+ // The number of frames written to the
+ // audio HAL when this track is considered fully rendered.
+ // Zero means not monitoring.
+ int64_t mPresentationCompleteTimeNs = 0; // (Used for Direct tracks)
+ // The time when this track is considered fully rendered.
+ // Zero means not monitoring.
+
// The following fields are only for fast tracks, and should be in a subclass
int mFastIndex; // index within FastMixerState::mFastTracks[];
// either mFastIndex == -1 if not isFastTrack()