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

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

Merge "MelProcessor: only log dosage on audio actually delivered"

parents cc7c8625 58e32870
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -3339,17 +3339,19 @@ ssize_t AudioFlinger::PlaybackThread::threadLoop_write()

        if (framesWritten > 0) {
            bytesWritten = framesWritten * mFrameSize;

            // Send to MelProcessor for sound dose measurement.
            auto processor = mMelProcessor.load();
            if (processor) {
                processor->process((char *)mSinkBuffer + offset, bytesWritten);
            }

#ifdef TEE_SINK
            mTee.write((char *)mSinkBuffer + offset, framesWritten);
#endif
        } else {
            bytesWritten = framesWritten;
        }

        auto processor = mMelProcessor.load();
        if (processor) {
            processor->process((char *)mSinkBuffer + offset, bytesWritten);
        }
    // otherwise use the HAL / AudioStreamOut directly
    } else {
        // Direct output and offload threads