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

Commit c9c49cdf authored by yucliu's avatar yucliu Committed by Yuchen Liu
Browse files

Add flag DIRECT to track flags for track running on DirectOutputThread

If the playback thread is DirectOutputThread, add
AUDIO_OUTPUT_FLAG_DIRECT to the track's flags. This allows HAL to
receive `Flush`, as well as many other control signals, when client
sends the commands.

Bug: 111196161
Test: On device
Change-Id: I48fae1e05cfb7aabf53a050c72ec78d18e478b0a
parent 6559924d
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -2356,10 +2356,20 @@ sp<AudioFlinger::PlaybackThread::Track> AudioFlinger::PlaybackThread::createTrac
            }
        }

        // Set DIRECT flag if current thread is DirectOutputThread. This can
        // happen when the playback is rerouted to direct output thread by
        // dynamic audio policy.
        // Do NOT report the flag changes back to client, since the client
        // doesn't explicitly request a direct flag.
        audio_output_flags_t trackFlags = *flags;
        if (mType == DIRECT) {
            trackFlags = static_cast<audio_output_flags_t>(trackFlags | AUDIO_OUTPUT_FLAG_DIRECT);
        }

        track = new Track(this, client, streamType, attr, sampleRate, format,
                          channelMask, frameCount,
                          nullptr /* buffer */, (size_t)0 /* bufferSize */, sharedBuffer,
                          sessionId, creatorPid, uid, *flags, TrackBase::TYPE_DEFAULT, portId);
                          sessionId, creatorPid, uid, trackFlags, TrackBase::TYPE_DEFAULT, portId);

        lStatus = track != 0 ? track->initCheck() : (status_t) NO_MEMORY;
        if (lStatus != NO_ERROR) {