如何绘制由RemoteVideoTrack检索到的openGL的质感?(How to draw th

2019-11-05 08:25发布

基于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;
  }    

我得到的纹理ID mRemoteProxyVideoSink

  private class RemoteProxyVideoSink implements VideoSink {

    @Override
    synchronized public void onFrame(VideoFrame frame) {
       VideoFrame.TextureBuffer textureBuffer = (VideoFrame.TextureBuffer) frame.getBuffer();
       mTextureID = textureBuffer.getTextureId();
    }

  }

:onFrame 不是主UI线程解雇,但后台线程内(我不知道,如果它的物质)。 后来,当我在表面上绘制的第一个检索质感帧的主UI线程我有这样的结果:

但在以下刷新(即onFrame事件),当我尝试再次提请纹理(它的质地ID没有改变),那么我有这样的结果:

纹理的每个后续涂料使画面平克与平克。 随着时间的推移画面变得是绝对的粉红色,无肉眼可见的形式:

任何想法有什么不对吗?

文章来源: How to draw the openGL texture retrieved by RemoteVideoTrack?