我在android中实现了webrtc。在peerConnection对象中设置remoteDescription后,我无法加载远程视频流。 我正在获取远程音频,视频轨道,当onAddStream()被驱动时(org.webrtc.VideoTrack@37471a54)。但是无法在Videorenderer中加载它。
@Override
public void onAddStream(final MediaStream stream) {
Log.d("checklog","onaddstream"+stream.audioTracks.get(0)+stream.videoTracks.get(0));
executor.execute(new Runnable() {
@Override
public void run() {
if (peerConnection == null ) {
return;
}
if (stream.audioTracks.size() > 1 || stream.videoTracks.size() > 1) {
Log.d("onAddstreamerror","Weird-looking stream: " + stream);
return;
}
if (stream.videoTracks.size() == 1) {
remoteVideoTrack = stream.videoTracks.get(0);
remoteVideoTrack.setEnabled(true);
remoteVideoTrack.addRenderer(new VideoRenderer(remoteRender));
}
}
});
}