没有远程视频显示android webrtc

时间:2015-07-16 12:13:05

标签: android webrtc

即使调用onAddStream()

,也不会显示远程视频
public void onAddStream(final MediaStream stream)
    {
       remoteRender = VideoRendererGui.create(0, 0,100, 100,ScalingType.SCALE_ASPECT_FILL, true);
            if(stream.videoTracks.size()>0)
            {
                        remoteVideoTrack=stream.videoTracks.get(0);
                        remoteVideoTrack.setEnabled(true);
                        remoteVideoTrack.addRenderer(new VideoRenderer(remoteRender));
            }   
    }

void displayLocalMedia()
    {
        videoConstraints = CameraIntialization.intializeVideoConstraints();
        PeerConnectionFactory.initializeFieldTrials("WebRTC-SupportVP9/Enabled/");

        String cameraDeviceName = CameraIntialization.checkDeviceCamera();
        if(peerConnectionFactory==null)
        peerConnectionFactory = new PeerConnectionFactory();

        mediaStream = peerConnectionFactory.createLocalMediaStream("ARDAMS");
        VideoCapturer capturer = VideoCapturerAndroid.create(cameraDeviceName,null);

        videoSource = peerConnectionFactory.createVideoSource(capturer,videoConstraints);
        videoTrack = peerConnectionFactory.createVideoTrack("ARDAMSv0",videoSource);
        videoTrack.setEnabled(true);

        try {
                /*renderer = VideoRendererGui.createGui(0, 0, 100, 100,ScalingType.SCALE_ASPECT_FIT, true);
                videoTrack.addRenderer(renderer);
                System.out.println("VideoTrack.........." + videoTrack);

                remoteRenderer = VideoRendererGui.createGui(0, 0, 100, 100,ScalingType.SCALE_ASPECT_FILL, true);    */  


                localRender = VideoRendererGui.create(
                    LOCAL_X_CONNECTED, LOCAL_Y_CONNECTED,
                    LOCAL_WIDTH_CONNECTED, LOCAL_HEIGHT_CONNECTED, ScalingType.SCALE_ASPECT_FIT, false  );
                videoTrack.addRenderer(new VideoRenderer(localRender));

            } 
        catch (Exception e) 
            {
                e.printStackTrace();
            }

        AudioSource audioSource = peerConnectionFactory.createAudioSource(audioConstraints);
        AudioTrack localAudioTrack = peerConnectionFactory.createAudioTrack("ARDAMSa0", audioSource);
        mediaStream.addTrack(videoTrack);
        mediaStream.addTrack(localAudioTrack);
        if(createPeerConnection()!=null)
            peerConnectionObj.addStream(mediaStream);

    }

SDP:

