• Home
  • Raw
  • Download

Lines Matching refs:outputDesc

598         sp<AudioOutputDescriptor> outputDesc = mOutputs.valueFor(output);  in createTelephonyPatch()  local
599 ALOG_ASSERT(!outputDesc->isDuplicated(), "%s() %s device output %d is duplicated", __func__, in createTelephonyPatch()
601 patchBuilder.addSource(outputDesc, { .stream = AUDIO_STREAM_PATCH }); in createTelephonyPatch()
798 sp<SwAudioOutputDescriptor> outputDesc = mOutputs.valueAt(i); in setForceUse() local
799 DeviceVector newDevices = getNewOutputDevices(outputDesc, true /*fromCache*/); in setForceUse()
800 if ((mEngine->getPhoneState() != AUDIO_MODE_IN_CALL) || (outputDesc != mPrimaryOutput)) { in setForceUse()
804 waitMs = setOutputDevices(outputDesc, newDevices, !newDevices.isEmpty(), delayMs); in setForceUse()
807 applyStreamVolumes(outputDesc, newDevices.types(), waitMs, true); in setForceUse()
1099 sp<SwAudioOutputDescriptor> outputDesc = mOutputs.valueFor(*output); in getOutputForAttr() local
1100 outputDesc->addClient(clientDesc); in getOutputForAttr()
1203 sp<SwAudioOutputDescriptor> outputDesc = in getOutputForDevices() local
1225 status = outputDesc->open(config, devices, stream, *flags, &output); in getOutputForDevices()
1229 (config->sample_rate != 0 && config->sample_rate != outputDesc->mSamplingRate) || in getOutputForDevices()
1230 (config->format != AUDIO_FORMAT_DEFAULT && config->format != outputDesc->mFormat) || in getOutputForDevices()
1231 (channelMask != 0 && channelMask != outputDesc->mChannelMask)) { in getOutputForDevices()
1234 outputDesc->mSamplingRate, config->format, outputDesc->mFormat, in getOutputForDevices()
1235 channelMask, outputDesc->mChannelMask); in getOutputForDevices()
1237 outputDesc->close(); in getOutputForDevices()
1246 outputDesc->mDirectOpenCount = 1; in getOutputForDevices()
1247 outputDesc->mDirectClientSession = session; in getOutputForDevices()
1249 addOutput(output, outputDesc); in getOutputForDevices()
1492 sp<SwAudioOutputDescriptor> outputDesc = mOutputs.valueFor(output); in selectOutput() local
1496 if (outputDesc->isDuplicated()) { in selectOutput()
1499 if ((kExcludedFlags & outputDesc->mFlags) != 0) { in selectOutput()
1506 outputDesc->mChannelMask & AUDIO_CHANNEL_HAPTIC_ALL); in selectOutput()
1511 && format == outputDesc->mFormat in selectOutput()
1512 && samplingRate == outputDesc->mSamplingRate) { in selectOutput()
1517 currentMatchCriteria[1] = popcount(outputDesc->mFlags & functionalFlags); in selectOutput()
1520 uint32_t outputChannelCount = audio_channel_count_from_out_mask(outputDesc->mChannelMask); in selectOutput()
1524 audio_channel_mask_get_representation(outputDesc->mChannelMask)) && in selectOutput()
1525 ((channelMask & outputDesc->mChannelMask) == channelMask)) { in selectOutput()
1533 samplingRate <= outputDesc->mSamplingRate) { in selectOutput()
1534 currentMatchCriteria[4] = outputDesc->mSamplingRate; in selectOutput()
1538 currentMatchCriteria[5] = popcount(outputDesc->mFlags & performanceFlags); in selectOutput()
1544 AudioPort::formatDistance(format, outputDesc->mFormat); in selectOutput()
1548 currentMatchCriteria[7] = outputDesc->mFlags & AUDIO_OUTPUT_FLAG_PRIMARY; in selectOutput()
1571 sp<SwAudioOutputDescriptor> outputDesc = mOutputs.getOutputForClient(portId); in startOutput() local
1572 if (outputDesc == 0) { in startOutput()
1576 sp<TrackClientDescriptor> client = outputDesc->getClient(portId); in startOutput()
1579 outputDesc->mIoHandle, client->stream(), client->session()); in startOutput()
1581 status_t status = outputDesc->start(); in startOutput()
1587 status = startSource(outputDesc, client, &delayMs); in startOutput()
1590 outputDesc->stop(); in startOutput()
1600 status_t AudioPolicyManager::startSource(const sp<SwAudioOutputDescriptor>& outputDesc, in startSource() argument
1627 bool force = !outputDesc->isActive() && in startSource()
1628 (outputDesc->getPatchHandle() == AUDIO_PATCH_HANDLE_NONE); in startSource()
1631 sp<AudioPolicyMix> policyMix = outputDesc->mPolicyMix.promote(); in startSource()
1650 const uint32_t outputLatencyMs = outputDesc->latency(); in startSource()
1651 bool requiresMuteCheck = outputDesc->isActive(outputLatencyMs * 2); // account for drain in startSource()
1656 outputDesc->setClientActive(client, true); in startSource()
1659 if (outputDesc->clientsList(true /*activeOnly*/).size() == 1 && in startSource()
1665 devices = getNewOutputDevices(outputDesc, false /*fromCache*/); in startSource()
1667 if (devices != outputDesc->devices()) { in startSource()
1668 checkStrategyRoute(clientStrategy, outputDesc->mIoHandle); in startSource()
1676 if (outputDesc->getActivityCount(clientVolSrc) == 1 || !devices.isEmpty()) { in startSource()
1679 devices = getNewOutputDevices(outputDesc, false /*fromCache*/); in startSource()
1688 if (desc != outputDesc) { in startSource()
1692 const bool sharedDevice = outputDesc->sharesHwModuleWith(desc) in startSource()
1726 setOutputDevices(outputDesc, devices, force, 0, NULL, requiresMuteCheck); in startSource()
1731 curves.getVolumeIndex(outputDesc->devices().types()), in startSource()
1732 outputDesc, in startSource()
1733 outputDesc->devices().types()); in startSource()
1759 setStrategyMute(streamToStrategy(AUDIO_STREAM_ALARM), true, outputDesc); in startSource()
1780 sp<SwAudioOutputDescriptor> outputDesc = mOutputs.getOutputForClient(portId); in stopOutput() local
1781 if (outputDesc == 0) { in stopOutput()
1785 sp<TrackClientDescriptor> client = outputDesc->getClient(portId); in stopOutput()
1788 outputDesc->mIoHandle, client->stream(), client->session()); in stopOutput()
1790 status_t status = stopSource(outputDesc, client); in stopOutput()
1793 outputDesc->stop(); in stopOutput()
1798 status_t AudioPolicyManager::stopSource(const sp<SwAudioOutputDescriptor>& outputDesc, in stopSource() argument
1807 if (outputDesc->getActivityCount(clientVolSrc) > 0) { in stopSource()
1808 if (outputDesc->getActivityCount(clientVolSrc) == 1) { in stopSource()
1811 sp<AudioPolicyMix> policyMix = outputDesc->mPolicyMix.promote(); in stopSource()
1812 if (audio_is_remote_submix_device(outputDesc->devices().types()) && in stopSource()
1828 outputDesc->setClientActive(client, false); in stopSource()
1831 if (outputDesc->getActivityCount(clientVolSrc) == 0 || forceDeviceUpdate) { in stopSource()
1832 outputDesc->setStopTime(client, systemTime()); in stopSource()
1833 DeviceVector newDevices = getNewOutputDevices(outputDesc, false /*fromCache*/); in stopSource()
1839 setOutputDevices(outputDesc, newDevices, false, outputDesc->latency()*2); in stopSource()
1843 uint32_t delayMs = outputDesc->latency()*2; in stopSource()
1846 if (desc != outputDesc && in stopSource()
1848 outputDesc->sharesHwModuleWith(desc) && in stopSource()
1867 setStrategyMute(streamToStrategy(AUDIO_STREAM_ALARM), false, outputDesc); in stopSource()
1884 sp<SwAudioOutputDescriptor> outputDesc = mOutputs.getOutputForClient(portId); in releaseOutput() local
1885 if (outputDesc == 0) { in releaseOutput()
1896 ALOGV("releaseOutput() %d", outputDesc->mIoHandle); in releaseOutput()
1898 if (outputDesc->mFlags & AUDIO_OUTPUT_FLAG_DIRECT) { in releaseOutput()
1899 if (outputDesc->mDirectOpenCount <= 0) { in releaseOutput()
1901 outputDesc->mDirectOpenCount, outputDesc->mIoHandle); in releaseOutput()
1904 if (--outputDesc->mDirectOpenCount == 0) { in releaseOutput()
1905 closeOutput(outputDesc->mIoHandle); in releaseOutput()
1912 outputDesc->removeClient(portId); in releaseOutput()
3359 sp<SwAudioOutputDescriptor> outputDesc = mOutputs.getOutputFromId(patch->sources[0].id); in createAudioPatch() local
3360 if (outputDesc == NULL) { in createAudioPatch()
3364 ALOG_ASSERT(!outputDesc->isDuplicated(),"duplicated output %d in source in ports", in createAudioPatch()
3365 outputDesc->mIoHandle); in createAudioPatch()
3388 if (!outputDesc->mProfile->isCompatibleProfile(DeviceVector(devDesc), in createAudioPatch()
3408 devices.types(), outputDesc->mIoHandle); in createAudioPatch()
3409 setOutputDevices(outputDesc, devices, true, 0, handle); in createAudioPatch()
3521 sp<AudioOutputDescriptor> outputDesc = mOutputs.valueFor(output); in createAudioPatch() local
3522 if (outputDesc->isDuplicated()) { in createAudioPatch()
3525 outputDesc->toAudioPortConfig(&newPatch.sources[1], &patch->sources[0]); in createAudioPatch()
3568 sp<SwAudioOutputDescriptor> outputDesc = mOutputs.getOutputFromId(patch->sources[0].id); in releaseAudioPatch() local
3569 if (outputDesc == NULL) { in releaseAudioPatch()
3574 setOutputDevices(outputDesc, in releaseAudioPatch()
3575 getNewOutputDevices(outputDesc, true /*fromCache*/), in releaseAudioPatch()
3633 sp<SwAudioOutputDescriptor> outputDesc = mOutputs.getOutputFromId(config->id); in setAudioPortConfig() local
3634 if (outputDesc == NULL) { in setAudioPortConfig()
3637 ALOG_ASSERT(!outputDesc->isDuplicated(), in setAudioPortConfig()
3639 outputDesc->mIoHandle); in setAudioPortConfig()
3640 audioPortConfig = outputDesc; in setAudioPortConfig()
3709 sp<SwAudioOutputDescriptor> outputDesc = mOutputs.valueAt(j); in checkStrategyRoute() local
3710 if (!outputDesc->isStrategyActive(ps)) { in checkStrategyRoute()
3722 outputDesc, getNewOutputDevices(outputDesc, false /*fromCache*/), false); in checkStrategyRoute()
3732 sp<AudioOutputDescriptor> outputDesc = mOutputs.valueAt(i); in clearSessionRoutes() local
3733 for (const auto& client : outputDesc->getClientIterable()) { in clearSessionRoutes()
3891 sp<SwAudioOutputDescriptor> outputDesc = mOutputs.valueFor(output); in connectAudioSource() local
3892 if (outputDesc->isDuplicated()) { in connectAudioSource()
3896 status_t status = outputDesc->start(); in connectAudioSource()
3907 patchBuilder.addSource(srcDevice).addSource(outputDesc, { .stream = stream }); in connectAudioSource()
3920 if (outputDesc->getClient(sourceDesc->portId()) != nullptr) { in connectAudioSource()
3924 outputDesc->addClient(sourceDesc); in connectAudioSource()
3927 status = startSource(outputDesc, sourceDesc, &delayMs); in connectAudioSource()
3931 outputDesc->removeClient(sourceDesc->portId()); in connectAudioSource()
3932 outputDesc->stop(); in connectAudioSource()
3935 sourceDesc->setSwOutput(outputDesc); in connectAudioSource()
4100 sp<SwAudioOutputDescriptor> outputDesc; in setSurroundFormatEnabled() local
4217 sp<SwAudioOutputDescriptor> outputDesc = sourceDesc->swOutput().promote(); in getSourceForAttributesOnOutput() local
4219 outputDesc != 0 && outputDesc->mIoHandle == output) { in getSourceForAttributesOnOutput()
4381 sp<SwAudioOutputDescriptor> outputDesc = new SwAudioOutputDescriptor(outProfile, in initialize() local
4384 status_t status = outputDesc->open(nullptr, DeviceVector(supportedDevice), in initialize()
4400 mPrimaryOutput = outputDesc; in initialize()
4402 addOutput(output, outputDesc); in initialize()
4403 setOutputDevices(outputDesc, in initialize()
4525 const sp<SwAudioOutputDescriptor>& outputDesc) in addOutput() argument
4527 mOutputs.add(output, outputDesc); in addOutput()
4528 applyStreamVolumes(outputDesc, AUDIO_DEVICE_NONE, 0 /* delayMs */, true /* force */); in addOutput()
5177 DeviceVector AudioPolicyManager::getNewOutputDevices(const sp<SwAudioOutputDescriptor>& outputDesc, in getNewOutputDevices() argument
5182 ssize_t index = mAudioPatches.indexOfKey(outputDesc->getPatchHandle()); in getNewOutputDevices()
5187 outputDesc->devices().toString().c_str(), outputDesc->getPatchHandle()); in getNewOutputDevices()
5188 return outputDesc->devices(); in getNewOutputDevices()
5196 findPreferredDevice(outputDesc, PRODUCT_STRATEGY_NONE, active, mAvailableOutputDevices); in getNewOutputDevices()
5203 device = mPolicyMixes.getDeviceAndMixForOutput(outputDesc, mAvailableOutputDevices); in getNewOutputDevices()
5213 (isInCall() || mOutputs.isStrategyActiveOnSameModule(productStrategy, outputDesc))) || in getNewOutputDevices()
5215 mOutputs.isStrategyActiveOnSameModule(productStrategy, outputDesc)) || in getNewOutputDevices()
5216 outputDesc->isStrategyActive(productStrategy)) { in getNewOutputDevices()
5286 sp<AudioOutputDescriptor> outputDesc = mOutputs.valueFor(output); in getDevicesForStream() local
5287 if (outputDesc->isActive(toVolumeSource(curStream))) { in getDevicesForStream()
5288 activeDevices.merge(outputDesc->devices()); in getDevicesForStream()
5383 uint32_t AudioPolicyManager::checkDeviceMuteStrategies(const sp<AudioOutputDescriptor>& outputDesc, in checkDeviceMuteStrategies() argument
5390 if (outputDesc->isDuplicated()) { in checkDeviceMuteStrategies()
5395 DeviceVector devices = outputDesc->devices(); in checkDeviceMuteStrategies()
5396 bool shouldMute = outputDesc->isActive() && (devices.size() >= 2); in checkDeviceMuteStrategies()
5403 curDevices = curDevices.filter(outputDesc->supportedDevices()); in checkDeviceMuteStrategies()
5407 if (mute && !outputDesc->isStrategyMutedByDevice(productStrategy)) { in checkDeviceMuteStrategies()
5409 outputDesc->setStrategyMutedByDevice(productStrategy, true); in checkDeviceMuteStrategies()
5410 } else if (!mute && outputDesc->isStrategyMutedByDevice(productStrategy)) { in checkDeviceMuteStrategies()
5412 outputDesc->setStrategyMutedByDevice(productStrategy, false); in checkDeviceMuteStrategies()
5418 if (!desc->supportedDevices().containsAtLeastOne(outputDesc->supportedDevices())) { in checkDeviceMuteStrategies()
5442 if (outputDesc->isActive() && (devices != prevDevices)) { in checkDeviceMuteStrategies()
5443 uint32_t tempMuteWaitMs = outputDesc->latency() * 2; in checkDeviceMuteStrategies()
5445 uint32_t tempMuteDurationMs = outputDesc->latency() * 4; in checkDeviceMuteStrategies()
5449 for (const auto &activeVs : outputDesc->getActiveVolumeSources()) { in checkDeviceMuteStrategies()
5452 setVolumeSourceMute(activeVs, true, outputDesc, delayMs); in checkDeviceMuteStrategies()
5453 setVolumeSourceMute(activeVs, false, outputDesc, delayMs + tempMuteDurationMs, in checkDeviceMuteStrategies()
5467 uint32_t AudioPolicyManager::setOutputDevices(const sp<SwAudioOutputDescriptor>& outputDesc, in setOutputDevices() argument
5477 if (outputDesc->isDuplicated()) { in setOutputDevices()
5478 muteWaitMs = setOutputDevices(outputDesc->subOutput1(), devices, force, delayMs, in setOutputDevices()
5480 muteWaitMs += setOutputDevices(outputDesc->subOutput2(), devices, force, delayMs, in setOutputDevices()
5486 DeviceVector filteredDevices = outputDesc->filterSupportedDevices(devices); in setOutputDevices()
5487 DeviceVector prevDevices = outputDesc->devices(); in setOutputDevices()
5501 outputDesc->setDevices(filteredDevices); in setOutputDevices()
5506 muteWaitMs = checkDeviceMuteStrategies(outputDesc, prevDevices, delayMs); in setOutputDevices()
5519 !force && outputDesc->getPatchHandle() != 0) { in setOutputDevices()
5521 filteredDevices.toString().c_str(), force, outputDesc->getPatchHandle()); in setOutputDevices()
5529 resetOutputDevice(outputDesc, delayMs, NULL); in setOutputDevices()
5532 patchBuilder.addSource(outputDesc); in setOutputDevices()
5538 installPatch(__func__, patchHandle, outputDesc.get(), patchBuilder.patch(), delayMs); in setOutputDevices()
5542 applyStreamVolumes(outputDesc, filteredDevices.types(), delayMs); in setOutputDevices()
5547 status_t AudioPolicyManager::resetOutputDevice(const sp<AudioOutputDescriptor>& outputDesc, in resetOutputDevice() argument
5555 index = mAudioPatches.indexOfKey(outputDesc->getPatchHandle()); in resetOutputDevice()
5563 outputDesc->setPatchHandle(AUDIO_PATCH_HANDLE_NONE); in resetOutputDevice()
5818 const sp<AudioOutputDescriptor>& outputDesc, in checkAndSetVolume() argument
5824 if (outputDesc->isMuted(volumeSource)) { in checkAndSetVolume()
5826 outputDesc->getMuteCount(volumeSource), outputDesc->isActive(volumeSource)); in checkAndSetVolume()
5846 device = outputDesc->devices().types(); in checkAndSetVolume()
5850 if (outputDesc->isFixedVolume(device) || in checkAndSetVolume()
5855 outputDesc->setVolume(volumeDb, volumeSource, curves.getStreamTypes(), device, delayMs, force); in checkAndSetVolume()
5873 void AudioPolicyManager::applyStreamVolumes(const sp<AudioOutputDescriptor>& outputDesc, in applyStreamVolumes() argument
5882 curves.getVolumeIndex(device), outputDesc, device, delayMs, force); in applyStreamVolumes()
5888 const sp<AudioOutputDescriptor>& outputDesc, in setStrategyMute() argument
5895 toString(attributes).c_str(), on, outputDesc->getId()); in setStrategyMute()
5902 setVolumeSourceMute(source, on, outputDesc, delayMs, device); in setStrategyMute()
5909 const sp<AudioOutputDescriptor>& outputDesc, in setVolumeSourceMute() argument
5914 device = outputDesc->devices().types(); in setVolumeSourceMute()
5918 if (!outputDesc->isMuted(volumeSource)) { in setVolumeSourceMute()
5923 checkAndSetVolume(curves, volumeSource, 0, outputDesc, device, delayMs); in setVolumeSourceMute()
5928 outputDesc->incMuteCount(volumeSource); in setVolumeSourceMute()
5930 if (!outputDesc->isMuted(volumeSource)) { in setVolumeSourceMute()
5934 if (outputDesc->decMuteCount(volumeSource) == 0) { in setVolumeSourceMute()
5937 outputDesc, in setVolumeSourceMute()