diff options
author | Martin Storsjo <martin@martin.st> | 2014-01-31 13:30:15 +0200 |
---|---|---|
committer | Martin Storsjo <martin@martin.st> | 2014-01-31 13:30:15 +0200 |
commit | 398f21348e5100289f6e5be30c8b5257fa04aaf9 (patch) | |
tree | 26fb40e2808e33bcad41a36d263bc26b02f5c62c /media/libmedia | |
parent | c4eef29af4e306319d8741e0c3ade1ede9a0a2b5 (diff) | |
download | frameworks_av-398f21348e5100289f6e5be30c8b5257fa04aaf9.zip frameworks_av-398f21348e5100289f6e5be30c8b5257fa04aaf9.tar.gz frameworks_av-398f21348e5100289f6e5be30c8b5257fa04aaf9.tar.bz2 |
AudioTrack: Never try to use the fast path if resampling is required
Unless AudioFlinger was built with FAST_TRACKS_AT_NON_NATIVE_SAMPLE_RATE
enabled, AudioFlinger would deny using the fast path (and internally
fall back to the normal codepath) when it realized that resampling
was required. Since the buffer size calculations within AudioFlinger
don't take resampling into account properly (see the calculation
below "AUDIO_OUTPUT_FLAG_FAST denied" in audioflinger/Threads.cpp,
just below the hunk that this patch changes), make sure AudioTrack
doesn't try to use the fast path if resampling is required.
This removes the possibility to enable
FAST_TRACKS_AT_NON_NATIVE_SAMPLE_RATE in AudioFlinger since it
AudioTrack now won't even try to use the fast path for content
that requires resampling, regardless of the AudioFlinger configuration.
Change-Id: Icf0f8ad50bf0fdb84657f518c0120aa0535f23f9
Diffstat (limited to 'media/libmedia')
-rw-r--r-- | media/libmedia/AudioTrack.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/media/libmedia/AudioTrack.cpp b/media/libmedia/AudioTrack.cpp index 0609a22..0b8fd7e 100644 --- a/media/libmedia/AudioTrack.cpp +++ b/media/libmedia/AudioTrack.cpp @@ -878,6 +878,12 @@ status_t AudioTrack::createTrack_l( } ALOGV("createTrack_l() output %d afLatency %d", output, afLatency); + if ((flags & AUDIO_OUTPUT_FLAG_FAST) && sampleRate != afSampleRate) { + ALOGW("AUDIO_OUTPUT_FLAG_FAST denied by client due to mismatching sample rate (%d vs %d)", + sampleRate, afSampleRate); + flags = (audio_output_flags_t) (flags & ~AUDIO_OUTPUT_FLAG_FAST); + } + // The client's AudioTrack buffer is divided into n parts for purpose of wakeup by server, where // n = 1 fast track with single buffering; nBuffering is ignored // n = 2 fast track with double buffering |