v=0   
o=- 3016019265559800033 2 IN IP4 127.0.0.1   
s=-   
t=0 0   
a=group:BUNDLE audio video data   
a=msid-semantic: WMS   
m=audio 9 RTP/SAVPF 111 103 104 9 0 8 106 105 13 126   
c=IN IP4 0.0.0.0   
a=rtcp:9 IN IP4 0.0.0.0   
a=ice-ufrag:zN8F4g5k77BUQmeT   
a=ice-pwd:Hn/Y9lh3meiwBeNHVl9ZwADo   
a=fingerprint:sha-256 54:0C:02:8E:5B:39:29:DE:15:06:11:0F:F2:06:BE:F6:8E:D9:36:B3:6A:DF:CA:08:8F:E7:6E:E7:1D:6C:81:C7   
a=setup:actpass   
a=mid:audio   
a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level   
a=extmap:3 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time   
a=recvonly   
a=rtcp-mux   
a=rtpmap:111 opus/48000/2   
a=fmtp:111 minptime=10; useinbandfec=1   
a=rtpmap:103 ISAC/16000   
a=rtpmap:104 ISAC/32000   
a=rtpmap:9 G722/8000   
a=rtpmap:0 PCMU/8000   
a=rtpmap:8 PCMA/8000   
a=rtpmap:106 CN/32000   
a=rtpmap:105 CN/16000   
a=rtpmap:13 CN/8000   
a=rtpmap:126 telephone-event/8000   
a=maxptime:60   
m=video 9 RTP/SAVPF 100 116 117 96   
c=IN IP4 0.0.0.0   a=rtcp:9 IN IP4 0.0.0.0  
a=ice-ufrag:zN8F4g5k77BUQmeT   
a=ice-pwd:Hn/Y9lh3meiwBeNHVl9ZwADo   
a=fingerprint:sha-256 54:0C:02:8E:5B:39:29:DE:15:06:11:0F:F2:06:BE:F6:8E:D9:36:B3:6A:DF:CA:08:8F:E7:6E:E7:1D:6C:81:C7   
a=setup:actpass   
a=mid:video   
a=extmap:2 urn:ietf:params:rtp-hdrext:toffset   
a=extmap:3 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time   
a=extmap:4 urn:3gpp:video-orientation
a=recvonly   
a=rtcp-mux   
a=rtpmap:100 VP8/90000   
a=rtcp-fb:100 ccm fir   
a=rtcp-fb:100 nack   
a=rtcp-fb:100 nack pli   
a=rtcp-fb:100 goog-remb   
a=rtpmap:116 red/90000   
a=rtpmap:117 ulpfec/90000   
a=rtpmap:96 rtx/90000   
a=fmtp:96 apt=100   
m=application 9 RTP/SAVPF 101   
c=IN IP4 0.0.0.0   
b=AS:30   
a=rtcp:9 IN IP4 0.0.0.0   
a=ice-ufrag:zN8F4g5k77BUQmeT   
a=ice-pwd:Hn/Y9lh3meiwBeNHVl9ZwADo   
a=fingerprint:sha-256 54:0C:02:8E:5B:39:29:DE:15:06:11:0F:F2:06:BE:F6:8E:D9:36:B3:6A:DF:CA:08:8F:E7:6E:E7:1D:6C:81:C7   
a=setup:actpass   
a=mid:data   
a=sendrecv   
a=rtcp-mux   
a=rtpmap:101 google-data/90000   
a=ssrc:3314109943 cname:ni+E6bkNU4J0MUl5   
a=ssrc:3314109943 msid:sendDataChannel sendDataChannel   
a=ssrc:3314109943 mslabel:sendDataChannel   
a=ssrc:3314109943 label:sendDataChannel   

libjingle logging:

07-21 17:06:02.247: V/libjingle(13944): Jingle:Conn[0x60a60008:audio:Z6ox6F9n:1:0:local:udp:20.20.24.159:37142->1LZWj5qV:1:2122260223:local:udp:20.20.24.158:53375|C--W|9115038255631187454|-]: UpdateState(), ms since last received response=101946164, ms since last received data=101946164, rtt=3000, pings_since_last_response=
07-21 17:06:02.248: V/libjingle(13944): Jingle:Conn[0x5b34b250:audio:Z6ox6F9n:1:0:local:udp:20.20.24.159:37142->zPHJd6WM:1:2122260223:local:udp:20.20.24.158:46993|C--W|9115038255631187454|-]: UpdateState(), ms since last received response=101946164, ms since last received data=101946164, rtt=3000, pings_since_last_response=
07-21 17:06:02.248: V/libjingle(13944): Sorting available connections:
07-21 17:06:02.248: V/libjingle(13944): Conn[0x60a60008:audio:Z6ox6F9n:1:0:local:udp:20.20.24.159:37142->1LZWj5qV:1:2122260223:local:udp:20.20.24.158:53375|C--W|9115038255631187454|-]
07-21 17:06:02.248: V/libjingle(13944): Conn[0x5b34b250:audio:Z6ox6F9n:1:0:local:udp:20.20.24.159:37142->zPHJd6WM:1:2122260223:local:udp:20.20.24.158:46993|C--W|9115038255631187454|-]
07-21 17:06:02.251: V/libjingle(13944): Jingle:Conn[0x60a60008:audio:Z6ox6F9n:1:0:local:udp:20.20.24.159:37142->1LZWj5qV:1:2122260223:local:udp:20.20.24.158:53375|C--W|9115038255631187454|-]: UpdateState(), ms since last received response=101946168, ms since last received data=101946168, rtt=3000, pings_since_last_response=
07-21 17:06:02.251: V/libjingle(13944): Jingle:Conn[0x5b34b250:audio:Z6ox6F9n:1:0:local:udp:20.20.24.159:37142->zPHJd6WM:1:2122260223:local:udp:20.20.24.158:46993|C--W|9115038255631187454|-]: UpdateState(), ms since last received response=101946168, ms since last received data=101946168, rtt=3000, pings_since_last_response=
07-21 17:06:02.251: V/libjingle(13944): Jingle:Conn[0x60a60008:audio:Z6ox6F9n:1:0:local:udp:20.20.24.159:37142->1LZWj5qV:1:2122260223:local:udp:20.20.24.158:53375|C--W|9115038255631187454|-]: Sending STUN ping , id=675a6158734c513134427564

