[pulseaudio-discuss] [PATCH] loopback: Fix assertion triggered if move fails
Xu, Martin
martin.xu at intel.com
Mon Jun 4 21:17:45 PDT 2012
Thanks!
> -----Original Message-----
> From: Frédéric Dalleau [mailto:johan.hedberg at gmail.com]
> Sent: Tuesday, June 05, 2012 1:29
> To: pulseaudio-discuss at lists.freedesktop.org
> Subject: [pulseaudio-discuss] [PATCH] loopback: Fix assertion triggered
> if move fails
>
> To reproduce select a card with a source and a sink.
> For example card 0 has sink 0, source 0 and source 1 is the monitor.
> Load the loopback module:
> $ pacmd load-module module-loopback source=0 sink=0
>
> Make sure the loopback works, then enter the following command:
> $ pacmd set-card-profile 0 off
>
> The assertion is triggered, the patch should fix it.
> ---
> src/modules/module-loopback.c | 16 ++++++++--------
> 1 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/src/modules/module-loopback.c b/src/modules/module-
> loopback.c index 1a69445..17eaba2 100644
> --- a/src/modules/module-loopback.c
> +++ b/src/modules/module-loopback.c
> @@ -132,7 +132,7 @@ enum {
> };
>
> /* Called from main context */
> -static void teardown(struct userdata *u) {
> +static void teardown(struct userdata *u, pa_bool_t teardown_input,
> +pa_bool_t teardown_output) {
> pa_assert(u);
> pa_assert_ctl_context();
>
> @@ -145,19 +145,19 @@ static void teardown(struct userdata *u) {
> u->time_event = NULL;
> }
>
> - if (u->sink_input)
> + if (teardown_input && u->sink_input)
> pa_sink_input_unlink(u->sink_input);
>
> - if (u->source_output)
> + if (teardown_output && u->source_output)
> pa_source_output_unlink(u->source_output);
>
> - if (u->sink_input) {
> + if (teardown_input && u->sink_input) {
> u->sink_input->parent.process_msg = pa_sink_input_process_msg;
> pa_sink_input_unref(u->sink_input);
> u->sink_input = NULL;
> }
>
> - if (u->source_output) {
> + if (teardown_output && u->source_output) {
> u->source_output->parent.process_msg =
> pa_source_output_process_msg;
> pa_source_output_unref(u->source_output);
> u->source_output = NULL;
> @@ -351,7 +351,7 @@ static void source_output_kill_cb(pa_source_output
> *o) {
> pa_assert_ctl_context();
> pa_assert_se(u = o->userdata);
>
> - teardown(u);
> + teardown(u, FALSE, TRUE);
> pa_module_unload_request(u->module, TRUE); }
>
> @@ -603,7 +603,7 @@ static void sink_input_kill_cb(pa_sink_input *i) {
> pa_assert_ctl_context();
> pa_assert_se(u = i->userdata);
>
> - teardown(u);
> + teardown(u, TRUE, FALSE);
> pa_module_unload_request(u->module, TRUE); }
>
> @@ -862,7 +862,7 @@ void pa__done(pa_module*m) {
> if (!(u = m->userdata))
> return;
>
> - teardown(u);
> + teardown(u, TRUE, TRUE);
>
> if (u->memblockq)
> pa_memblockq_free(u->memblockq);
> --
> 1.7.5.4
>
> _______________________________________________
> pulseaudio-discuss mailing list
> pulseaudio-discuss at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
More information about the pulseaudio-discuss
mailing list