我在Android设备上设置了webrtc
(对等视频聊天)。当我绘制来自本地相机的纹理时,一切都很好,但是当我尝试绘制来自远程智能手机的纹理时,我得到的是粉红色图像,如下所示:
在webrtc
上,我只是这样做以获取远程流:
mRemoteVideoTrack = getRemoteVideoTrack();
mRemoteVideoTrack.setEnabled(true);
mRemoteVideoTrack.addSink(mRemoteProxyVideoSink);
private VideoTrack getRemoteVideoTrack() {
for (RtpTransceiver transceiver : mPeerConnection.getTransceivers()) {
MediaStreamTrack track = transceiver.getReceiver().track();
if (track instanceof VideoTrack) {
return (VideoTrack) track;
}
}
return null;
}
,我在mRemoteProxyVideoSink
中得到了纹理ID :
private class RemoteProxyVideoSink implements VideoSink {
@Override
synchronized public void onFrame(VideoFrame frame) {
VideoFrame.TextureBuffer textureBuffer = (VideoFrame.TextureBuffer) frame.getBuffer();
mTextureID = textureBuffer.getTextureId();
.. draw mTextureID (in UI thread because onFrame is not fired in UI thread) ...
}
}
知道我的纹理为何用粉红色绘制的任何想法吗?