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

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

Merge "audio: fix crashes upon USB device connection" into lmp-dev

parents 1c8d1e40 cf817a23
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
@@ -2639,12 +2639,9 @@ bool AudioFlinger::PlaybackThread::threadLoop()

    threadLoop_exit();

    // for DuplicatingThread, standby mode is handled by the outputTracks, otherwise ...
    if (mType == MIXER || mType == DIRECT || mType == OFFLOAD) {
        // put output stream into standby mode
    if (!mStandby) {
            mOutput->stream->common.standby(&mOutput->stream->common);
        }
        threadLoop_standby();
        mStandby = true;
    }

    releaseWakeLock();
+7 −3
Original line number Diff line number Diff line
@@ -240,10 +240,14 @@ status_t AudioPolicyManager::setDeviceConnectionState(audio_devices_t device,
            // register new device as available
            index = mAvailableOutputDevices.add(devDesc);
            if (index >= 0) {
                mAvailableOutputDevices[index]->mId = nextUniqueId();
                sp<HwModule> module = getModuleForDevice(device);
                ALOG_ASSERT(module != NULL, "setDeviceConnectionState():"
                        "could not find HW module for device %08x", device);
                if (module == 0) {
                    ALOGD("setDeviceConnectionState() could not find HW module for device %08x",
                          device);
                    mAvailableOutputDevices.remove(devDesc);
                    return INVALID_OPERATION;
                }
                mAvailableOutputDevices[index]->mId = nextUniqueId();
                mAvailableOutputDevices[index]->mModule = module;
            } else {
                return NO_MEMORY;