Android 应用程序在睡眠锁定期间暂停,但其运行的本机线程不暂停?
我的应用程序中的睡眠锁有问题。 我正在使用一个本机线程,它使用套接字来检索包含音频数据的 RTP 数据包。然后,该音频数据被发送到 Java 中的 android 音频播放器类(MediaPlayer,我认为 - 我自己没有写那段代码)并正在播放。
如果我手动(不是因为它的“空闲”)启用睡眠锁定,似乎本机线程不断缓冲音频数据,但媒体播放器没有请求它,这意味着一旦您停用睡眠锁会延迟 5 秒。
我正在使用本机库来缓冲 RTP 数据包(speex jitterbuffer),但恐怕无法对此做太多事情。我的问题是:如何告诉我的应用在手动激活睡眠锁后继续播放声音?
谢谢
I am having a problem with the sleep lock in my application.
I am using a native thread which is using sockets to retrieve RTP packets who contains audio data. This audio data is then sent to the android audio player class in Java (MediaPlayer, I think - didn't write that piece myself) and is being played out.
What happens if, if I manually(not because its "idle") engage the sleep-lock, it seems the native threads keeps buffering audio data but the media player is not requesting it, which means once you deactivate the sleep lock you get like a 5-seconds delay.
I am using native library for buffering the RTP packtets (speex jitterbuffer) and cannot do much about it im afraid. My question is then: how do I tell my app to continue playing sound after having manually activated the sleep lock?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论