我调用以下方法将帧从 USB 摄像机流式传输到org.WebRTC
的 Video Capture Observer。它工作正常,除了在远程对等方的视频显示中每隔几秒钟出现一些损坏的帧(绿色或扭曲的灰色帧)。我想在将它们进一步发送给观察者之前验证它们是否是好图片nv21Buffer
。videoFrame
public void addFrame(ByteBuffer frame) {
try {
byte[] imageArray = new byte[frame.remaining()];
frame.get(imageArray);
NV21Buffer nv21Buffer = new NV21Buffer(imageArray, 640, 480, () -> JniCommon.nativeFreeByteBuffer(frame));
VideoFrame videoFrame = new VideoFrame(nv21Buffer, 0, System.nanoTime());
// before sending the videoFrame further, I need to validate if it is a good picture / frame
capturerObs.onFrameCaptured(videoFrame);
} catch (
Exception e) {
Log.d("addFrame", e.getMessage());
}
}
在进一步发送帧之前,是否有任何内置工具/方法来验证帧的好坏?