[pulseaudio-discuss] [PATCH 2/2] remap-source, virtual-source: fix max_rewind handling

Georg Chini georg at chini.tk
Sun Nov 5 13:46:08 UTC 2017


On 31.10.2017 14:29, Tanu Kaskinen wrote:
> The filter sources should have the same max_rewind as the master source,
> but these modules didn't update max_rewind when the master max_rewind
> changed.
> ---
>   src/modules/module-remap-source.c   | 12 ++++++++++++
>   src/modules/module-virtual-source.c | 12 ++++++++++++
>   2 files changed, 24 insertions(+)
>
> diff --git a/src/modules/module-remap-source.c b/src/modules/module-remap-source.c
> index 281d651f4..980f2554a 100644
> --- a/src/modules/module-remap-source.c
> +++ b/src/modules/module-remap-source.c
> @@ -175,6 +175,17 @@ static void source_output_process_rewind_cb(pa_source_output *o, size_t nbytes)
>           pa_source_process_rewind(u->source, nbytes);
>   }
>   
> +/* Called from output thread context */
> +static void source_output_update_max_rewind_cb(pa_source_output *o, size_t nbytes) {
> +    struct userdata *u;
> +
> +    pa_source_output_assert_ref(o);
> +    pa_source_output_assert_io_context(o);
> +    pa_assert_se(u = o->userdata);
> +
> +    pa_source_set_max_rewind_within_thread(u->source, nbytes);
> +}
> +
>   /* Called from output thread context */
>   static void source_output_detach_cb(pa_source_output *o) {
>       struct userdata *u;
> @@ -387,6 +398,7 @@ int pa__init(pa_module*m) {
>   
>       u->source_output->push = source_output_push_cb;
>       u->source_output->process_rewind = source_output_process_rewind_cb;
> +    u->source_output->update_max_rewind = source_output_update_max_rewind_cb;
>       u->source_output->kill = source_output_kill_cb;
>       u->source_output->attach = source_output_attach_cb;
>       u->source_output->detach = source_output_detach_cb;
> diff --git a/src/modules/module-virtual-source.c b/src/modules/module-virtual-source.c
> index 94907dfa9..8ec4525a7 100644
> --- a/src/modules/module-virtual-source.c
> +++ b/src/modules/module-virtual-source.c
> @@ -370,6 +370,17 @@ static void source_output_process_rewind_cb(pa_source_output *o, size_t nbytes)
>   #endif
>   }
>   
> +/* Called from output thread context */
> +static void source_output_update_max_rewind_cb(pa_source_output *o, size_t nbytes) {
> +    struct userdata *u;
> +
> +    pa_source_output_assert_ref(o);
> +    pa_source_output_assert_io_context(o);
> +    pa_assert_se(u = o->userdata);
> +
> +    pa_source_set_max_rewind_within_thread(u->source, nbytes);
> +}
> +
>   /* Called from output thread context */
>   static void source_output_attach_cb(pa_source_output *o) {
>       struct userdata *u;
> @@ -605,6 +616,7 @@ int pa__init(pa_module*m) {
>   
>       u->source_output->push = source_output_push_cb;
>       u->source_output->process_rewind = source_output_process_rewind_cb;
> +    u->source_output->update_max_rewind = source_output_update_max_rewind_cb;
>       u->source_output->kill = source_output_kill_cb;
>       u->source_output->attach = source_output_attach_cb;
>       u->source_output->detach = source_output_detach_cb;

LGTM



More information about the pulseaudio-discuss mailing list