AudioFlinger: reset frame position on standby
The HAL does not reset the frame position on standby().
But applications expect the frame position to be reset.
So we subtract the position at standby from the current position.
Bug: 21724210
Bug: 21930805
Change-Id: I0c4520ba1c6c06a580f45f6bafc8cf1d56969f07
Signed-off-by: Phil Burk <philburk@google.com>
diff --git a/services/audioflinger/AudioStreamOut.h b/services/audioflinger/AudioStreamOut.h
index e91ca9c..761e771 100644
--- a/services/audioflinger/AudioStreamOut.h
+++ b/services/audioflinger/AudioStreamOut.h
@@ -53,7 +53,10 @@
virtual ~AudioStreamOut() { }
- virtual status_t getRenderPosition(uint32_t *frames);
+ // Get the bottom 32-bits of the 64-bit render position.
+ status_t getRenderPosition(uint32_t *frames);
+
+ virtual status_t getRenderPosition(uint64_t *frames);
virtual status_t getPresentationPosition(uint64_t *frames, struct timespec *timestamp);
@@ -76,6 +79,14 @@
virtual status_t flush();
virtual status_t standby();
+
+protected:
+ uint64_t mFramesWritten; // reset by flush
+ uint64_t mFramesWrittenAtStandby;
+ uint64_t mRenderPosition; // reset by flush or standby
+ int mRateMultiplier;
+ bool mHalFormatIsLinearPcm;
+ size_t mHalFrameSize;
};
} // namespace android