Georg Chini pushed to branch master at PulseAudio / pulseaudio
Commits: a53b371a by Georg Chini at 2019-02-15T19:33:24Z virtual-source: Fix crash in combination with module-loopback Similar to module-tunnel-sink-new, module-virtual-source did not create a rtpoll for the uplink sink. This lead to a crash when the uplink sink was used by module loopback, because module-loopback relies on the sink to provide a rtpoll. Additionally, the sink was not unlinked when the module was unloaded. This patch fixes both issues. The rtpoll created is never run by the sink, so the patch is no real fix but just a workaround to make module-loopback happy. - - - - - 1 changed file: - src/modules/module-virtual-source.c Changes: ===================================== src/modules/module-virtual-source.c ===================================== @@ -38,6 +38,7 @@ #include <pulsecore/sample-util.h> #include <pulsecore/ltdl-helper.h> #include <pulsecore/mix.h> +#include <pulsecore/rtpoll.h> PA_MODULE_AUTHOR("Pierre-Louis Bossart"); PA_MODULE_DESCRIPTION("Virtual source"); @@ -77,6 +78,7 @@ struct userdata { pa_sink *sink; pa_usec_t block_usec; pa_memblockq *sink_memblockq; + pa_rtpoll *rtpoll; }; @@ -543,6 +545,13 @@ int pa__init(pa_module*m) { } u->channels = ss.channels; + /* The rtpoll created here is never run. It is only necessary to avoid crashes + * when module-virtual-source is used together with module-loopback or + * module-combine-sink. Both modules base their asyncmsq on the rtpoll provided + * by the sink. module-loopback and combine-sink only work because they + * call pa_asyncmsq_process_one() themselves. */ + u->rtpoll = pa_rtpoll_new(); + /* Create source */ pa_source_new_data_init(&source_data); source_data.driver = __FILE__; @@ -671,6 +680,7 @@ int pa__init(pa_module*m) { u->sink->userdata = u; pa_sink_set_asyncmsgq(u->sink, master->asyncmsgq); + pa_sink_set_rtpoll(u->sink, u->rtpoll); /* FIXME: no idea what I am doing here */ u->block_usec = BLOCK_USEC; @@ -732,8 +742,10 @@ void pa__done(pa_module*m) { if (u->source) pa_source_unref(u->source); - if (u->sink) + if (u->sink) { + pa_sink_unlink(u->sink); pa_sink_unref(u->sink); + } if (u->memblockq) pa_memblockq_free(u->memblockq); @@ -741,5 +753,8 @@ void pa__done(pa_module*m) { if (u->sink_memblockq) pa_memblockq_free(u->sink_memblockq); + if (u->rtpoll) + pa_rtpoll_free(u->rtpoll); + pa_xfree(u); } View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/commit/a53b371a4f6ec373b1c76020c721039e9cd1eb92 -- View it on GitLab: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/commit/a53b371a4f6ec373b1c76020c721039e9cd1eb92 You're receiving this email because of your account on gitlab.freedesktop.org.
_______________________________________________ pulseaudio-commits mailing list pulseaudio-commits@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/pulseaudio-commits