07-21 17:06:02.260: V/libjingle(13944): Jingle:Conn[0x60a60008:audio:Z6ox6F9n:1:0:local:udp:20.20.24.159:37142->1LZWj5qV:1:2122260223:local:udp:20.20.24.158:53375|C-WI|9115038255631187454|-]: set_write_state from: 2 to 0
07-21 17:06:02.260: V/libjingle(13944): Jingle:Conn[0x60a60008:audio:Z6ox6F9n:1:0:local:udp:20.20.24.159:37142->1LZWj5qV:1:2122260223:local:udp:20.20.24.158:53375|C-WS|9115038255631187454|-]: set_state

07-21 17:06:02.261: V/libjingle(13944): Jingle:Conn[0x60a60008:audio:Z6ox6F9n:1:0:local:udp:20.20.24.159:37142->1LZWj5qV:1:2122260223:local:udp:20.20.24.158:53375|C-WS|9115038255631187454|2252]: UpdateState(), ms since last received response=0, ms since last received data=101946177, rtt=3000, pings_since_last_response=
07-21 17:06:02.261: V/libjingle(13944): Jingle:Conn[0x5b34b250:audio:Z6ox6F9n:1:0:local:udp:20.20.24.159:37142->zPHJd6WM:1:2122260223:local:udp:20.20.24.158:46993|C--W|9115038255631187454|-]: UpdateState(), ms since last received response=101946177, ms since last received data=101946177, rtt=3000, pings_since_last_response=
07-21 17:06:02.261: V/libjingle(13944): Sorting available connections:
07-21 17:06:02.261: V/libjingle(13944): Conn[0x60a60008:audio:Z6ox6F9n:1:0:local:udp:20.20.24.159:37142->1LZWj5qV:1:2122260223:local:udp:20.20.24.158:53375|C-WS|9115038255631187454|2252]
07-21 17:06:02.261: V/libjingle(13944): Conn[0x5b34b250:audio:Z6ox6F9n:1:0:local:udp:20.20.24.159:37142->zPHJd6WM:1:2122260223:local:udp:20.20.24.158:46993|C--W|9115038255631187454|-]
07-21 17:06:02.261: V/libjingle(13944): Jingle:Conn[0x5b34b250:audio:Z6ox6F9n:1:0:local:udp:20.20.24.159:37142->zPHJd6WM:1:2122260223:local:udp:20.20.24.158:46993|C--W|9115038255631187454|-]: Connection pruned
07-21 17:06:02.261: V/libjingle(13944): Jingle:Conn[0x5b34b250:audio:Z6ox6F9n:1:0:local:udp:20.20.24.159:37142->zPHJd6WM:1:2122260223:local:udp:20.20.24.158:46993|C-xW|9115038255631187454|-]: set_write_state from: 2 to 3
07-21 17:06:02.261: V/libjingle(13944): Jingle:Conn[0x60a60008:audio:Z6ox6F9n:1:0:local:udp:20.20.24.159:37142->1LZWj5qV:1:2122260223:local:udp:20.20.24.158:53375|C-WS|9115038255631187454|2252]: UpdateState(), ms since last received response=1, ms since last received data=101946178, rtt=3000, pings_since_last_response=
07-21 17:06:02.261: V/libjingle(13944): Jingle:Conn[0x5b34b250:audio:Z6ox6F9n:1:0:local:udp:20.20.24.159:37142->zPHJd6WM:1:2122260223:local:udp:20.20.24.158:46993|C-xW|9115038255631187454|-]: UpdateState(), ms since last received response=101946178, ms since last received data=101946178, rtt=3000, pings_since_last_response=
07-21 17:06:02.261: V/libjingle(13944): Sorting available connections:
07-21 17:06:02.262: V/libjingle(13944): Conn[0x60a60008:audio:Z6ox6F9n:1:0:local:udp:20.20.24.159:37142->1LZWj5qV:1:2122260223:local:udp:20.20.24.158:53375|C-WS|9115038255631187454|2252]
07-21 17:06:02.262: V/libjingle(13944): Conn[0x5b34b250:audio:Z6ox6F9n:1:0:local:udp:20.20.24.159:37142->zPHJd6WM:1:2122260223:local:udp:20.20.24.158:46993|C-xW|9115038255631187454|-]

