Loading services/audiopolicy/common/managerdefinitions/include/HwModule.h +4 −0 Original line number Diff line number Diff line Loading @@ -52,8 +52,12 @@ public: devices.merge(mDynamicDevices); return devices; } std::string getTagForDevice(audio_devices_t device, const String8 &address = String8(), audio_format_t codec = AUDIO_FORMAT_DEFAULT); void addDynamicDevice(const sp<DeviceDescriptor> &device) { device->setDynamic(); mDynamicDevices.add(device); } Loading services/audiopolicy/common/managerdefinitions/src/DeviceDescriptor.cpp +3 −1 Original line number Diff line number Diff line Loading @@ -49,11 +49,13 @@ DeviceDescriptor::DeviceDescriptor(audio_devices_t type, { } // Let DeviceDescriptorBase initialize the address since it handles specific cases like // legacy remote submix where "0" is added as default address. DeviceDescriptor::DeviceDescriptor(const AudioDeviceTypeAddr &deviceTypeAddr, const std::string &tagName, const FormatVector &encodedFormats) : DeviceDescriptorBase(deviceTypeAddr), mTagName(tagName), mEncodedFormats(encodedFormats), mDeclaredAddress(deviceTypeAddr.getAddress()) mDeclaredAddress(DeviceDescriptorBase::address()) { mCurrentEncodedFormat = AUDIO_FORMAT_DEFAULT; /* If framework runs against a pre 5.0 Audio HAL, encoded formats are absent from the config. Loading services/audiopolicy/common/managerdefinitions/src/HwModule.cpp +12 −2 Original line number Diff line number Diff line Loading @@ -41,6 +41,14 @@ HwModule::~HwModule() } } std::string HwModule::getTagForDevice(audio_devices_t device, const String8 &address, audio_format_t codec) { DeviceVector declaredDevices = getDeclaredDevices(); sp<DeviceDescriptor> deviceDesc = declaredDevices.getDevice(device, address, codec); return deviceDesc ? deviceDesc->getTagName() : std::string{}; } status_t HwModule::addOutputProfile(const std::string& name, const audio_config_t *config, audio_devices_t device, const String8& address) { Loading @@ -49,7 +57,8 @@ status_t HwModule::addOutputProfile(const std::string& name, const audio_config_ profile->addAudioProfile(new AudioProfile(config->format, config->channel_mask, config->sample_rate)); sp<DeviceDescriptor> devDesc = new DeviceDescriptor(device, "" /*tagName*/, address.string()); sp<DeviceDescriptor> devDesc = new DeviceDescriptor(device, getTagForDevice(device), address.string()); addDynamicDevice(devDesc); // Reciprocally attach the device to the module devDesc->attach(this); Loading Loading @@ -116,7 +125,8 @@ status_t HwModule::addInputProfile(const std::string& name, const audio_config_t profile->addAudioProfile(new AudioProfile(config->format, config->channel_mask, config->sample_rate)); sp<DeviceDescriptor> devDesc = new DeviceDescriptor(device, "" /*tagName*/, address.string()); sp<DeviceDescriptor> devDesc = new DeviceDescriptor(device, getTagForDevice(device), address.string()); addDynamicDevice(devDesc); // Reciprocally attach the device to the module devDesc->attach(this); Loading Loading
services/audiopolicy/common/managerdefinitions/include/HwModule.h +4 −0 Original line number Diff line number Diff line Loading @@ -52,8 +52,12 @@ public: devices.merge(mDynamicDevices); return devices; } std::string getTagForDevice(audio_devices_t device, const String8 &address = String8(), audio_format_t codec = AUDIO_FORMAT_DEFAULT); void addDynamicDevice(const sp<DeviceDescriptor> &device) { device->setDynamic(); mDynamicDevices.add(device); } Loading
services/audiopolicy/common/managerdefinitions/src/DeviceDescriptor.cpp +3 −1 Original line number Diff line number Diff line Loading @@ -49,11 +49,13 @@ DeviceDescriptor::DeviceDescriptor(audio_devices_t type, { } // Let DeviceDescriptorBase initialize the address since it handles specific cases like // legacy remote submix where "0" is added as default address. DeviceDescriptor::DeviceDescriptor(const AudioDeviceTypeAddr &deviceTypeAddr, const std::string &tagName, const FormatVector &encodedFormats) : DeviceDescriptorBase(deviceTypeAddr), mTagName(tagName), mEncodedFormats(encodedFormats), mDeclaredAddress(deviceTypeAddr.getAddress()) mDeclaredAddress(DeviceDescriptorBase::address()) { mCurrentEncodedFormat = AUDIO_FORMAT_DEFAULT; /* If framework runs against a pre 5.0 Audio HAL, encoded formats are absent from the config. Loading
services/audiopolicy/common/managerdefinitions/src/HwModule.cpp +12 −2 Original line number Diff line number Diff line Loading @@ -41,6 +41,14 @@ HwModule::~HwModule() } } std::string HwModule::getTagForDevice(audio_devices_t device, const String8 &address, audio_format_t codec) { DeviceVector declaredDevices = getDeclaredDevices(); sp<DeviceDescriptor> deviceDesc = declaredDevices.getDevice(device, address, codec); return deviceDesc ? deviceDesc->getTagName() : std::string{}; } status_t HwModule::addOutputProfile(const std::string& name, const audio_config_t *config, audio_devices_t device, const String8& address) { Loading @@ -49,7 +57,8 @@ status_t HwModule::addOutputProfile(const std::string& name, const audio_config_ profile->addAudioProfile(new AudioProfile(config->format, config->channel_mask, config->sample_rate)); sp<DeviceDescriptor> devDesc = new DeviceDescriptor(device, "" /*tagName*/, address.string()); sp<DeviceDescriptor> devDesc = new DeviceDescriptor(device, getTagForDevice(device), address.string()); addDynamicDevice(devDesc); // Reciprocally attach the device to the module devDesc->attach(this); Loading Loading @@ -116,7 +125,8 @@ status_t HwModule::addInputProfile(const std::string& name, const audio_config_t profile->addAudioProfile(new AudioProfile(config->format, config->channel_mask, config->sample_rate)); sp<DeviceDescriptor> devDesc = new DeviceDescriptor(device, "" /*tagName*/, address.string()); sp<DeviceDescriptor> devDesc = new DeviceDescriptor(device, getTagForDevice(device), address.string()); addDynamicDevice(devDesc); // Reciprocally attach the device to the module devDesc->attach(this); Loading