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

Commit a23f17ac authored by Eric Laurent's avatar Eric Laurent
Browse files

audioflinger: fix direct output underrun

Underruns on tracks handled by a direct or offloaded
threads were not properly reported to the applications
causing a failure to automatically recover.

Bug: 11535001.
Change-Id: I7a8696b4d646f78b16710addfe7c108d0dd0038d
parent 5c7ffaed
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -3673,6 +3673,9 @@ AudioFlinger::PlaybackThread::mixer_state AudioFlinger::DirectOutputThread::prep
                if (--(track->mRetryCount) <= 0) {
                    ALOGV("BUFFER TIMEOUT: remove(%d) from active list", track->name());
                    tracksToRemove->add(track);
                    // indicate to client process that the track was disabled because of underrun;
                    // it will then automatically call start() when data is available
                    android_atomic_or(CBLK_DISABLED, &cblk->mFlags);
                } else if (last) {
                    mixerStatus = MIXER_TRACKS_ENABLED;
                }
@@ -4094,6 +4097,9 @@ AudioFlinger::PlaybackThread::mixer_state AudioFlinger::OffloadThread::prepareTr
                    ALOGV("OffloadThread: BUFFER TIMEOUT: remove(%d) from active list",
                          track->name());
                    tracksToRemove->add(track);
                    // indicate to client process that the track was disabled because of underrun;
                    // it will then automatically call start() when data is available
                    android_atomic_or(CBLK_DISABLED, &cblk->mFlags);
                } else if (last){
                    mixerStatus = MIXER_TRACKS_ENABLED;
                }