AudioRecord: buffer overflow?

后端 未结 2 804
温柔的废话
温柔的废话 2021-02-03 13:47

I\'m getting buffer overflow while RECORDING with my app. The recording is performed in a Service. I could not figure out why I\'m getting this message

2条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-03 14:28

    Thats because :

    framePeriod = bufferSize / bytesPerFrame;
    

    You need to multiply and not divide your buffersize.

    Try with :

    framePeriod = bufferSize * bytesPerFrame;
    

    And if you need a sample : here is a complete audio capture class

    hope it helps

提交回复
热议问题