07-21 17:06:02.294: V/libjingle(13944): AllocationSequence: Relay ports disabled, skipping.
07-21 17:06:02.296: V/libjingle(13944): Jingle:Conn[0x60a60008:audio:Z6ox6F9n:1:0:local:udp:20.20.24.159:37142->1LZWj5qV:1:2122260223:local:udp:20.20.24.158:53375|C-WS|9115038255631187454|2252]: UpdateState(), ms since last received response=35, ms since last received data=101946212, rtt=3000, pings_since_last_response=
07-21 17:06:02.296: V/libjingle(13944): Sorting available connections:
07-21 17:06:02.296: V/libjingle(13944): Conn[0x60a60008:audio:Z6ox6F9n:1:0:local:udp:20.20.24.159:37142->1LZWj5qV:1:2122260223:local:udp:20.20.24.158:53375|C-WS|9115038255631187454|2252]

07-21 17:06:02.298: V/libjingle(13944): Jingle:Conn[0x60a60008:audio:Z6ox6F9n:1:0:local:udp:20.20.24.159:37142->1LZWj5qV:1:2122260223:local:udp:20.20.24.158:53375|C-WS|9115038255631187454|2252]: UpdateState(), ms since last received response=38, ms since last received data=101946215, rtt=3000, pings_since_last_response=
07-21 17:06:02.299: V/libjingle(13944): Jingle:Conn[0x6abe1b88:audio:Z6ox6F9n:1:0:local:udp:20.20.24.159:37142->Xzro6tVF:1:2122260223:local:udp:20.20.24.158:38243|C--W|9115038255631187454|-]: UpdateState(), ms since last received response=101946215, ms since last received data=101946215, rtt=3000, pings_since_last_response=
07-21 17:06:02.299: V/libjingle(13944): Sorting available connections:
07-21 17:06:02.299: V/libjingle(13944): Conn[0x60a60008:audio:Z6ox6F9n:1:0:local:udp:20.20.24.159:37142->1LZWj5qV:1:2122260223:local:udp:20.20.24.158:53375|C-WS|9115038255631187454|2252]
07-21 17:06:02.299: V/libjingle(13944): Conn[0x6abe1b88:audio:Z6ox6F9n:1:0:local:udp:20.20.24.159:37142->Xzro6tVF:1:2122260223:local:udp:20.20.24.158:38243|C--W|9115038255631187454|-]
07-21 17:06:02.299: V/libjingle(13944): Jingle:Conn[0x6abe1b88:audio:Z6ox6F9n:1:0:local:udp:20.20.24.159:37142->Xzro6tVF:1:2122260223:local:udp:20.20.24.158:38243|C--W|9115038255631187454|-]: Connection pruned
07-21 17:06:02.299: V/libjingle(13944): Jingle:Conn[0x6abe1b88:audio:Z6ox6F9n:1:0:local:udp:20.20.24.159:37142->Xzro6tVF:1:2122260223:local:udp:20.20.24.158:38243|C-xW|9115038255631187454|-]: set_write_state from: 2 to 3
07-21 17:06:02.299: V/libjingle(13944): Jingle:Conn[0x60a60008:audio:Z6ox6F9n:1:0:local:udp:20.20.24.159:37142->1LZWj5qV:1:2122260223:local:udp:20.20.24.158:53375|C-WS|9115038255631187454|2252]: UpdateState(), ms since last received response=39, ms since last received data=101946216, rtt=3000, pings_since_last_response=
07-21 17:06:02.300: V/libjingle(13944): Jingle:Conn[0x6abe1b88:audio:Z6ox6F9n:1:0:local:udp:20.20.24.159:37142->Xzro6tVF:1:2122260223:local:udp:20.20.24.158:38243|C-xW|9115038255631187454|-]: UpdateState(), ms since last received response=101946216, ms since last received data=101946216, rtt=3000, pings_since_last_response=
07-21 17:06:02.300: V/libjingle(13944): Sorting available connections:
07-21 17:06:02.300: V/libjingle(13944): Conn[0x60a60008:audio:Z6ox6F9n:1:0:local:udp:20.20.24.159:37142->1LZWj5qV:1:2122260223:local:udp:20.20.24.158:53375|C-WS|9115038255631187454|2252]
07-21 17:06:02.300: V/libjingle(13944): Conn[0x6abe1b88:audio:Z6ox6F9n:1:0:local:udp:20.20.24.159:37142->Xzro6tVF:1:2122260223:local:udp:20.20.24.158:38243|C-xW|9115038255631187454|-]
07-21 17:06:02.300: I/libjingle(13944): Jingle:Conn[0x6abe1b88:audio:Z6ox6F9n:1:0:local:udp:20.20.24.159:37142->Xzro6tVF:1:2122260223:local:udp:20.20.24.158:38243|C-xW|9115038255631187454|-]: Connection deleted due to read or write timeout
07-21 17:06:02.300: I/libjingle(13944): Jingle:Channel[audio|1|__]: Removed connection (1 remaining)
07-21 17:06:02.301: V/libjingle(13944): Jingle:Conn[0x60a60008:audio:Z6ox6F9n:1:0:local:udp:20.20.24.159:37142->1LZWj5qV:1:2122260223:local:udp:20.20.24.158:53375|C-WS|9115038255631187454|2252]: UpdateState(), ms since last received response=41, ms since last received data=101946218, rtt=3000, pings_since_last_response=
07-21 17:06:02.301: V/libjingle(13944): Sorting available connections:
07-21 17:06:02.302: V/libjingle(13944): Conn[0x60a60008:audio:Z6ox6F9n:1:0:local:udp:20.20.24.159:37142->1LZWj5qV:1:2122260223:local:udp:20.20.24.158:53375|C-WS|9115038255631187454|2252]
07-21 17:06:02.302: V/libjingle(13944): Jingle:Conn[0x60a60008:audio:Z6ox6F9n:1:0:local:udp:20.20.24.159:37142->1LZWj5qV:1:2122260223:local:udp:20.20.24.158:53375|C-WS|9115038255631187454|2252]: UpdateState(), ms since last received response=41, ms since last received data=101946218, rtt=3000, pings_since_last_response=
07-21 17:06:02.302: V/libjingle(13944): Jingle:Conn[0x60a60008:audio:Z6ox6F9n:1:0:local:udp:20.20.24.159:37142->1LZWj5qV:1:2122260223:local:udp:20.20.24.158:53375|C-WS|9115038255631187454|2252]: Sending STUN ping , id=697343765445743830784265
07-21 17:06:02.302: V/libjingle(13944): Jingle:Conn[0x60a60008:audio:Z6ox6F9n:1:0:local:udp:20.20.24.159:37142->1LZWj5qV:1:2122260223:local:udp:20.20.24.158:53375|C-WS|9115038255631187454|2252]: Sent STUN ping, id=697343765445743830784265, use_candidate=0

