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

Commit 1a0c3abf authored by Vlad Popa's avatar Vlad Popa
Browse files

CSD: Fix possible crash when accessing nullptr

The output sink can be cleared before calling
start/stopMelComputation_l. Add check for nullptr.

Test: SoundDoseInteractiveTest
Bug: 271013496
Bug: 273898338
Change-Id: I5778de2ebadab770dab5d9f8a6613b1144cc3fe5
parent 8e987d61
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -3488,15 +3488,19 @@ void AudioFlinger::PlaybackThread::startMelComputation_l(
        const sp<audio_utils::MelProcessor>& processor)
{
    auto outputSink = static_cast<AudioStreamOutSink*>(mOutputSink.get());
    if (outputSink != nullptr) {
        outputSink->startMelComputation(processor);
    }
}

// stopMelComputation_l() must be called with AudioFlinger::mLock held
void AudioFlinger::PlaybackThread::stopMelComputation_l()
{
    auto outputSink = static_cast<AudioStreamOutSink*>(mOutputSink.get());
    if (outputSink != nullptr) {
        outputSink->stopMelComputation();
    }
}

void AudioFlinger::PlaybackThread::threadLoop_drain()
{