[Alsaplayer-devel] [PATCH] Fix getting JACK sample rate

Juuso Alasuutari juuso.alasuutari at gmail.com
Wed Dec 5 12:24:34 GMT 2007


Hi,

AlsaPlayer appears to rely on jack_set_sample_rate_callback() to get the JACK 
sample rate. This function is deprecated in jackdmp, and thus AlsaPlayer will 
get a 0 sample rate from jackdmp and the JACK output plugin will fail to run.

Deprecating jack_set_sample_rate_callback() may be a design flaw in jackdmp, 
but the fact that AlsaPlayer works as it is with normal jackd may be mere 
chance. As far as I know, the JACK server isn't guaranteed to call the sample 
rate callback function when a client registers itself. AlsaPlayer should get 
the JACK sample rate from calling jack_get_sample_rate(); here's a patch to 
do just that.

Thanks,
Juuso

Index: alsaplayer/output/jack/jack.cpp
===================================================================
--- alsaplayer/output/jack/jack.cpp	(revision 1328)
+++ alsaplayer/output/jack/jack.cpp	(working copy)
@@ -131,6 +131,7 @@
 		jack_set_sample_rate_callback (client, (JackProcessCallback)srate, arg);
 		jack_on_shutdown (client, jack_shutdown, arg);
 
+		sample_rate = jack_get_sample_rate (client);
 		my_output_port1 = jack_port_register (client, "out_1",
 				JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput|JackPortIsTerminal, 0);               
 		my_output_port2 = jack_port_register (client, "out_2",



More information about the alsaplayer-devel mailing list