07-21 17:06:02.308: V/libjingle(13944): Jingle:Conn[0x60a60008:audio:Z6ox6F9n:1:0:local:udp:20.20.24.159:37142->1LZWj5qV:1:2122260223:local:udp:20.20.24.158:53375|C-WI|9115038255631187454|2252]: UpdateState(), ms since last received response=48, ms since last received data=101946225, rtt=3000, pings_since_last_response=697343765445743830784265 
07-21 17:06:02.308: V/libjingle(13944): Sorting available connections:
07-21 17:06:02.309: V/libjingle(13944): Conn[0x60a60008:audio:Z6ox6F9n:1:0:local:udp:20.20.24.159:37142->1LZWj5qV:1:2122260223:local:udp:20.20.24.158:53375|C-WI|9115038255631187454|2252]
07-21 17:06:02.309: V/libjingle(13944): Jingle:Conn[0x60a60008:audio:Z6ox6F9n:1:0:local:udp:20.20.24.159:37142->1LZWj5qV:1:2122260223:local:udp:20.20.24.158:53375|C-WI|9115038255631187454|2252]: UpdateState(), ms since last received response=49, ms since last received data=101946226, rtt=3000, pings_since_last_response=697343765445743830784265 
07-21 17:06:02.309: V/libjingle(13944): Sorting available connections:
07-21 17:06:02.309: V/libjingle(13944): Conn[0x60a60008:audio:Z6ox6F9n:1:0:local:udp:20.20.24.159:37142->1LZWj5qV:1:2122260223:local:udp:20.20.24.158:53375|C-WI|9115038255631187454|2252]

当视频通话请求到来时,我正在调用displayLocalMedia()。 在活动中调用displayLocalMedia()。在活动中调用displayLocalMedia()。在活动中调用displayLocalMedia()。

1 个答案:

答案 0 :(得分:0)

如何将GLSurfaceView添加到VideoRendererGui中?您应该调用VideoRendererGui.setView(surfaceView),了解如何创建曲面非常重要,因此如果可能,请提供更多代码。