[PATCH] module-jack-sink/source: Set fixed latency correctly on creation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 03/25/2012 12:59 PM, Maarten Lankhorst wrote:
> 250 ms default fixed latency won't work well for some applications like wine.

Thanks for the patch. It seems reasonable to set the sink's latency to 
match jack's latency, but jack_port_get_total_latency is deprecated and 
therefore causes a compiler warning.

Would it make more sense to use jack_port_get_latency_range and 
pa_sink_set_latency_range? Or maybe set the fixed latency to match the 
min or max value of jack's latency range?

>
> Signed-off-by: Maarten Lankhorst<m.b.lankhorst at gmail.com>
>
> ---
> diff --git a/src/modules/jack/module-jack-sink.c b/src/modules/jack/module-jack-sink.c
> index ba4ea95..4270b15 100644
> --- a/src/modules/jack/module-jack-sink.c
> +++ b/src/modules/jack/module-jack-sink.c
> @@ -296,6 +296,8 @@ int pa__init(pa_module*m) {
>       unsigned i;
>       const char **ports = NULL, **p;
>       pa_sink_new_data data;
> +    jack_nframes_t l;
> +    size_t n;
>
>       pa_assert(m);
>
> @@ -443,6 +445,9 @@ int pa__init(pa_module*m) {
>           }
>       }
>
> +    l = jack_port_get_total_latency(u->client, u->port[0]);
> +    n = l * pa_frame_size(&u->sink->sample_spec);
> +    pa_sink_set_fixed_latency(u->sink, pa_bytes_to_usec(n,&u->sink->sample_spec));
>       pa_sink_put(u->sink);
>
>       if (ports)
> diff --git a/src/modules/jack/module-jack-source.c b/src/modules/jack/module-jack-source.c
> index 13109f3..a1ec9f6 100644
> --- a/src/modules/jack/module-jack-source.c
> +++ b/src/modules/jack/module-jack-source.c
> @@ -249,6 +249,8 @@ int pa__init(pa_module*m) {
>       unsigned i;
>       const char **ports = NULL, **p;
>       pa_source_new_data data;
> +    jack_nframes_t l;
> +    size_t n;
>
>       pa_assert(m);
>
> @@ -388,6 +390,9 @@ int pa__init(pa_module*m) {
>
>       }
>
> +    l = jack_port_get_total_latency(u->client, u->port[0]);
> +    n = l * pa_frame_size(&u->source->sample_spec);
> +    pa_source_set_fixed_latency(u->source, pa_bytes_to_usec(n,&u->source->sample_spec));
>       pa_source_put(u->source);
>
>       if (ports)
>
>
> _______________________________________________
> pulseaudio-discuss mailing list
> pulseaudio-discuss at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss
>



-- 
David Henningsson, Canonical Ltd.
http://launchpad.net/~diwic


[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux