I've been chasing XRUN's on the WB.....
Code:
--------------------
[09:56:38.405777] sendSTAT:151 STAT: STMf
[09:56:38.405868] codec_open:176 codec open: 'f'
[09:56:38.405936] stream_file:316 opening local file:
/storage/music/lossless/The_Doors/L_A__Woman__DCC_Gold_/06_-_L_America.flac
[09:56:38.410803] sendSTAT:151 STAT: STMc
[09:56:38.411017] process_strm:309 set fade mode: 0
[09:56:38.411122] process:409 audg
[09:56:38.411178] process_audg:357 audg gainL: 65536 gainR: 65536 adjust: 1
[09:56:39.420606] write_cb:97 setting track_start
[09:56:39.695394] process_newstream:192 resampling from 44100 -> 352800
[09:56:39.695554] process_newstream:239 resampling with
soxr_quality_spec_t[precision: 28.0, passband_end: 0.982302, stopband_begin:
1.000000, phase_response: 50.0, flags: 0x00], soxr_io_spec_t[scale: 0.89]
[09:56:39.699615] ALSA snd_pcm_hw_delay:514 SNDRV_PCM_IOCTL_DELAY failed (-32)
[09:56:39.699873] output_thread:594 XRUN
[09:56:39.700337] ALSA snd_pcm_hw_start:587 SNDRV_PCM_IOCTL_START failed (-32)
--------------------
I now have a config which is rock solid with upsampling to 352k8.
Code:
--------------------
# Updated by Community Squeeze web-gui at 2013/06/08 09:28:07 BST
NAME="-n SqueezeliteWAND"
AUDIO_DEV="-o hw:CARD=Amanero"
LOG_FILE="-f /var/log/squeezelite/squeezelite.log"
ALSA_PARAMS="-a 14112:3528::"
SERVER_IP="127.0.0.1"
UPSAMPLE="-u vsL::1"
--------------------
I've started playing with alsa period_size / buffer_size directly last
night.
Don't suppose I can interest you in dumping buffer_time and period_count
for buffer_size and period_size..... LOL.
Code:
--------------------
--- /home/clivem/development/git/squeezelite/squeezelite.h 2013-06-07
23:58:38.992605041 +0100
+++ squeezelite.h 2013-06-08 11:30:19.857460678 +0100
@@ -100,8 +100,8 @@
#define MAX_HEADER 4096 // do not reduce as icy-meta max is 4080
#if ALSA
-#define ALSA_BUFFER_TIME 20000
-#define ALSA_PERIOD_COUNT 4
+#define ALSA_BUFFER_SIZE 1764
+#define ALSA_PERIOD_SIZE 882
#define OUTPUT_RT_PRIORITY 45
#endif
--- /home/clivem/development/git/squeezelite/main.c 2013-06-07
23:58:38.991605070 +0100
+++ main.c 2013-06-08 11:34:25.482647266 +0100
@@ -31,7 +31,7 @@
" -o <output device>\tSpecify output device, default
\"default\"\n"
" -l \t\t\tList output devices\n"
#if ALSA
- " -a <b>:<c>:<f>:<m>\tSpecify ALSA params to open output
device, b = buffer time in ms, c = period count, f sample format
(16|24|24_3|32), m = use mmap (0|1)\n"
+ " -a <b>:<p>:<f>:<m>\tSpecify ALSA params to open output
device, b = buffer size, p = period size, f sample format (16|24|24_3|32), m =
use mmap (0|1)\n"
#endif
#if PORTAUDIO
" -a <latency>\t\tSpecify output target latency in ms\n"
@@ -99,8 +99,8 @@
bool daemonize = false;
#endif
#if ALSA
- unsigned alsa_buffer_time = ALSA_BUFFER_TIME;
- unsigned alsa_period_count = ALSA_PERIOD_COUNT;
+ unsigned alsa_buffer_size = ALSA_BUFFER_SIZE;
+ unsigned alsa_period_size = ALSA_PERIOD_SIZE;
char *alsa_sample_fmt = NULL;
bool alsa_mmap = true;
unsigned rt_priority = OUTPUT_RT_PRIORITY;
@@ -139,12 +139,12 @@
case 'a':
{
#if ALSA
- char *t = next_param(optarg, ':');
- char *c = next_param(NULL, ':');
+ char *b = next_param(optarg, ':');
+ char *p = next_param(NULL, ':');
char *s = next_param(NULL, ':');
char *m = next_param(NULL, ':');
- if (t) alsa_buffer_time = atoi(t) * 1000;
- if (c) alsa_period_count = atoi(c);
+ if (b) alsa_buffer_size = atoi(b);
+ if (p) alsa_period_size = atoi(p);
if (s) alsa_sample_fmt = s;
if (m) alsa_mmap = atoi(m);
#endif
@@ -279,7 +279,7 @@
stream_init(log_stream, stream_buf_size);
#if ALSA
- output_init(log_output, output_device, output_buf_size,
alsa_buffer_time, alsa_period_count, alsa_sample_fmt, alsa_mmap,
+ output_init(log_output, output_device, output_buf_size,
alsa_buffer_size, alsa_period_size, alsa_sample_fmt, alsa_mmap,
max_rate, rt_priority);
#endif
#if PORTAUDIO
--- /home/clivem/development/git/squeezelite/output.c 2013-06-01
22:12:46.217869210 +0100
+++ output.c 2013-06-08 11:21:30.910924712 +0100
@@ -199,7 +199,7 @@
return true;
}
-static int alsa_open(snd_pcm_t **pcmp, const char *device, unsigned
sample_rate, unsigned buffer_time, unsigned period_count) {
+static int alsa_open(snd_pcm_t **pcmp, const char *device, unsigned
sample_rate, unsigned buffer_size, unsigned period_size) {
int err;
snd_pcm_hw_params_t *hw_params;
snd_pcm_hw_params_alloca(&hw_params);
@@ -287,34 +287,34 @@
return err;
}
- // set buffer time and period count
- unsigned count = period_count;
- if ((err = snd_pcm_hw_params_set_periods_near(*pcmp, hw_params, &count,
0)) < 0) {
+ // set buffer size
+ snd_pcm_uframes_t pSize = period_size;
+ int dir = 0;
+ if ((err = snd_pcm_hw_params_set_period_size_near(*pcmp, hw_params,
&pSize, &dir)) < 0) {
LOG_ERROR("unable to set period size %s", snd_strerror(err));
return err;
}
- unsigned time = buffer_time;
- int dir = 1;
- if ((err = snd_pcm_hw_params_set_buffer_time_near(*pcmp, hw_params,
&time, &dir)) < 0) {
+ // set period size
+ snd_pcm_uframes_t bSize = buffer_size;
+ if ((err = snd_pcm_hw_params_set_buffer_size_near(*pcmp, hw_params,
&bSize)) < 0) {
LOG_ERROR("unable to set buffer size %s", snd_strerror(err));
return err;
}
// get period_size
- if ((err = snd_pcm_hw_params_get_period_size(hw_params,
&alsa.period_size, 0)) < 0) {
+ if ((err = snd_pcm_hw_params_get_period_size(hw_params,
&alsa.period_size, &dir)) < 0) {
LOG_ERROR("unable to get period size: %s", snd_strerror(err));
return err;
}
// get buffer_size
- snd_pcm_uframes_t buffer_size;
- if ((err = snd_pcm_hw_params_get_buffer_size(hw_params, &buffer_size))
< 0) {
+ if ((err = snd_pcm_hw_params_get_buffer_size(hw_params, &bSize)) < 0) {
LOG_ERROR("unable to get buffer size: %s", snd_strerror(err));
return err;
}
- LOG_INFO("buffer time: %u period count: %u buffer size: %u period size:
%u", time, count, buffer_size, alsa.period_size);
+ LOG_INFO("reqd buffer size: %u reqd period size: %u actual buffer size:
%u actual period size: %u", bSize, pSize, buffer_size, alsa.period_size);
// create an intermediate buffer for non mmap case for all but
NATIVE_FORMAT
// this is used to pack samples into the output format before calling
writei
--------------------
------------------------------------------------------------------------
JackOfAll's Profile: http://forums.slimdevices.com/member.php?userid=3069
View this thread: http://forums.slimdevices.com/showthread.php?t=98544
_______________________________________________
unix mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/unix