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

Commit 94dacaf1 authored by John Grossman's avatar John Grossman Committed by Mike Lockwood
Browse files

Add a missing NULL check.

The get_next_write_timestamp method introduced to the audio HAL is optional.
HALs which do not implement it leave it set to NULL.  Callers (there is
currently only one in the AudioMixer code) need to be certain to check for NULL
before invoking it.

Change-Id: I88ba43bb53bec081c98c9a8842936c4fbfdd44f6
parent 500e510c
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -2033,8 +2033,13 @@ bool AudioFlinger::MixerThread::threadLoop()
        if (LIKELY(mixerStatus == MIXER_TRACKS_READY)) {
            // obtain the presentation timestamp of the next output buffer
            int64_t pts;
            status_t status = mOutput->stream->get_next_write_timestamp(
            status_t status = INVALID_OPERATION;

            if (NULL != mOutput->stream->get_next_write_timestamp) {
                status = mOutput->stream->get_next_write_timestamp(
                        mOutput->stream, &pts);
            }

            if (status != NO_ERROR) {
                pts = AudioBufferProvider::kInvalidPTS;
            }