Thanks for reporting this issue.
Android supports a variety of resampler implementations.
At least one of the implementations is suitable for higher-quality music 
playback,
and is used in special common use cases such as 44.1 -> 48 and vice-versa.
But the default fall-back implementation, used for non-special cases, is 
"linear interpolation".
Linear resampling is quite fast but also low quality.
The implementation of linear resampling used here has a further limitation 
that it does not support resampling by arbitrary ratios.
I'm surprised that you were previously able to resample by larger ratios.
Perhaps a different implementation was being used, or maybe the ratio check
was too aggressive.  In any case, I'm glad to hear that you were able to 
workaround this.

Looking forward, we recognize that the default fallback resampler choice of 
"linear"
was perhaps a reasonable tradeoff in the days of slow processors,
but is unnecessarily optimized for speed on current processors.
We are reviewing our suite of resamplers, and hope to improve the
quality and power consumption tradeoffs.
We also want to allow a wider range of ratios.
I can't commit to a date or version for these improvements.

On Tuesday, February 25, 2014 1:06:44 PM UTC-8, Naaman Sittsamer wrote:
>
> Hi,
> I have a system where the audio hardware supports 16KHz.
> I've moved from Android 4.2.2 to 4.3 and now it seems there's no 
> resampling. If I play 44.1KHz media (e.g. music, ringtones) it results with 
> slow audio.
> If I play 16KHz file it sounds good. On the previous release the 
> resampling was fine (done by audioflinger).
>
> After code inspection, I found a fix for this issue, 
> in frameworks/av/services/audioflinger/Threads.cpp - 
> MixerThread::prepareTracks_l() :
> // limit track sample rate to 2 x output sample rate, which changes at 
> re-configuration
> uint32_t maxSampleRate = mSampleRate * 2;
> uint32_t reqSampleRate = track->mServerProxy->getSampleRate();
> if (reqSampleRate == 0) {
>    reqSampleRate = mSampleRate;
> } else if (reqSampleRate > maxSampleRate) {
>    reqSampleRate = maxSampleRate;
> } 
> mAudioMixer->setParameter(
>           name,
>           AudioMixer::RESAMPLE,
>           AudioMixer::SAMPLE_RATE,
>           (void *)reqSampleRate);
>
> Since my HW works with 16KHz then all the 44.1KHz media is handled as 
> 32KHz, hence it sounds slowly. 
> Is there a reason for this logic? audio quality limitation?
> By removing the "else" part resampling works fine.
> Is it a bug?
> In 4.2.2 this logic is missing and there're no resampling issues.
>
> Thanks,
> Naaman
>

-- 
-- 
unsubscribe: android-porting+unsubscr...@googlegroups.com
website: http://groups.google.com/group/android-porting

--- 
You received this message because you are subscribed to the Google Groups 
"android-porting" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-porting+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to