Android AudioRecord 的 AudioHardwareALSA 错误
我正在启动一个我正在编写的简单的 AudioRecord 应用程序,它以一堆这些开头:
12-19 17:05:57.393: WARN/ResourceType(2233): Resources don't contain package for resource number 0x7f0800f4
然后是:
12-19 17:05:57.863: ERROR/AudioHardwareALSA(2182): AudioStreamInALSA::AudioStreamInALSA mMode=-1
12-19 17:05:57.863: ERROR/AudioHardwareALSA(2182): AudioStreamInALSA - input - format = 1, channels = 16, rate = 44100
12-19 17:05:57.863: ERROR/AudioHardwareALSA(2182): AudioStreamInALSA - default - format = 1, channels = 16, rate = 44100
12-19 17:05:57.863: ERROR/AudioHardwareALSA(2182): AudioStreamInALSA - mDefaults->sampleRate = 44100
12-19 17:05:57.963: ERROR/AudioFlinger(2182): readInputParameters mInputBytes 8320, mFrameSize 2 mSampleRate 44100 mChannelCount(1)
12-19 17:05:57.963: ERROR/(2182): AFCCreateReSampler: avAFCInfo->bUsed[0] inSampleRate[44100] outSampleRate[44100] nChannel[1] outbitDepth[16]
12-19 17:05:58.278: WARN/AudioFlinger(2182): RecordThread: buffer overflow
12-19 17:05:58.328: WARN/IInputConnectionWrapper(6726): showStatusIcon on inactive InputConnection
12-19 17:06:05.598: ERROR/ALSALib(2182): external/alsa-lib/src/pcm/pcm.c:7231:(snd_pcm_recover) overrun occured
这可能意味着什么?如果需要,我可以发布源代码,但我正在寻找这些错误可能指的是什么以及为什么在这种情况下可能会发生缓冲区溢出的基本答案。谢谢。
I'm starting a simple AudioRecord app that I am writing and it starts with a bunch of these:
12-19 17:05:57.393: WARN/ResourceType(2233): Resources don't contain package for resource number 0x7f0800f4
and then this:
12-19 17:05:57.863: ERROR/AudioHardwareALSA(2182): AudioStreamInALSA::AudioStreamInALSA mMode=-1
12-19 17:05:57.863: ERROR/AudioHardwareALSA(2182): AudioStreamInALSA - input - format = 1, channels = 16, rate = 44100
12-19 17:05:57.863: ERROR/AudioHardwareALSA(2182): AudioStreamInALSA - default - format = 1, channels = 16, rate = 44100
12-19 17:05:57.863: ERROR/AudioHardwareALSA(2182): AudioStreamInALSA - mDefaults->sampleRate = 44100
12-19 17:05:57.963: ERROR/AudioFlinger(2182): readInputParameters mInputBytes 8320, mFrameSize 2 mSampleRate 44100 mChannelCount(1)
12-19 17:05:57.963: ERROR/(2182): AFCCreateReSampler: avAFCInfo->bUsed[0] inSampleRate[44100] outSampleRate[44100] nChannel[1] outbitDepth[16]
12-19 17:05:58.278: WARN/AudioFlinger(2182): RecordThread: buffer overflow
12-19 17:05:58.328: WARN/IInputConnectionWrapper(6726): showStatusIcon on inactive InputConnection
12-19 17:06:05.598: ERROR/ALSALib(2182): external/alsa-lib/src/pcm/pcm.c:7231:(snd_pcm_recover) overrun occured
What might this mean? I can post source code if necessary, but I'm looking for a basic answer of what these errors might refer to and why a buffer overflow might occur in such a situation. Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查看错误“发生溢出”。阅读此内容:
http://lxr.post- tech.com/source/external/alsa-lib/src/pcm/pcm.c 并在注释中解释:
266 此错误意味着 xrun(播放不足或捕获溢出)。
267 当应用程序不提供新样本时,可能会发生欠载
268 及时发送到 alsa-lib(由于 CPU 使用情况)。溢出可能发生在以下情况:
269 应用程序没有及时从 alsa-lib 获取新捕获的样本。
270
所以这仅仅意味着捕获线程太忙于做其他事情 - 这是正确的吗?也许您应该创建一个专门用于捕获音频流的线程?
但阅读此内容:
http://programming-android.labs.oreilly.com/ch14.html
也可能是由于分配用于捕获的缓冲区不足。这是正确的吗?
Look at the error "overrun occurred". Read this:
http://lxr.post-tech.com/source/external/alsa-lib/src/pcm/pcm.c and within the remark it explained:
266 This error means xrun (underrun for playback or overrun for capture).
267 The underrun can happen when an application does not feed new samples
268 in time to alsa-lib (due CPU usage). The overrun can happen when
269 an application does not take new captured samples in time from alsa-lib.
270
so it simply means the capturing thread is too busy doing other things - is that correct? Perhaps u should create a thread dedicated to capturing the audio stream?
But reading this:
http://programming-android.labs.oreilly.com/ch14.html
it could also be due to insufficient buffer allocated for capturing. Is that correct?