example/a2dp_source_demo: fix channel mode

This commit is contained in:
Milanka Ringwald 2021-05-21 16:21:35 +02:00
parent 0b578d060f
commit 3f40f18491

View File

@ -810,7 +810,6 @@ static void a2dp_sink_packet_handler(uint8_t packet_type, uint16_t channel, uint
bd_addr_t address;
uint8_t status;
uint8_t channel_mode;
uint8_t allocation_method;
if (packet_type != HCI_EVENT_PACKET) return;
@ -831,23 +830,17 @@ static void a2dp_sink_packet_handler(uint8_t packet_type, uint16_t channel, uint
sbc_configuration.max_bitpool_value = a2dp_subevent_signaling_media_codec_sbc_configuration_get_max_bitpool_value(packet);
allocation_method = a2dp_subevent_signaling_media_codec_sbc_configuration_get_allocation_method(packet);
channel_mode = a2dp_subevent_signaling_media_codec_sbc_configuration_get_channel_mode(packet);
sbc_configuration.channel_mode = a2dp_subevent_signaling_media_codec_sbc_configuration_get_channel_mode(packet);
// Adapt Bluetooth spec definition to SBC Encoder expected input
sbc_configuration.allocation_method = (btstack_sbc_allocation_method_t)(allocation_method - 1);
sbc_configuration.num_channels = SBC_CHANNEL_MODE_STEREO;
switch (channel_mode){
case AVDTP_SBC_JOINT_STEREO:
sbc_configuration.channel_mode = SBC_CHANNEL_MODE_JOINT_STEREO;
switch (sbc_configuration.channel_mode){
case SBC_CHANNEL_MODE_JOINT_STEREO:
case SBC_CHANNEL_MODE_STEREO:
case SBC_CHANNEL_MODE_DUAL_CHANNEL:
break;
case AVDTP_SBC_STEREO:
sbc_configuration.channel_mode = SBC_CHANNEL_MODE_STEREO;
break;
case AVDTP_SBC_DUAL_CHANNEL:
sbc_configuration.channel_mode = SBC_CHANNEL_MODE_DUAL_CHANNEL;
break;
case AVDTP_SBC_MONO:
sbc_configuration.channel_mode = SBC_CHANNEL_MODE_MONO;
case SBC_CHANNEL_MODE_MONO:
sbc_configuration.num_channels = 1;
break;
default: