From: Mikel Astiz <mikel.astiz@xxxxxxxxxxxx> When PA is doing gateway role, let module-suspend-on-idle resume the audio stream automatically. This will work until the user (or the remote side, which we also consider user-initiated) suspend the stream manually. --- src/modules/bluetooth/module-bluetooth-device.c | 26 +++++++++++++++++++++- 1 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c index d7366c5..68e9cdb 100644 --- a/src/modules/bluetooth/module-bluetooth-device.c +++ b/src/modules/bluetooth/module-bluetooth-device.c @@ -1738,7 +1738,18 @@ static int add_sink(struct userdata *u) { connect_ports(u, &data, PA_DIRECTION_OUTPUT); if (!bt_transport_is_acquired(u)) - data.suspend_cause = PA_SUSPEND_USER; + switch (u->profile) { + case PROFILE_A2DP: + case PROFILE_HSP: + data.suspend_cause = PA_SUSPEND_IDLE; + break; + case PROFILE_HFGW: + data.suspend_cause = PA_SUSPEND_USER; + break; + case PROFILE_A2DP_SOURCE: + case PROFILE_OFF: + pa_assert_not_reached(); + } u->sink = pa_sink_new(u->core, &data, PA_SINK_HARDWARE|PA_SINK_LATENCY); pa_sink_new_data_done(&data); @@ -1803,7 +1814,18 @@ static int add_source(struct userdata *u) { connect_ports(u, &data, PA_DIRECTION_INPUT); if (!bt_transport_is_acquired(u)) - data.suspend_cause = PA_SUSPEND_USER; + switch (u->profile) { + case PROFILE_HSP: + data.suspend_cause = PA_SUSPEND_IDLE; + break; + case PROFILE_A2DP_SOURCE: + case PROFILE_HFGW: + data.suspend_cause = PA_SUSPEND_USER; + break; + case PROFILE_A2DP: + case PROFILE_OFF: + pa_assert_not_reached(); + } u->source = pa_source_new(u->core, &data, PA_SOURCE_HARDWARE|PA_SOURCE_LATENCY); pa_source_new_data_done(&data); -- 1.7.7.6