[pulseaudio-discuss] [PATCH] modules: add module-remap-source

Tanu Kaskinen tanuk at iki.fi
Tue Mar 5 07:49:48 PST 2013


On Fri, 2013-02-22 at 18:26 +0100, Stefan Huber wrote:
> ---
>  src/Makefile.am                   |    6 +
>  src/modules/module-remap-source.c |  460 +++++++++++++++++++++++++++++++++++++
>  2 files changed, 466 insertions(+)
>  create mode 100644 src/modules/module-remap-source.c

Thanks for this patch, module-remap-source has been requested several
times.

> +/* Called from output thread context */
> +static int source_output_process_msg_cb(pa_msgobject *obj, int code, void *data, int64_t offset, pa_memchunk *chunk) {
> +    return pa_source_output_process_msg(obj, code, data, offset, chunk);
> +}

This function is redundant. When a new source output is created, the
default message handler will be pa_source_output_process_msg().

> +/* Called from main thread */
> +static bool source_output_may_move_to_cb(pa_source_output *o, pa_source *dest) {
> +    struct userdata *u;
> +
> +    pa_source_output_assert_ref(o);
> +    pa_assert_ctl_context();
> +    pa_assert_se(u = o->userdata);
> +
> +    return u->source != dest;
> +}

This function is redundant, because the core already does loop
detection. u->source != dest isn't sufficient for detecting loops
anyway.

There are probably several modules that have a similar may_move_to_cb
function. All those could be removed.

> +    u = pa_xnew0(struct userdata, 1);
> +    if (!u) {
> +        pa_log("Failed to alloc userdata.");
> +        goto fail;
> +    }

pa_xnew0() never fails, so this is a redundant check.

> +    /* FIXME
> +       source_output_data.flags = PA_SOURCE_OUTPUT_DONT_INHIBIT_AUTO_SUSPEND; */

What's the story behind this FIXME? Why would you want to set that flag?
Note that when the remap source is suspended, the source output is
automatically corked, which in turn allows the master source to be
suspended too.

-- 
Tanu



More information about the pulseaudio-discuss mailing list