summaryrefslogtreecommitdiffstats
path: root/services
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
commita045dcafd2b77036210f5b72e79d745ad4c1b848 (patch)
tree34dec57b2145f6fe954275233d556e674b65ddba /services
parentb4a55269a5b39c73de2cc1d4013d0631ef18c77d (diff)
downloadframeworks_av-a045dcafd2b77036210f5b72e79d745ad4c1b848.zip
frameworks_av-a045dcafd2b77036210f5b72e79d745ad4c1b848.tar.gz
frameworks_av-a045dcafd2b77036210f5b72e79d745ad4c1b848.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
Diffstat (limited to 'services')
-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)) {