Android 使用服务器消息作为触发器录制视频时出错

Errors on Android recording video using server message as trigger

我正在尝试制作一个非常简单的应用程序,可以在多个设备上同步 stopping/starting 录音。

我正在使用这两个教程的混搭。

两个组件都可以独立运行。但是,当我将录制按钮更改为向服务器发送消息,然后在收到来自服务器的多播消息时执行 start/stop 录制操作时,应用程序开始随机崩溃大约 1/4时间.

此崩溃通常发生在 LogCat 中无限重复输出以下行。整个phone最终会die/restart.

05-19 18:09:36.596: E/Camera3-Device(3781): RequestThread: Can't get output buffer, skipping request: No such device (-19)
05-19 18:09:36.596: E/BufferQueueProducer(3781): [GraphicBufferSource] dequeueBuffer: BufferQueue has been abandoned
05-19 18:09:36.597: E/Camera3-OutputStream(3781): getBufferLocked: Stream 7: Can't dequeue next output buffer: No such device (-19)

有没有人以前看过这些错误日志并知道可能是什么原因?

直接按录制按钮starts/stops录制,无需sending/waiting服务器消息,此问题消失。

基于此forum, maybe it was because you're trying to release the back buffer after it had been released due to async issues. You can also look into this issue:

I think what’s happening here is that when MediaRecorder is reset, it kills the surface while the background thread is still trying to draw captured images onto it. I’m suspecting this based on the EGL error codes 0x300b and 0x300d (EGL_BAD_NATIVE_WINDOW and EGL_BAD_SURFACE, respectively).

在重置录像机之前关闭相机并在之后重新打开它可以解决这个问题。

检查这些相关的问题:

  • MediaRecorder.stop() hanging with Android 4.0 (ICS)
  • mediarecorder.stop() -> timed out waiting for incoming camera video frames