mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
bt:Fixed sink not being able to output mono audio because it can only decode dual channel audio data
This commit is contained in:
parent
28d7eb44b9
commit
4c4799ac49
@ -423,7 +423,8 @@ static void btc_a2dp_sink_handle_decoder_reset(tBTC_MEDIA_SINK_CFG_UPDATE *p_msg
|
|||||||
a2dp_sink_local_param.btc_aa_snk_cb.rx_flush = FALSE;
|
a2dp_sink_local_param.btc_aa_snk_cb.rx_flush = FALSE;
|
||||||
APPL_TRACE_EVENT("Reset to sink role");
|
APPL_TRACE_EVENT("Reset to sink role");
|
||||||
status = OI_CODEC_SBC_DecoderReset(&a2dp_sink_local_param.context, a2dp_sink_local_param.contextData,
|
status = OI_CODEC_SBC_DecoderReset(&a2dp_sink_local_param.context, a2dp_sink_local_param.contextData,
|
||||||
sizeof(a2dp_sink_local_param.contextData), 2, 2, FALSE, FALSE);
|
sizeof(a2dp_sink_local_param.contextData), a2dp_sink_local_param.btc_aa_snk_cb.channel_count,
|
||||||
|
a2dp_sink_local_param.btc_aa_snk_cb.channel_count, FALSE, FALSE);
|
||||||
if (!OI_SUCCESS(status)) {
|
if (!OI_SUCCESS(status)) {
|
||||||
APPL_TRACE_ERROR("OI_CODEC_SBC_DecoderReset failed with error code %d\n", status);
|
APPL_TRACE_ERROR("OI_CODEC_SBC_DecoderReset failed with error code %d\n", status);
|
||||||
}
|
}
|
||||||
|
@ -273,6 +273,7 @@ static void bt_av_hdl_a2d_evt(uint16_t event, void *p_param)
|
|||||||
/* for now only SBC stream is supported */
|
/* for now only SBC stream is supported */
|
||||||
if (a2d->audio_cfg.mcc.type == ESP_A2D_MCT_SBC) {
|
if (a2d->audio_cfg.mcc.type == ESP_A2D_MCT_SBC) {
|
||||||
int sample_rate = 16000;
|
int sample_rate = 16000;
|
||||||
|
int ch_count = 2;
|
||||||
char oct0 = a2d->audio_cfg.mcc.cie.sbc[0];
|
char oct0 = a2d->audio_cfg.mcc.cie.sbc[0];
|
||||||
if (oct0 & (0x01 << 6)) {
|
if (oct0 & (0x01 << 6)) {
|
||||||
sample_rate = 32000;
|
sample_rate = 32000;
|
||||||
@ -281,7 +282,11 @@ static void bt_av_hdl_a2d_evt(uint16_t event, void *p_param)
|
|||||||
} else if (oct0 & (0x01 << 4)) {
|
} else if (oct0 & (0x01 << 4)) {
|
||||||
sample_rate = 48000;
|
sample_rate = 48000;
|
||||||
}
|
}
|
||||||
i2s_set_clk(0, sample_rate, 16, 2);
|
if (oct0 & (0x01 << 3)) {
|
||||||
|
ch_count = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
i2s_set_clk(0, sample_rate, 16, ch_count);
|
||||||
|
|
||||||
ESP_LOGI(BT_AV_TAG, "Configure audio player: %x-%x-%x-%x",
|
ESP_LOGI(BT_AV_TAG, "Configure audio player: %x-%x-%x-%x",
|
||||||
a2d->audio_cfg.mcc.cie.sbc[0],
|
a2d->audio_cfg.mcc.cie.sbc[0],
|
||||||
|
Loading…
Reference in New Issue
Block a user