Copy audioConfig according to config discriminator
Audio configuration as safe union is guarded to not violate its discriminator usage. Only one member can be set. Change-Id: I98a94d81ea5bacca2407286746432b972aac4488
This commit is contained in:
parent
7fa9659923
commit
d7f04f9f06
1 changed files with 11 additions and 6 deletions
|
@ -55,12 +55,17 @@ Return<void> BluetoothAudioProvider::startSession(
|
|||
const V2_0::AudioConfiguration& audioConfig, startSession_cb _hidl_cb) {
|
||||
AudioConfiguration audioConfig_2_1;
|
||||
|
||||
audioConfig_2_1.codecConfig() = audioConfig.codecConfig();
|
||||
audioConfig_2_1.pcmConfig() = {
|
||||
.sampleRate = static_cast<SampleRate>(audioConfig.pcmConfig().sampleRate),
|
||||
.channelMode = audioConfig.pcmConfig().channelMode,
|
||||
.bitsPerSample = audioConfig.pcmConfig().bitsPerSample,
|
||||
.dataIntervalUs = 0};
|
||||
if (audioConfig.getDiscriminator() ==
|
||||
V2_0::AudioConfiguration::hidl_discriminator::pcmConfig) {
|
||||
audioConfig_2_1.pcmConfig() = {
|
||||
.sampleRate =
|
||||
static_cast<SampleRate>(audioConfig.pcmConfig().sampleRate),
|
||||
.channelMode = audioConfig.pcmConfig().channelMode,
|
||||
.bitsPerSample = audioConfig.pcmConfig().bitsPerSample,
|
||||
.dataIntervalUs = 0};
|
||||
} else {
|
||||
audioConfig_2_1.codecConfig() = audioConfig.codecConfig();
|
||||
}
|
||||
|
||||
return startSession_2_1(hostIf, audioConfig_2_1, _hidl_cb);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue