summaryrefslogtreecommitdiffstats
path: root/services/audioflinger/FastMixer.cpp
diff options
context:
space:
mode:
authorGlenn Kasten <gkasten@google.com>2012-05-21 09:17:20 -0700
committerGlenn Kasten <gkasten@google.com>2012-05-21 12:36:06 -0700
commitfbae5dae5187aca9d974cbe15ec818e9c6f56705 (patch)
tree101ef33da2a18e0cb1c70a0e1ae085450dc60396 /services/audioflinger/FastMixer.cpp
parentcd8a36fdc49a823f78d45e8e1a464dc261553b26 (diff)
downloadframeworks_av-fbae5dae5187aca9d974cbe15ec818e9c6f56705.zip
frameworks_av-fbae5dae5187aca9d974cbe15ec818e9c6f56705.tar.gz
frameworks_av-fbae5dae5187aca9d974cbe15ec818e9c6f56705.tar.bz2
Keep a copy of most recent audio played
Change-Id: I6b2f97881c39998a2fae9ab79d669af6c0a37e94
Diffstat (limited to 'services/audioflinger/FastMixer.cpp')
-rw-r--r--services/audioflinger/FastMixer.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/services/audioflinger/FastMixer.cpp b/services/audioflinger/FastMixer.cpp
index df9ec8e..52effb2 100644
--- a/services/audioflinger/FastMixer.cpp
+++ b/services/audioflinger/FastMixer.cpp
@@ -77,6 +77,7 @@ bool FastMixer::threadLoop()
bool isWarm = false; // true means ready to mix, false means wait for warmup before mixing
struct timespec measuredWarmupTs = {0, 0}; // how long did it take for warmup to complete
uint32_t warmupCycles = 0; // counter of number of loop cycles required to warmup
+ NBAIO_Sink* teeSink = NULL; // if non-NULL, then duplicate write() to this non-blocking sink
for (;;) {
@@ -106,6 +107,7 @@ bool FastMixer::threadLoop()
// As soon as possible of learning of a new dump area, start using it
dumpState = next->mDumpState != NULL ? next->mDumpState : &dummyDumpState;
+ teeSink = next->mTeeSink;
// We want to always have a valid reference to the previous (non-idle) state.
// However, the state queue only guarantees access to current and previous states.
@@ -398,6 +400,9 @@ bool FastMixer::threadLoop()
memset(mixBuffer, 0, frameCount * 2 * sizeof(short));
mixBufferState = ZEROED;
}
+ if (teeSink != NULL) {
+ (void) teeSink->write(mixBuffer, frameCount);
+ }
// FIXME write() is non-blocking and lock-free for a properly implemented NBAIO sink,
// but this code should be modified to handle both non-blocking and blocking sinks
dumpState->mWriteSequence++;