From 2c3b2da3049627264b7c6b449a1622f002210f03 Mon Sep 17 00:00:00 2001 From: John Grossman Date: Thu, 2 Aug 2012 17:08:54 -0700 Subject: 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 Change-Id: I9bd687acc345a05867af48e71116690fdb0ce1b5 Signed-off-by: John Grossman --- services/audioflinger/FastMixer.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'services/audioflinger/FastMixer.cpp') diff --git a/services/audioflinger/FastMixer.cpp b/services/audioflinger/FastMixer.cpp index 7652132..b89bf81 100644 --- a/services/audioflinger/FastMixer.cpp +++ b/services/audioflinger/FastMixer.cpp @@ -399,8 +399,13 @@ bool FastMixer::threadLoop() ftDump->mUnderruns = underruns; ftDump->mFramesReady = framesReady; } + + int64_t pts; + if (outputSink == NULL || (OK != outputSink->getNextWriteTimestamp(&pts))) + pts = AudioBufferProvider::kInvalidPTS; + // process() is CPU-bound - mixer->process(AudioBufferProvider::kInvalidPTS); + mixer->process(pts); mixBufferState = MIXED; } else if (mixBufferState == MIXED) { mixBufferState = UNDEFINED; -- cgit v1.1