audioFlinger提示recordThread:buffer overflow错误解决

在Android 4.4的MOTO G设备上,使用audiorecord时遇到audioFlinger recordThread:buffer overflow错误。经过排查,发现创建audiorecord时传入的mMinBufferSize至少需要等于readbuffer的两倍,且读取size需小于初始设置的size。遵循这一条件后,问题得到解决。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

今天解决领导遇到的一个问题,在使用audiorecord读取语音数据的时候提示audioFlinger audioThread:buffer overflow,使用的机器是MOTO G的。

操作系统是android 4.4。在网上找了很多,最后还是解决了,这里记录下。

代码参考网上的例子写的。

public class AudioThread {
    private static final String TAG = AudioThread.class.getSimpleName();
    private static final int DEFAULT_AUDIO_SOURCE = MediaRecorder.AudioSource.MIC;
    private static final int DEFAULT_SAMPLE_RATE = 44100;
    private static final int DEFAULT_CHANNEL_CONFIG = AudioFormat.CHANNEL_IN_MONO;
    private static final int DEFAULT_AUDIO_FORMAT = AudioFormat.ENCODING_PCM_16BIT;

    private int mMinBufferSize;
    private short[] mReadBuffer;
    private AudioRecord mAudioRecord;
    private boolean 
解释下 行 78211: 06-16 20:29:10.269857 1264 7656 I AudioFlinger_Threads: HAL output buffer size 32768 frames, normal sink buffer size 32768 frames 行 78213: 06-16 20:29:10.270344 1264 7656 D AudioFlinger_Threads: Failed to add event callback 行 78217: 06-16 20:29:10.270492 1264 19660 I AudioFlinger_Threads: AudioFlinger's thread 0xb40000757cca7880 tid=19660 ready to run 行 78220: 06-16 20:29:10.270796 1264 19660 D AudioFlinger_Threads: thread 0xb40000757cca7880 type 4 TID 19660, primary-20031 行 78221: 06-16 20:29:10.270815 1264 19660 D AudioFlinger_Threads: updateWakeLockUids_l AudioOut_42D uids: 行 78222: 06-16 20:29:10.270818 1264 19660 E AudioFlinger_Threads: no wake lock to update, but system ready! 行 78236: 06-16 20:29:10.272884 1264 19660 D AudioFlinger_Threads: updateWakeLockUids_l AudioOut_42D uids: 行 78237: 06-16 20:29:10.272895 1264 19660 E AudioFlinger_Threads: no wake lock to update, but system ready! 行 78554: 06-16 20:29:10.292061 1264 19661 I AudioFlinger_Threads: AudioFlinger's thread 0xb4000077a4e03978 tid=19661 ready to run 行 78560: 06-16 20:29:10.293039 1264 19661 D AudioFlinger_Threads: updateWakeLockUids_l AudioIn_F6 uids: 行 78562: 06-16 20:29:10.293127 1264 19661 D AudioFlinger_Threads: threadLoop set prio: 3 config event pid 1264 tid 19661 行 78564: 06-16 20:29:10.293343 1264 19661 D AudioFlinger_Threads: processConfigEvents_l(): boost thread AudioIn_F6 to RT priority 行 78590: 06-16 20:29:10.296346 1264 19661 D AudioFlinger_Threads: updateWakeLockUids_l AudioIn_F6 uids: 行 78595: 06-16 20:29:10.296381 1264 19661 D AudioFlinger_Threads: threadLoop set prio: 3 config event pid 1264 tid 19661 行 78598: 06-16 20:29:10.296393 1264 19661 D AudioFlinger_Threads: processConfigEvents_l(): boost thread AudioIn_F6 to RT priority 行 78977: 06-16 20:29:10.320346 1264 3920 D AudioFlinger_Threads: SPATIALIZER mMixerChannelMask 3f
最新发布
06-18
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值