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

Commit af3ec7c9 authored by Eric Laurent's avatar Eric Laurent
Browse files

audioflinger: fix OutputTrack initial check

Call initCheck() on newly created OutputTrack in
DuplicatingThread::addOutputTrack() to make sure that
the track is successfully attached to the AudioMixer.

Also make invalid track name always fatal in AudioMixer::deleteTrackName().

Bug: 29953737
Change-Id: I47f2517bd53de940e125391de99c40611ad0fc9d
parent 3e5605b8
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -430,7 +430,7 @@ void AudioMixer::deleteTrackName(int name)
{
    ALOGV("AudioMixer::deleteTrackName(%d)", name);
    name -= TRACK0;
    ALOG_ASSERT(uint32_t(name) < MAX_NUM_TRACKS, "bad track name %d", name);
    LOG_ALWAYS_FATAL_IF(name < 0 || name >= (int)MAX_NUM_TRACKS, "bad track name %d", name);
    ALOGV("deleteTrackName(%d)", name);
    track_t& track(mState.tracks[ name ]);
    if (track.enabled) {
+8 −5
Original line number Diff line number Diff line
@@ -5772,13 +5772,16 @@ void AudioFlinger::DuplicatingThread::addOutputTrack(MixerThread *thread)
                                            mChannelMask,
                                            frameCount,
                                            IPCThreadState::self()->getCallingUid());
    if (outputTrack->cblk() != NULL) {
    status_t status = outputTrack != 0 ? outputTrack->initCheck() : (status_t) NO_MEMORY;
    if (status != NO_ERROR) {
        ALOGE("addOutputTrack() initCheck failed %d", status);
        return;
    }
    thread->setStreamVolume(AUDIO_STREAM_PATCH, 1.0f);
    mOutputTracks.add(outputTrack);
    ALOGV("addOutputTrack() track %p, on thread %p", outputTrack.get(), thread);
    updateWaitTime_l();
}
}

void AudioFlinger::DuplicatingThread::removeOutputTrack(MixerThread *thread)
{