为什么我的OpenGL纹理被涂成粉红色?

时间:2018-11-29 19:00:45

标签: android opengl-es webrtc textures

我在Android设备上设置了webrtc(对等视频聊天)。当我绘制来自本地相机的纹理时,一切都很好,但是当我尝试绘制来自远程智能手机的纹理时,我得到的是粉红色图像,如下所示:

enter image description here

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) ...
    }

  }

知道我的纹理为何用粉红色绘制的任何想法吗?

0 个答案:

没有答案