mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-04-07 08:21:11 -04:00
bluez5: backend-native: set best codec also when retrying on timeout
Try again setting best available codec, not MSBC, when retrying if no response to previous +BCS: command.
This commit is contained in:
parent
d04ee91714
commit
6982bb8c7f
1 changed files with 9 additions and 4 deletions
|
|
@ -3310,6 +3310,7 @@ static void codec_switch_timer_event(struct spa_source *source)
|
||||||
{
|
{
|
||||||
struct rfcomm *rfcomm = source->data;
|
struct rfcomm *rfcomm = source->data;
|
||||||
struct impl *backend = rfcomm->backend;
|
struct impl *backend = rfcomm->backend;
|
||||||
|
const struct media_codec *best_codec;
|
||||||
uint64_t exp;
|
uint64_t exp;
|
||||||
|
|
||||||
if (spa_system_timerfd_read(backend->main_system, source->fd, &exp) < 0)
|
if (spa_system_timerfd_read(backend->main_system, source->fd, &exp) < 0)
|
||||||
|
|
@ -3322,10 +3323,14 @@ static void codec_switch_timer_event(struct spa_source *source)
|
||||||
switch (rfcomm->hfp_ag_initial_codec_setup) {
|
switch (rfcomm->hfp_ag_initial_codec_setup) {
|
||||||
case HFP_AG_INITIAL_CODEC_SETUP_SEND:
|
case HFP_AG_INITIAL_CODEC_SETUP_SEND:
|
||||||
/* Retry codec selection */
|
/* Retry codec selection */
|
||||||
rfcomm->hfp_ag_initial_codec_setup = HFP_AG_INITIAL_CODEC_SETUP_WAIT;
|
best_codec = codec_list_best(backend, &rfcomm->supported_codec_list);
|
||||||
rfcomm_send_reply(rfcomm, "+BCS: 2");
|
if (best_codec && best_codec->id != SPA_BLUETOOTH_AUDIO_CODEC_CVSD) {
|
||||||
codec_switch_start_timer(rfcomm, HFP_CODEC_SWITCH_TIMEOUT_MSEC);
|
rfcomm->hfp_ag_initial_codec_setup = HFP_AG_INITIAL_CODEC_SETUP_WAIT;
|
||||||
return;
|
rfcomm_send_reply(rfcomm, "+BCS: %u", best_codec->codec_id);
|
||||||
|
codec_switch_start_timer(rfcomm, HFP_CODEC_SWITCH_TIMEOUT_MSEC);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
SPA_FALLTHROUGH;
|
||||||
case HFP_AG_INITIAL_CODEC_SETUP_WAIT:
|
case HFP_AG_INITIAL_CODEC_SETUP_WAIT:
|
||||||
/* Failure, try falling back to CVSD. */
|
/* Failure, try falling back to CVSD. */
|
||||||
rfcomm->hfp_ag_initial_codec_setup = HFP_AG_INITIAL_CODEC_SETUP_NONE;
|
rfcomm->hfp_ag_initial_codec_setup = HFP_AG_INITIAL_CODEC_SETUP_NONE;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue