summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean-Michel Trivi <jmtrivi@google.com>2012-10-16 10:29:01 -0700
committerJean-Michel Trivi <jmtrivi@google.com>2012-10-16 11:00:11 -0700
commit115b87ecf6182698b54055288d0f8710308b324d (patch)
tree59588554a539124b69c0f99290ad88d053ca6b57
parent6ebb67493075ecc817207bc0ca0305cde64b5c3b (diff)
downloadframeworks_av-115b87ecf6182698b54055288d0f8710308b324d.zip
frameworks_av-115b87ecf6182698b54055288d0f8710308b324d.tar.gz
frameworks_av-115b87ecf6182698b54055288d0f8710308b324d.tar.bz2
Fix track estimation for presentation complete
Audio tracks were not using the right latency estimation for signalling the completion of their presetation. This caused the synchronization mechanism between playback and record to be off, and a synchronized recording would contain some of the audio that was meant to be over once recording would start. Use the playback thread's latency reporting which takes the audio pipe into account. Bug 7237669 Change-Id: I23a907a53ad0b0d68d246789ec595a77a79fced5
-rw-r--r--services/audioflinger/AudioFlinger.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index aa30864..6a35053 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -3275,8 +3275,7 @@ AudioFlinger::PlaybackThread::mixer_state AudioFlinger::MixerThread::prepareTrac
// Remove it from the list of active tracks.
// TODO: use actual buffer filling status instead of latency when available from
// audio HAL
- size_t audioHALFrames =
- (mOutput->stream->get_latency(mOutput->stream)*mSampleRate) / 1000;
+ size_t audioHALFrames = (latency_l() * mSampleRate) / 1000;
size_t framesWritten =
mBytesWritten / audio_stream_frame_size(&mOutput->stream->common);
if (track->presentationComplete(framesWritten, audioHALFrames)) {
@@ -3799,8 +3798,7 @@ AudioFlinger::PlaybackThread::mixer_state AudioFlinger::DirectOutputThread::prep
// We have consumed all the buffers of this track.
// Remove it from the list of active tracks.
// TODO: implement behavior for compressed audio
- size_t audioHALFrames =
- (mOutput->stream->get_latency(mOutput->stream)*mSampleRate) / 1000;
+ size_t audioHALFrames = (latency_l() * mSampleRate) / 1000;
size_t framesWritten =
mBytesWritten / audio_stream_frame_size(&mOutput->stream->common);
if (track->presentationComplete(framesWritten, audioHALFrames)) {