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

Commit 51c1e0e8 authored by Andreas Huber's avatar Andreas Huber
Browse files

This reverts an earlier change 4aeec2da39fce4de9b07b694d59fd308ffb3d491

Instead of returning 0-filled buffers after EOS from AudioTrack we do this
work in AudioOutput instead. That way the EOS signal (0 frames returned)
is preserved in AudioCache which otherwise would lead to a heap size overflow
filling everything with zeroes.

Change-Id: I7e07429ba887957a4340dd4b21eef4bba76248cd
related-to-bug: 3514073
parent 94baecca
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -1449,8 +1449,15 @@ void MediaPlayerService::AudioOutput::CallbackWrapper(
    size_t actualSize = (*me->mCallback)(
            me, buffer->raw, buffer->size, me->mCallbackCookie);

    buffer->size = actualSize;
    if (actualSize == 0 && buffer->size > 0) {
        // We've reached EOS but the audio track is not stopped yet,
        // keep playing silence.

        memset(buffer->raw, 0, buffer->size);
        actualSize = buffer->size;
    }

    buffer->size = actualSize;
}

int MediaPlayerService::AudioOutput::getSessionId()
+1 −3
Original line number Diff line number Diff line
@@ -306,9 +306,7 @@ size_t AudioPlayer::fillBuffer(void *data, size_t size) {
    }

    if (mReachedEOS) {
        memset(data, 0, size);

        return size;
        return 0;
    }

    size_t size_done = 0;