diff --git a/audio/aidl/default/Configuration.cpp b/audio/aidl/default/Configuration.cpp index 9131935f87..b9f1131eca 100644 --- a/audio/aidl/default/Configuration.cpp +++ b/audio/aidl/default/Configuration.cpp @@ -461,6 +461,10 @@ std::unique_ptr getUsbConfiguration() { // - no profiles specified // * "Test In", IN_AFE_PROXY // - no profiles specified +// * "Wired Headset", OUT_HEADSET +// - profile PCM 24-bit; STEREO; 48000 +// * "Wired Headset Mic", IN_HEADSET +// - profile PCM 24-bit; MONO; 48000 // // Mix ports: // * "test output", 1 max open, 1 max active stream @@ -476,7 +480,8 @@ std::unique_ptr getUsbConfiguration() { // // Routes: // "test output", "test fast output", "test compressed offload" -> "Test Out" -// "Test In" -> "test input" +// "test output" -> "Wired Headset" +// "Test In", "Wired Headset Mic" -> "test input" // // Initial port configs: // * "Test Out" device port: PCM 24-bit; STEREO; 48000 @@ -496,6 +501,14 @@ std::unique_ptr getStubConfiguration() { AudioChannelLayout::LAYOUT_STEREO, 48000, 0, false, createDeviceExt(AudioDeviceType::OUT_AFE_PROXY, 0))); + AudioPort headsetOutDevice = + createPort(c.nextPortId++, "Wired Headset", 0, false, + createDeviceExt(AudioDeviceType::OUT_HEADSET, 0, + AudioDeviceDescription::CONNECTION_ANALOG)); + headsetOutDevice.profiles.push_back( + createProfile(PcmType::INT_24_BIT, {AudioChannelLayout::LAYOUT_STEREO}, {48000})); + c.ports.push_back(headsetOutDevice); + AudioPort testInDevice = createPort(c.nextPortId++, "Test In", 0, true, createDeviceExt(AudioDeviceType::IN_AFE_PROXY, 0)); c.ports.push_back(testInDevice); @@ -504,6 +517,14 @@ std::unique_ptr getStubConfiguration() { AudioChannelLayout::LAYOUT_MONO, 48000, 0, true, createDeviceExt(AudioDeviceType::IN_AFE_PROXY, 0))); + AudioPort headsetInDevice = + createPort(c.nextPortId++, "Wired Headset Mic", 0, true, + createDeviceExt(AudioDeviceType::IN_HEADSET, 0, + AudioDeviceDescription::CONNECTION_ANALOG)); + headsetInDevice.profiles.push_back( + createProfile(PcmType::INT_24_BIT, {AudioChannelLayout::LAYOUT_MONO}, {48000})); + c.ports.push_back(headsetInDevice); + // Mix ports AudioPort testOutMix = @@ -549,7 +570,8 @@ std::unique_ptr getStubConfiguration() { c.routes.push_back( createRoute({testOutMix, testFastOutMix, compressedOffloadOutMix}, testOutDevice)); - c.routes.push_back(createRoute({testInDevice}, testInMIx)); + c.routes.push_back(createRoute({testOutMix}, headsetOutDevice)); + c.routes.push_back(createRoute({testInDevice, headsetInDevice}, testInMIx)); c.portConfigs.insert(c.portConfigs.end(), c.initialConfigs.begin(), c.initialConfigs.end()); diff --git a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp index 20062e94ad..ccf7cfc88d 100644 --- a/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp +++ b/audio/aidl/vts/VtsHalAudioCoreModuleTargetTest.cpp @@ -145,28 +145,36 @@ AudioDeviceAddress::Tag suggestDeviceAddressTag(const AudioDeviceDescription& de } AudioPort GenerateUniqueDeviceAddress(const AudioPort& port) { + // Point-to-point connections do not use addresses. + static const std::set kPointToPointConnections = { + AudioDeviceDescription::CONNECTION_ANALOG, AudioDeviceDescription::CONNECTION_HDMI, + AudioDeviceDescription::CONNECTION_HDMI_ARC, + AudioDeviceDescription::CONNECTION_HDMI_EARC, AudioDeviceDescription::CONNECTION_SPDIF}; static int nextId = 0; using Tag = AudioDeviceAddress::Tag; + const auto& deviceDescription = port.ext.get().device.type; AudioDeviceAddress address; - switch (suggestDeviceAddressTag(port.ext.get().device.type)) { - case Tag::id: - address = AudioDeviceAddress::make(std::to_string(++nextId)); - break; - case Tag::mac: - address = AudioDeviceAddress::make( - std::vector{1, 2, 3, 4, 5, static_cast(++nextId & 0xff)}); - break; - case Tag::ipv4: - address = AudioDeviceAddress::make( - std::vector{192, 168, 0, static_cast(++nextId & 0xff)}); - break; - case Tag::ipv6: - address = AudioDeviceAddress::make(std::vector{ - 0xfc00, 0x0123, 0x4567, 0x89ab, 0xcdef, 0, 0, ++nextId & 0xffff}); - break; - case Tag::alsa: - address = AudioDeviceAddress::make(std::vector{1, ++nextId}); - break; + if (kPointToPointConnections.count(deviceDescription.connection) == 0) { + switch (suggestDeviceAddressTag(deviceDescription)) { + case Tag::id: + address = AudioDeviceAddress::make(std::to_string(++nextId)); + break; + case Tag::mac: + address = AudioDeviceAddress::make( + std::vector{1, 2, 3, 4, 5, static_cast(++nextId & 0xff)}); + break; + case Tag::ipv4: + address = AudioDeviceAddress::make( + std::vector{192, 168, 0, static_cast(++nextId & 0xff)}); + break; + case Tag::ipv6: + address = AudioDeviceAddress::make(std::vector{ + 0xfc00, 0x0123, 0x4567, 0x89ab, 0xcdef, 0, 0, ++nextId & 0xffff}); + break; + case Tag::alsa: + address = AudioDeviceAddress::make(std::vector{1, ++nextId}); + break; + } } AudioPort result = port; result.ext.get().device.address = std::move(address);