Loading services/audiopolicy/common/managerdefinitions/include/DeviceDescriptor.h +4 −3 Original line number Diff line number Diff line Loading @@ -76,11 +76,12 @@ public: audio_devices_t types() const { return mDeviceTypes; } // If 'address' is empty, a device with a non-empty address may be returned // if there is no device with the specified 'type' and empty address. sp<DeviceDescriptor> getDevice(audio_devices_t type, const String8 &address) const; DeviceVector getDevicesFromType(audio_devices_t types) const; DeviceVector getDevicesFromTypeMask(audio_devices_t types) const; sp<DeviceDescriptor> getDeviceFromId(audio_port_handle_t id) const; sp<DeviceDescriptor> getDeviceFromTagName(const String8 &tagName) const; DeviceVector getDevicesFromTypeAddr(audio_devices_t type, const String8& address) const; audio_devices_t getDevicesFromHwModule(audio_module_handle_t moduleHandle) const; Loading services/audiopolicy/common/managerdefinitions/include/HwModule.h +1 −1 Original line number Diff line number Diff line Loading @@ -107,7 +107,7 @@ public: sp<DeviceDescriptor> getDeviceDescriptor(const audio_devices_t device, const char *device_address, const char *device_name, bool matchAdress = true) const; bool matchAddress = true) const; status_t dump(int fd) const; }; Loading services/audiopolicy/common/managerdefinitions/src/DeviceDescriptor.cpp +7 −19 Original line number Diff line number Diff line Loading @@ -145,8 +145,8 @@ sp<DeviceDescriptor> DeviceVector::getDevice(audio_devices_t type, const String8 } } } ALOGV("DeviceVector::getDevice() for type %08x address %s found %p", type, address.string(), device.get()); ALOGV("DeviceVector::%s() for type %08x address \"%s\" found %p", __func__, type, address.string(), device.get()); return device; } Loading @@ -160,7 +160,7 @@ sp<DeviceDescriptor> DeviceVector::getDeviceFromId(audio_port_handle_t id) const return nullptr; } DeviceVector DeviceVector::getDevicesFromType(audio_devices_t type) const DeviceVector DeviceVector::getDevicesFromTypeMask(audio_devices_t type) const { DeviceVector devices; bool isOutput = audio_is_output_devices(type); Loading @@ -171,20 +171,8 @@ DeviceVector DeviceVector::getDevicesFromType(audio_devices_t type) const if ((isOutput == curIsOutput) && ((type & curType) != 0)) { devices.add(itemAt(i)); type &= ~curType; ALOGV("DeviceVector::getDevicesFromType() for type %x found %p", itemAt(i)->type(), itemAt(i).get()); } } return devices; } DeviceVector DeviceVector::getDevicesFromTypeAddr( audio_devices_t type, const String8& address) const { DeviceVector devices; for (const auto& device : *this) { if (device->type() == type && device->mAddress == address) { devices.add(device); ALOGV("DeviceVector::%s() for type %08x found %p", __func__, itemAt(i)->type(), itemAt(i).get()); } } return devices; Loading Loading @@ -253,7 +241,7 @@ void DeviceDescriptor::toAudioPortConfig(struct audio_port_config *dstConfig, void DeviceDescriptor::toAudioPort(struct audio_port *port) const { ALOGV("DeviceDescriptor::toAudioPort() handle %d type %x", mId, mDeviceType); ALOGV("DeviceDescriptor::toAudioPort() handle %d type %08x", mId, mDeviceType); AudioPort::toAudioPort(port); port->id = mId; toAudioPortConfig(&port->active_config); Loading Loading @@ -305,7 +293,7 @@ void DeviceDescriptor::log() const { std::string device; deviceToString(mDeviceType, device); ALOGI("Device id:%d type:0x%X:%s, addr:%s", mId, mDeviceType, device.c_str(), ALOGI("Device id:%d type:0x%08X:%s, addr:%s", mId, mDeviceType, device.c_str(), mAddress.string()); AudioPort::log(" "); Loading services/audiopolicy/common/managerdefinitions/src/HwModule.cpp +6 −11 Original line number Diff line number Diff line Loading @@ -278,9 +278,10 @@ sp <HwModule> HwModuleCollection::getModuleForDevice(audio_devices_t device) con sp<DeviceDescriptor> HwModuleCollection::getDeviceDescriptor(const audio_devices_t device, const char *device_address, const char *device_name, bool matchAdress) const bool matchAddress) const { String8 address = (device_address == nullptr) ? String8("") : String8(device_address); String8 address = (device_address == nullptr || !matchAddress) ? String8("") : String8(device_address); // handle legacy remote submix case where the address was not always specified if (device_distinguishes_on_address(device) && (address.length() == 0)) { address = String8("0"); Loading @@ -288,15 +289,9 @@ sp<DeviceDescriptor> HwModuleCollection::getDeviceDescriptor(const audio_devices for (const auto& hwModule : *this) { DeviceVector declaredDevices = hwModule->getDeclaredDevices(); DeviceVector deviceList = declaredDevices.getDevicesFromTypeAddr(device, address); if (!deviceList.isEmpty()) { return deviceList.itemAt(0); } if (!matchAdress) { deviceList = declaredDevices.getDevicesFromType(device); if (!deviceList.isEmpty()) { return deviceList.itemAt(0); } sp<DeviceDescriptor> deviceDesc = declaredDevices.getDevice(device, address); if (deviceDesc) { return deviceDesc; } } Loading services/audiopolicy/common/managerdefinitions/src/SessionRoute.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -129,7 +129,7 @@ audio_devices_t SessionRouteMap::getActiveDeviceForStream(audio_stream_type_t st if (streamType == route->mStreamType && route->isActiveOrChanged() && route->mDeviceDescriptor != 0) { device = route->mDeviceDescriptor->type(); if (!availableDevices.getDevicesFromType(device).isEmpty()) { if (!availableDevices.getDevicesFromTypeMask(device).isEmpty()) { break; } } Loading Loading
services/audiopolicy/common/managerdefinitions/include/DeviceDescriptor.h +4 −3 Original line number Diff line number Diff line Loading @@ -76,11 +76,12 @@ public: audio_devices_t types() const { return mDeviceTypes; } // If 'address' is empty, a device with a non-empty address may be returned // if there is no device with the specified 'type' and empty address. sp<DeviceDescriptor> getDevice(audio_devices_t type, const String8 &address) const; DeviceVector getDevicesFromType(audio_devices_t types) const; DeviceVector getDevicesFromTypeMask(audio_devices_t types) const; sp<DeviceDescriptor> getDeviceFromId(audio_port_handle_t id) const; sp<DeviceDescriptor> getDeviceFromTagName(const String8 &tagName) const; DeviceVector getDevicesFromTypeAddr(audio_devices_t type, const String8& address) const; audio_devices_t getDevicesFromHwModule(audio_module_handle_t moduleHandle) const; Loading
services/audiopolicy/common/managerdefinitions/include/HwModule.h +1 −1 Original line number Diff line number Diff line Loading @@ -107,7 +107,7 @@ public: sp<DeviceDescriptor> getDeviceDescriptor(const audio_devices_t device, const char *device_address, const char *device_name, bool matchAdress = true) const; bool matchAddress = true) const; status_t dump(int fd) const; }; Loading
services/audiopolicy/common/managerdefinitions/src/DeviceDescriptor.cpp +7 −19 Original line number Diff line number Diff line Loading @@ -145,8 +145,8 @@ sp<DeviceDescriptor> DeviceVector::getDevice(audio_devices_t type, const String8 } } } ALOGV("DeviceVector::getDevice() for type %08x address %s found %p", type, address.string(), device.get()); ALOGV("DeviceVector::%s() for type %08x address \"%s\" found %p", __func__, type, address.string(), device.get()); return device; } Loading @@ -160,7 +160,7 @@ sp<DeviceDescriptor> DeviceVector::getDeviceFromId(audio_port_handle_t id) const return nullptr; } DeviceVector DeviceVector::getDevicesFromType(audio_devices_t type) const DeviceVector DeviceVector::getDevicesFromTypeMask(audio_devices_t type) const { DeviceVector devices; bool isOutput = audio_is_output_devices(type); Loading @@ -171,20 +171,8 @@ DeviceVector DeviceVector::getDevicesFromType(audio_devices_t type) const if ((isOutput == curIsOutput) && ((type & curType) != 0)) { devices.add(itemAt(i)); type &= ~curType; ALOGV("DeviceVector::getDevicesFromType() for type %x found %p", itemAt(i)->type(), itemAt(i).get()); } } return devices; } DeviceVector DeviceVector::getDevicesFromTypeAddr( audio_devices_t type, const String8& address) const { DeviceVector devices; for (const auto& device : *this) { if (device->type() == type && device->mAddress == address) { devices.add(device); ALOGV("DeviceVector::%s() for type %08x found %p", __func__, itemAt(i)->type(), itemAt(i).get()); } } return devices; Loading Loading @@ -253,7 +241,7 @@ void DeviceDescriptor::toAudioPortConfig(struct audio_port_config *dstConfig, void DeviceDescriptor::toAudioPort(struct audio_port *port) const { ALOGV("DeviceDescriptor::toAudioPort() handle %d type %x", mId, mDeviceType); ALOGV("DeviceDescriptor::toAudioPort() handle %d type %08x", mId, mDeviceType); AudioPort::toAudioPort(port); port->id = mId; toAudioPortConfig(&port->active_config); Loading Loading @@ -305,7 +293,7 @@ void DeviceDescriptor::log() const { std::string device; deviceToString(mDeviceType, device); ALOGI("Device id:%d type:0x%X:%s, addr:%s", mId, mDeviceType, device.c_str(), ALOGI("Device id:%d type:0x%08X:%s, addr:%s", mId, mDeviceType, device.c_str(), mAddress.string()); AudioPort::log(" "); Loading
services/audiopolicy/common/managerdefinitions/src/HwModule.cpp +6 −11 Original line number Diff line number Diff line Loading @@ -278,9 +278,10 @@ sp <HwModule> HwModuleCollection::getModuleForDevice(audio_devices_t device) con sp<DeviceDescriptor> HwModuleCollection::getDeviceDescriptor(const audio_devices_t device, const char *device_address, const char *device_name, bool matchAdress) const bool matchAddress) const { String8 address = (device_address == nullptr) ? String8("") : String8(device_address); String8 address = (device_address == nullptr || !matchAddress) ? String8("") : String8(device_address); // handle legacy remote submix case where the address was not always specified if (device_distinguishes_on_address(device) && (address.length() == 0)) { address = String8("0"); Loading @@ -288,15 +289,9 @@ sp<DeviceDescriptor> HwModuleCollection::getDeviceDescriptor(const audio_devices for (const auto& hwModule : *this) { DeviceVector declaredDevices = hwModule->getDeclaredDevices(); DeviceVector deviceList = declaredDevices.getDevicesFromTypeAddr(device, address); if (!deviceList.isEmpty()) { return deviceList.itemAt(0); } if (!matchAdress) { deviceList = declaredDevices.getDevicesFromType(device); if (!deviceList.isEmpty()) { return deviceList.itemAt(0); } sp<DeviceDescriptor> deviceDesc = declaredDevices.getDevice(device, address); if (deviceDesc) { return deviceDesc; } } Loading
services/audiopolicy/common/managerdefinitions/src/SessionRoute.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -129,7 +129,7 @@ audio_devices_t SessionRouteMap::getActiveDeviceForStream(audio_stream_type_t st if (streamType == route->mStreamType && route->isActiveOrChanged() && route->mDeviceDescriptor != 0) { device = route->mDeviceDescriptor->type(); if (!availableDevices.getDevicesFromType(device).isEmpty()) { if (!availableDevices.getDevicesFromTypeMask(device).isEmpty()) { break; } } Loading