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

Commit 878c0e1d authored by Eric Laurent's avatar Eric Laurent
Browse files

Limit AudioFlinger mixer track sampling rate.

When changing the audio output stream sampling rate with setParameters() make sure that all tracks have a sampling rate less or equal to 2 times the new output sampling rate.
parent ae07aadd
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1512,6 +1512,10 @@ bool AudioFlinger::MixerThread::checkForNewParameters_l()
                    int name = getTrackName_l();
                    if (name < 0) break;
                    mTracks[i]->mName = name;
                    // limit track sample rate to 2 x new output sample rate
                    if (mTracks[i]->mCblk->sampleRate > 2 * sampleRate()) {
                        mTracks[i]->mCblk->sampleRate = 2 * sampleRate();
                    }
                }
                sendConfigEvent_l(AudioSystem::OUTPUT_CONFIG_CHANGED);
            }