AudioFlinger: fix timed audio
(cherry picked from commit e20ac92c564a2f4e8123885807abdf0a78de0dd7)
> AudioFlinger: fix timed audio
>
> Addresses Bug 6900517.
>
> Finish up support for timed audio in the new FastMixer world. Pay special
> attention to remaining lock-less and voluntary yield free on the FastMixer
> thread. This fixes audio playback for Q on JB.
>
> Change-Id: Iaf815e58a1b1d0a0190051794bec8dc5c9231785
> Signed-off-by: John Grossman <johngro@google.com>
Change-Id: I9bd687acc345a05867af48e71116690fdb0ce1b5
Signed-off-by: John Grossman <johngro@google.com>
diff --git a/services/audioflinger/NBAIO.cpp b/services/audioflinger/NBAIO.cpp
index 9d71eae..2c07ebf 100644
--- a/services/audioflinger/NBAIO.cpp
+++ b/services/audioflinger/NBAIO.cpp
@@ -128,7 +128,8 @@
}
// This is a default implementation; it is expected that subclasses will optimize this.
-ssize_t NBAIO_Source::readVia(readVia_t via, size_t total, void *user, size_t block)
+ssize_t NBAIO_Source::readVia(readVia_t via, size_t total, void *user,
+ int64_t readPTS, size_t block)
{
if (!mNegotiated) {
return (ssize_t) NEGOTIATE;
@@ -147,11 +148,11 @@
if (count > block) {
count = block;
}
- ssize_t ret = read(buffer, count);
+ ssize_t ret = read(buffer, count, readPTS);
if (ret > 0) {
ALOG_ASSERT((size_t) ret <= count);
size_t maxRet = ret;
- ret = via(user, buffer, maxRet);
+ ret = via(user, buffer, maxRet, readPTS);
if (ret > 0) {
ALOG_ASSERT((size_t) ret <= maxRet);
accumulator += ret;