【发布时间】:2015-03-13 09:36:00
【问题描述】:
我正在根据这篇文章学习 ALSA:http://equalarea.com/paul/alsa-audio.html#interruptex (A Minimal Interrupt-Driven Program)
注意short buf[4096];如果我们声明为全局,会提示Bad address错误。如果我们将它声明为int playback_callback (snd_pcm_sframes_t nframes)的本地,它会运行并且有时会提示错误地址错误。如果我们使用malloc分配buf,错误就消失了。
正如我从snd_pcm_writei 的源代码中看到的,它调用ioctl 将缓冲区发送到设备。那么,为什么ioctl 的行为与我描述的一样?
我使用的是 Ubuntu 14.04 64 位
【问题讨论】:
-
这听起来像是地址对齐问题。
标签: c linux system-calls alsa