iOS上的WebRTC尽管已接收到数据包+已解码,已建立ICE连接等,但没有视频

时间:2018-11-29 18:28:03

标签: ios webrtc

以前尝试解决这一问题,但没有显示视频帧。

完整日志发布在这里:https://pastebin.com/5KFHLuPH

是我的视频帧吗?我正在使用RTCEAGLVideoView,该视频附有用于呈现的视频轨,就像模板webRTC应用程序一样。任何帮助将不胜感激...

  func appClient(_ client: ARDAppClient!, didReceiveRemoteVideoTrack remoteVideoTrack: RTCVideoTrack!) {

    DispatchQueue.main.async{

        if self.remoteView == nil{
            let videoView = RTCEAGLVideoView(frame: self.view.bounds)
            if let local = self.localView{
                self.view.insertSubview(videoView, at:0)
            }
            else{
                self.view.addSubview(videoView)
            }
            self.remoteView = videoView
        }

        self.remoteVideoTrack=remoteVideoTrack
        self.remoteVideoTrack?.add(self.remoteView!)
    }
  }





- (void)peerConnection:(RTCPeerConnection *)peerConnection
          didAddStream:(RTCMediaStream *)stream {
    NSLog(@"Remote stream added");
    dispatch_async(dispatch_get_main_queue(), ^{
        RTCLog(@"Received %lu video tracks and %lu audio tracks",
               (unsigned long)stream.videoTracks.count,
               (unsigned long)stream.audioTracks.count);

        NSLog(@"Received %lu video tracks and %lu audio tracks",
              (unsigned long)stream.videoTracks.count,
              (unsigned long)stream.audioTracks.count);

        if (stream.videoTracks.count) {
            RTCVideoTrack *videoTrack = stream.videoTracks[0];
            [_delegate appClient:self didReceiveRemoteVideoTrack:videoTrack];
        }
    });
}

0 个答案:

没有答案