如果我将要记录的缓冲区放入队列中,是否有办法知道该缓冲区的实际填充时间,所以我可以使用它?
同样,是否有办法知道何时播放了缓冲区?
对于上下文:
我正在修改NDK示例“本地音频”.
它使用SLAndroidSimpleBufferQueueItf进行播放,并使用注释(为了进行流录制)进行注释(我想这样做).
现在我想知道的是,从我记得在某处阅读的内容来看,不能保证在下一次调用录音回调时(或在播放回调中播放)已经填充了一个缓冲区-如何知道何时缓冲区已被使用?
当然必须有某种方法,因为否则所有这些都将毫无用处? ^^
解决方法:
为了进行记录,如果向IBufferQueue_RegisterCallback注册slBufferQueueCallback,则当缓冲区已满时,您应该获得回调.
另请参阅android-ndk列表上的this discussion:
If I understand well, the recorder will call back each time a buffer in the queue is filled in, and these buffers are filled in in the order that they are enqueued. But the callback does not seem to expose a pointer to the corresponding filled buffer. So what would be the way to retreive this? A sample code in the OpenSL ES specs shows an example for playback with a struct passed in as context of the callback to keep track of these, is that the way to do?
…
Right. This is a known deficiency in the OpenSL ES 1.0.1 spec. OpenSL ES 1.1 adds an explicit parameter to identify the buffer, but Android is currently based on the 1.0.1 spec. A workaround is to maintain an index yourself to indicate which buffer is being completed.
标签:android-ndk,opensl,android 来源: https://codeday.me/bug/20191031/1976168.html
本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享; 2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关; 3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关; 4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除; 5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。