[pulseaudio-discuss] [PATCH 1/2] device-port: Send a subscription event when the offset changes.

Tanu Kaskinen tanuk at iki.fi
Sat Jun 30 01:28:55 PDT 2012


On Thu, 2012-06-28 at 13:17 +0200, poljar (Damir Jelić) wrote:
> From: "poljar (Damir Jelić)" <poljarinho at gmail.com>
> 
> When the offset changes a subscription event should be sent to the
> relevant card.

Thanks, will push soon.

> ---
>  src/pulsecore/device-port.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/src/pulsecore/device-port.c b/src/pulsecore/device-port.c
> index 46e37e2..f39fc33 100644
> --- a/src/pulsecore/device-port.c
> +++ b/src/pulsecore/device-port.c
> @@ -116,6 +116,8 @@ void pa_device_port_hashmap_free(pa_hashmap *h) {
>  
>  void pa_device_port_set_latency_offset(pa_device_port *p, pa_usec_t offset) {
>      uint32_t state;
> +    pa_core *core;
> +    pa_card *card;
>  
>      pa_assert(p);
>  
> @@ -139,4 +141,10 @@ void pa_device_port_set_latency_offset(pa_device_port *p, pa_usec_t offset) {
>                  break;
>              }
>      }
> +
> +    /* Post subscriptions to the card which owns us */

This sentence doesn't make much sense. You're not pushing subscriprions,
you're sending notifications (I know that the text is copy-pasted from
elsewhere, but copy-pasting nonsense doesn't make it any less nonsense).
I've removed the comment altogether, since I think the code is clear
enough (and I intend to make it even clearer soon - I'll add a pa_card
pointer to pa_device_port so that it will be unnecessary to search the
right card).

> +    pa_assert_se(core = p->core);
> +    PA_IDXSET_FOREACH(card, core->cards, state)
> +        if (p == pa_hashmap_get(card->ports, p->name))
> +            pa_subscription_post(core, PA_SUBSCRIPTION_EVENT_CARD|PA_SUBSCRIPTION_EVENT_CHANGE, card->index);
>  }

-- 
Tanu



More information about the pulseaudio-discuss mailing list