mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-05 13:29:57 -05:00
bluetooth: add mSBC to backend-ofono
Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/507>
This commit is contained in:
parent
030dc8b968
commit
f0d32e9454
1 changed files with 17 additions and 4 deletions
|
|
@ -220,14 +220,21 @@ static int card_acquire(struct hf_audio_card *card) {
|
||||||
DBUS_TYPE_BYTE, &codec,
|
DBUS_TYPE_BYTE, &codec,
|
||||||
DBUS_TYPE_INVALID) == true)) {
|
DBUS_TYPE_INVALID) == true)) {
|
||||||
dbus_message_unref(r);
|
dbus_message_unref(r);
|
||||||
if (codec != HFP_AUDIO_CODEC_CVSD) {
|
|
||||||
|
if (codec == HFP_AUDIO_CODEC_CVSD) {
|
||||||
|
pa_bluetooth_transport_reconfigure(card->transport, pa_bluetooth_get_hf_codec("CVSD"), sco_transport_write, NULL);
|
||||||
|
} else if (codec == HFP_AUDIO_CODEC_MSBC) {
|
||||||
|
/* oFono is expected to set up socket BT_VOICE_TRANSPARENT option */
|
||||||
|
pa_bluetooth_transport_reconfigure(card->transport, pa_bluetooth_get_hf_codec("mSBC"), sco_transport_write, NULL);
|
||||||
|
} else {
|
||||||
|
pa_assert_fp(codec != HFP_AUDIO_CODEC_CVSD && codec != HFP_AUDIO_CODEC_MSBC);
|
||||||
pa_log_error("Invalid codec: %u", codec);
|
pa_log_error("Invalid codec: %u", codec);
|
||||||
/* shutdown to make sure connection is dropped immediately */
|
/* shutdown to make sure connection is dropped immediately */
|
||||||
shutdown(fd, SHUT_RDWR);
|
shutdown(fd, SHUT_RDWR);
|
||||||
close(fd);
|
close(fd);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
pa_bluetooth_transport_reconfigure(card->transport, pa_bluetooth_get_hf_codec("CVSD"), sco_transport_write, NULL);
|
|
||||||
card->fd = fd;
|
card->fd = fd;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
@ -538,6 +545,7 @@ static void hf_audio_agent_register(pa_bluetooth_backend *hf) {
|
||||||
pa_assert_se(m = dbus_message_new_method_call(OFONO_SERVICE, "/", HF_AUDIO_MANAGER_INTERFACE, "Register"));
|
pa_assert_se(m = dbus_message_new_method_call(OFONO_SERVICE, "/", HF_AUDIO_MANAGER_INTERFACE, "Register"));
|
||||||
|
|
||||||
codecs[ncodecs++] = HFP_AUDIO_CODEC_CVSD;
|
codecs[ncodecs++] = HFP_AUDIO_CODEC_CVSD;
|
||||||
|
codecs[ncodecs++] = HFP_AUDIO_CODEC_MSBC;
|
||||||
|
|
||||||
pa_assert_se(dbus_message_append_args(m, DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE, &pcodecs, ncodecs,
|
pa_assert_se(dbus_message_append_args(m, DBUS_TYPE_OBJECT_PATH, &path, DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE, &pcodecs, ncodecs,
|
||||||
DBUS_TYPE_INVALID));
|
DBUS_TYPE_INVALID));
|
||||||
|
|
@ -683,7 +691,7 @@ static DBusMessage *hf_audio_agent_new_connection(DBusConnection *c, DBusMessage
|
||||||
|
|
||||||
card = pa_hashmap_get(backend->cards, path);
|
card = pa_hashmap_get(backend->cards, path);
|
||||||
|
|
||||||
if (!card || codec != HFP_AUDIO_CODEC_CVSD || card->fd >= 0) {
|
if (!card || (codec != HFP_AUDIO_CODEC_CVSD && codec != HFP_AUDIO_CODEC_MSBC) || card->fd >= 0) {
|
||||||
pa_log_warn("New audio connection invalid arguments (path=%s fd=%d, codec=%d)", path, fd, codec);
|
pa_log_warn("New audio connection invalid arguments (path=%s fd=%d, codec=%d)", path, fd, codec);
|
||||||
pa_assert_se(r = dbus_message_new_error(m, "org.ofono.Error.InvalidArguments", "Invalid arguments in method call"));
|
pa_assert_se(r = dbus_message_new_error(m, "org.ofono.Error.InvalidArguments", "Invalid arguments in method call"));
|
||||||
shutdown(fd, SHUT_RDWR);
|
shutdown(fd, SHUT_RDWR);
|
||||||
|
|
@ -695,7 +703,12 @@ static DBusMessage *hf_audio_agent_new_connection(DBusConnection *c, DBusMessage
|
||||||
|
|
||||||
card->connecting = false;
|
card->connecting = false;
|
||||||
card->fd = fd;
|
card->fd = fd;
|
||||||
pa_bluetooth_transport_reconfigure(card->transport, pa_bluetooth_get_hf_codec("CVSD"), sco_transport_write, NULL);
|
if (codec == HFP_AUDIO_CODEC_CVSD) {
|
||||||
|
pa_bluetooth_transport_reconfigure(card->transport, pa_bluetooth_get_hf_codec("CVSD"), sco_transport_write, NULL);
|
||||||
|
} else if (codec == HFP_AUDIO_CODEC_MSBC) {
|
||||||
|
/* oFono is expected to set up socket BT_VOICE_TRANSPARENT option */
|
||||||
|
pa_bluetooth_transport_reconfigure(card->transport, pa_bluetooth_get_hf_codec("mSBC"), sco_transport_write, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
pa_bluetooth_transport_set_state(card->transport, PA_BLUETOOTH_TRANSPORT_STATE_PLAYING);
|
pa_bluetooth_transport_set_state(card->transport, PA_BLUETOOTH_TRANSPORT_STATE_PLAYING);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue