[pulseaudio-discuss] [PATCH v3 4/7] bluetooth: Set off profile on SCO disconnect

Arun Raghavan arun.raghavan at collabora.co.uk
Sat Oct 1 05:31:30 PDT 2011


Hi,
I've not tested the code, but Luiz' review is good enough for me. :)
Just one nitpick, mostly for the sake of uniformity with the rest of the
code ...

On Tue, 2011-09-20 at 13:55 +0200, Frédéric Dalleau wrote:
> Sends a message from IO thread to main thread using pa_msgobject when POLLERR
> or POLLHUP is received on SCO socket.
> ---
>  src/modules/bluetooth/module-bluetooth-device.c |  136 ++++++++++++++---------
>  1 files changed, 84 insertions(+), 52 deletions(-)
> 
> diff --git a/src/modules/bluetooth/module-bluetooth-device.c b/src/modules/bluetooth/module-bluetooth-device.c
> index 08ab868..3db9e8f 100644
> --- a/src/modules/bluetooth/module-bluetooth-device.c
> +++ b/src/modules/bluetooth/module-bluetooth-device.c
> @@ -126,7 +126,9 @@ struct hsp_info {
>      pa_hook_slot *source_state_changed_slot;
>  };
>  
> -struct userdata {
> +struct bluetooth_device {

What's the rationale behind this? While the whole "struct userdata"
business makes code navigation just a bit hard sometimes, broadly it's
handy as a convention across modules.

Would it make sense perhaps to make a separate msgobject for the
bluetooth device/card with just the pa_card so you can pass that around
instead?

> +    pa_msgobject parent;
> +
>      pa_core *core;
[...]
> @@ -2824,13 +2853,16 @@ int pa__init(pa_module* m) {
>          goto fail;
>      }
>  
> -    m->userdata = u = pa_xnew0(struct userdata, 1);
> +    u = pa_msgobject_new(bluetooth_device);
> +    memset(((char*)u)+sizeof(u->parent), 0, sizeof(*u)-sizeof(u->parent));

Maybe I'm being dense, but why is sizeof(*u) not sufficient here?

-- Arun



More information about the pulseaudio-discuss mailing list