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

Commit 21afe805 authored by Andy Hung's avatar Andy Hung
Browse files

NuPlayerRenderer: Ensure cancelAudioOffloadPauseTimeout cancels timeout

Bug: 28121584
Change-Id: Ic8887851544f769e0cd0717d97075931ab73df3f
parent 5cc32c5e
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -1722,11 +1722,17 @@ void NuPlayer::Renderer::startAudioOffloadPauseTimeout() {
}

void NuPlayer::Renderer::cancelAudioOffloadPauseTimeout() {
    if (offloadingAudio()) {
    // We may have called startAudioOffloadPauseTimeout() without
    // the AudioSink open and with offloadingAudio enabled.
    //
    // When we cancel, it may be that offloadingAudio is subsequently disabled, so regardless
    // we always release the wakelock and increment the pause timeout generation.
    //
    // Note: The acquired wakelock prevents the device from suspending
    // immediately after offload pause (in case a resume happens shortly thereafter).
    mWakeLock->release(true);
    ++mAudioOffloadPauseTimeoutGeneration;
}
}

status_t NuPlayer::Renderer::onOpenAudioSink(
        const sp<AMessage> &format,