On Tue, 2013-08-13 at 01:54 -0300, [email protected] wrote:
> +static void handle_transport_state_change(struct userdata *u, struct 
> pa_bluetooth_transport *t) {
> +    bool acquire = false;
> +    bool release = false;
> +    pa_card_profile *cp;
> +    pa_device_port *port;
> +
> +    pa_assert(u);
> +    pa_assert(t);
> +
> +    /* Update profile availability */
> +    if (!(cp = pa_hashmap_get(u->card->profiles, 
> pa_bluetooth_profile_to_string(t->profile))))
> +        return;
> +    pa_card_profile_set_available(cp, 
> transport_state_to_availability(t->state));
> +
> +    /* Update port availability */
> +    pa_assert_se(port = pa_hashmap_get(u->card->ports, u->output_port_name));
> +    pa_device_port_set_available(port, get_port_availability(u, 
> PA_DIRECTION_OUTPUT));
> +    pa_assert_se(port = pa_hashmap_get(u->card->ports, u->input_port_name));
> +    pa_device_port_set_available(port, get_port_availability(u, 
> PA_DIRECTION_INPUT));
> +
> +    /* Acquire or release transport as needed */
> +    acquire = (t->state == PA_BLUETOOTH_TRANSPORT_STATE_PLAYING && 
> u->profile == t->profile);
> +    release = (t->state != PA_BLUETOOTH_TRANSPORT_STATE_PLAYING && 
> u->profile == t->profile);
> +
> +    if (acquire && transport_acquire(u, true) >= 0) {
> +        if (u->source) {
> +            pa_log_debug("Resuming source %s because its transport state 
> changed to playing", u->source->name);
> +            pa_source_suspend(u->source, false, 
> PA_SUSPEND_IDLE|PA_SUSPEND_USER);

I still propose having this comment:

/* We remove the IDLE suspend cause, because otherwise module-loopback
doesn't uncork its streams. FIXME: Messing with the IDLE suspend cause
here is wrong, the correct way to handle this would probably be to
uncork the loopback streams not only when the other end is unsuspended,
but also when the other end's suspend cause changes to IDLE only
(currently there's no notification mechanism for suspend cause changes,
though). */

-- 
Tanu

_______________________________________________
pulseaudio-discuss mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss

Reply via email to