alsa_aplay 出现 Warning: rate is not accurate
2014-07-17 08:59
120 查看
最近项目中需要添加88.2k rate的驱动支持。之前加过192k的HDMI trueHD支持,因此想88.2k应该是支持的,于是用cooledit 做了一个88.2k rate的wav文件,在串口中用alsa_aplay播放测试。
alsa_aplay -D hw:0,1 -t wav -c 2 -r 88200 -f S16_LE /storage/sdcard0/1k_10db_88k_60s.wav
出现如下提示:
Signed 16 bit Little Endian, Rate 88200 Hz, Stereo,
Warning: rate is not accurate (requested = 88200Hz, got = 96000Hz)
please, try the plug plugin
搜索了一下打印的地方代码。
external/alsa-utils/aplay/aplay.c
从打印来看,rate = 88.2k, alsa_aplay传递过来的参数,hwparams.rate=96k是从底层snd_pcm_hw_params获得的参数。
因此,可以判断是底层kernel的参数没有加88.2k的支持,检查后果然发现对应的dai没有加这个rate的支持。
alsa_aplay -D hw:0,1 -t wav -c 2 -r 88200 -f S16_LE /storage/sdcard0/1k_10db_88k_60s.wav
出现如下提示:
Signed 16 bit Little Endian, Rate 88200 Hz, Stereo,
Warning: rate is not accurate (requested = 88200Hz, got = 96000Hz)
please, try the plug plugin
搜索了一下打印的地方代码。
external/alsa-utils/aplay/aplay.c
static void set_params(void) { snd_pcm_hw_params_t *params; snd_pcm_sw_params_t *swparams; snd_pcm_uframes_t buffer_size; int err; size_t n; unsigned int rate; snd_pcm_uframes_t start_threshold, stop_threshold; snd_pcm_hw_params_alloca(¶ms); snd_pcm_sw_params_alloca(&swparams); err = snd_pcm_hw_params_any(handle, params); if (err < 0) { error(_("Broken configuration for this PCM: no configurations available")); prg_exit(EXIT_FAILURE); }
...........................
rate = hwparams.rate; err = snd_pcm_hw_params_set_rate_near(handle, params, &hwparams.rate, 0); assert(err >= 0); if ((float)rate * 1.05 < hwparams.rate || (float)rate * 0.95 > hwparams.rate) { if (!quiet_mode) { char plugex[64]; const char *pcmname = snd_pcm_name(handle); <span style="color:#ff0000;">fprintf(stderr, _("Warning: rate is not accurate (requested = %iHz, got = %iHz)\n"), rate, hwparams.rate); </span> if (! pcmname || strchr(snd_pcm_name(handle), ':')) *plugex = 0; else snprintf(plugex, sizeof(plugex), "(-Dplug:%s)", snd_pcm_name(handle)); fprintf(stderr, _(" please, try the plug plugin %s\n"), plugex); } } rate = hwparams.rate;
从打印来看,rate = 88.2k, alsa_aplay传递过来的参数,hwparams.rate=96k是从底层snd_pcm_hw_params获得的参数。
因此,可以判断是底层kernel的参数没有加88.2k的支持,检查后果然发现对应的dai没有加这个rate的支持。
static struct snd_soc_dai_driver xxx_dai[] = { { .name = "xxx-dai", .playback = { .stream_name = "S/PDIF Playback", .channels_min = 1, .channels_max = 8, .rates = ( SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 | <span style="color:#ff6666;"><strong>SNDRV_PCM_RATE_88200 |</strong></span> SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_176400 | SNDRV_PCM_RATE_192000), .formats = (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE)。
相关文章推荐
- 解决MATLAB出现Warning: Name is nonexistent or not a directory的办法
- docker - 启动container时出现 [warning] : ipv4 forwarding is disabled. networking will not work
- mysql_connect连接两次,释放两次,出现Warning: mysql_close(): 13 is not a valid MySQL-Link resource
- Python 出现错误 SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform.
- python 安装pandas 出现InsecurePlatformWarning: A true SSLContext object is not available.
- Matlab 启动出现 Warning: Name is nonexistent or not a directory 的解决办法
- D9下面使用DelforEx出现 "File or buffer is read only, or not yet saved"的处理
- 使用Storyboard时出现以下警告:Scene is unreachable due to lack of entry points and does not have an identifier
- 使用struts2后出现“The requested resource is not available”
- Android studio更新后出现警告:Warning:The `android.dexOptions.incremental` property is deprecated and it has
- 启动VMware出现报错:The VMware Authorization Service is not running
- Android应用项目绑定appcom_v7打包时,出现错误:"XXX"isnottranslatedin"af"(Afrikaans),"am"(Amharic),"ar"(Arabic).....
- RedHat Enterprise Linux 6.4使用yum安装出现This system is not registered to Red Hat Subscription Management
- 使用toFixed()函数时,出现“toFixed() is not a function”的解决办法
- 在配置文件中出现The word 'crud' is not correctly spelled怎么解决
- warning: the 'gets' function is dangerous and should not be used.的解决办法
- C和指针之编译出现warning: implicit declaration of function 'matrix_multiply' is invalid in C99问题
- [问题记录]编译时出现 initializer element is not constant 错误
- VMware6关机后出现is not a valid virtual machine configuration file的解决办法
- ubuntu进行apt-get时候出现Package ssh is not available, but is referred to by another package 错误