aaudio: prevent noise when stopping a stream
The DSP is stopped after the callback is stopped.
If the CPU is slow and the time gap is too large then
the DSP can play past the valid data and play invalid data.
To prevent noise, this new code clears part of the FIFO
beyond the valid data. Then when the DSP has read the valid
data it clears the entire FIFO.
Then it waits for the valid data to reach the speaker,
based on a latency estimation using timestamps.
Bug: 261783315
Test: Use OboeTester with repro steps in the bug.
Change-Id: Ia31df4b21c805b4ae9ca4fb8366068be1cce2c9f
8 files changed