mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-10-29 05:40:23 -04:00
bluez5-device: lower sink/source priority for Audio gateway or a2dp source
When a phone is connected via bluetooth and switches to HFP, the sinks and sources will have higher priority than the built-in devices. Therefore they are chosen as default and module-bluetooth-policy will incorrectly insert loopback modules that loop the phone back to itself. This patch fixes the problem by lowering the priority of sink and source if PulseAudio is in the headset role. The priority is also lowered if the device is an a2dp source. In both cases it does not make sense to make the source or sink default unless there is no other sound device available.
This commit is contained in:
parent
970b475a25
commit
44d03c0a46
1 changed files with 13 additions and 0 deletions
|
|
@ -1607,6 +1607,12 @@ static int start_thread(struct userdata *u) {
|
|||
if (u->sink) {
|
||||
pa_sink_set_asyncmsgq(u->sink, u->thread_mq.inq);
|
||||
pa_sink_set_rtpoll(u->sink, u->rtpoll);
|
||||
|
||||
/* If we are in the headset role, the sink should not become default
|
||||
* unless there is no other sound device available. */
|
||||
if (u->profile == PA_BLUETOOTH_PROFILE_HEADSET_AUDIO_GATEWAY)
|
||||
u->sink->priority = 1500;
|
||||
|
||||
pa_sink_put(u->sink);
|
||||
|
||||
if (u->sink->set_volume)
|
||||
|
|
@ -1616,6 +1622,13 @@ static int start_thread(struct userdata *u) {
|
|||
if (u->source) {
|
||||
pa_source_set_asyncmsgq(u->source, u->thread_mq.inq);
|
||||
pa_source_set_rtpoll(u->source, u->rtpoll);
|
||||
|
||||
/* If we are in the headset role or the device is an a2dp source,
|
||||
* the source should not become default unless there is no other
|
||||
* sound device available. */
|
||||
if (u->profile == PA_BLUETOOTH_PROFILE_HEADSET_AUDIO_GATEWAY || u->profile == PA_BLUETOOTH_PROFILE_A2DP_SOURCE)
|
||||
u->source->priority = 1500;
|
||||
|
||||
pa_source_put(u->source);
|
||||
|
||||
if (u->source->set_volume)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue