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

Commit 06e015b3 authored by Eric Laurent's avatar Eric Laurent Committed by Android (Google) Code Review
Browse files

Merge "AudioFlinger: duplicating output underrun improvements" into main

parents ba9b8b01 08f45936
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -3944,7 +3944,9 @@ void PlaybackThread::detachAuxEffect_l(int effectId)
bool PlaybackThread::threadLoop()
NO_THREAD_SAFETY_ANALYSIS  // manual locking of AudioFlinger
{
    if (mType == SPATIALIZER) {
    // Check the flag and not the mixer type to also boost the duplicating thread priority
    // when one of the outputs is a spatializer thread.
    if (mOutput != nullptr && ((mOutput->flags & AUDIO_OUTPUT_FLAG_SPATIALIZER) != 0)) {
        const pid_t tid = getTid();
        if (tid == -1) {  // odd: we are here, we must be a running thread.
            ALOGW("%s: Cannot update Spatializer mixer thread priority, no tid", __func__);
@@ -7895,11 +7897,11 @@ void DuplicatingThread::removeOutputTrack(IAfPlaybackThread* thread)
void DuplicatingThread::updateWaitTime_l()
{
    // Initialize mWaitTimeMs according to the mixer buffer size.
    mWaitTimeMs = mNormalFrameCount * 2 * 1000 / mSampleRate;
    mWaitTimeMs = mNormalFrameCount * 1000 / mSampleRate;
    for (const auto& track : mOutputTracks) {
        const auto strong = track->thread().promote();
        if (strong != 0) {
            uint32_t waitTimeMs = (strong->frameCount() * 2 * 1000) / strong->sampleRate();
            uint32_t waitTimeMs = (strong->frameCount() * 1000) / strong->sampleRate();
            if (waitTimeMs < mWaitTimeMs) {
                mWaitTimeMs = waitTimeMs;
            }
+2 −1
Original line number Diff line number Diff line
@@ -2341,7 +2341,8 @@ OutputTrack::OutputTrack(
              sampleRate, format, channelMask, frameCount,
              nullptr /* buffer */, (size_t)0 /* bufferSize */, nullptr /* sharedBuffer */,
              AUDIO_SESSION_NONE, getpid(), attributionSource, AUDIO_OUTPUT_FLAG_NONE,
              TYPE_OUTPUT),
              TYPE_OUTPUT, AUDIO_PORT_HANDLE_NONE,
              /*frameCountToBeReady*/ playbackThread->frameCount()),
    mActive(false), mSourceThread(sourceThread)
{
    if (mCblk != NULL) {