snd_pcm_sframes_t frames;
long long ms;
long rate, channels, period_size, buffer_size;
+ unsigned int rchannels;
unsigned int rrate;
snd_pcm_uframes_t rperiod_size, rbuffer_size, start_threshold;
timestamp_t tstamp;
snd_pcm_format_name(format), snd_strerror(err));
goto __close;
}
- err = snd_pcm_hw_params_set_channels(handle, hw_params, channels);
+ rchannels = channels;
+ err = snd_pcm_hw_params_set_channels_near(handle, hw_params, &rchannels);
if (err < 0) {
snprintf(msg, sizeof(msg), "snd_pcm_hw_params_set_channels %ld: %s", channels, snd_strerror(err));
goto __close;
}
+ if (rchannels != channels) {
+ snprintf(msg, sizeof(msg), "channels unsupported %ld != %ld", channels, rchannels);
+ skip = true;
+ goto __close;
+ }
rrate = rate;
err = snd_pcm_hw_params_set_rate_near(handle, hw_params, &rrate, 0);
if (err < 0) {