Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e17f831e authored by Yuuki Yokoyama's avatar Yuuki Yokoyama Committed by Tomoharu Kasahara
Browse files

Use default sample rate for only sw effect

Should not configure effect by thread sample rate
if effect is not offloadable.
Because of offload output may be different from
the sample rate supported by sw effect.

Bug: 70912361
Test: Create AudioEffect during 24kHz mp3 playback

Change-Id: Ie5bf264a9790d936c24476ea127bc6da9eefde73
parent 34affaed
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -50,6 +50,8 @@
#define ALOGVV(a...) do { } while(0)
#endif

#define DEFAULT_OUTPUT_SAMPLE_RATE 48000

namespace android {

// ----------------------------------------------------------------------------
@@ -547,7 +549,14 @@ status_t AudioFlinger::EffectModule::configure()

    mConfig.inputCfg.format = EFFECT_BUFFER_FORMAT;
    mConfig.outputCfg.format = EFFECT_BUFFER_FORMAT;

    // Don't use sample rate for thread if effect isn't offloadable.
    if ((thread->type() == ThreadBase::OFFLOAD) && !isOffloaded()) {
        mConfig.inputCfg.samplingRate = DEFAULT_OUTPUT_SAMPLE_RATE;
        ALOGV("Overriding effect input as 48kHz");
    } else {
        mConfig.inputCfg.samplingRate = thread->sampleRate();
    }
    mConfig.outputCfg.samplingRate = mConfig.inputCfg.samplingRate;
    mConfig.inputCfg.bufferProvider.cookie = NULL;
    mConfig.inputCfg.bufferProvider.getBuffer = NULL;