1

Remote video is not displayed even after onAddStream() is called

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]

I am calling displayLocalMedia() when video call request comes. In the activity am calling the displayLocalMedia().In the activity am calling the displayLocalMedia().In the activity am calling the displayLocalMedia().

Vinay
  • 1,284
  • 14
  • 24

1 Answers1

0

How do you add GLSurfaceView into VideoRendererGui? You should call VideoRendererGui.setView(surfaceView) and it's important to know how you create surface so please provide more code if it's possible.

Alexey Osminin
  • 190
  • 1
  • 4
  • 14
  • I did it still no luck – Vinay Jul 21 '15 at 09:56
  • Is local video displayed ok? – Alexey Osminin Jul 21 '15 at 10:23
  • Will there be any problem if ice candidates are not added problem ? I see "Candidate has unKnown component " error while adding candidates. – Vinay Jul 21 '15 at 10:26
  • Is connection established (could you hear audio stream)?I'm not sure but problems with ice candidates can't affect only on video or audio separately. If you can hear the voice (like simple audio call) so "Candidate has unKnown component" isn't a root cause I think. – Alexey Osminin Jul 21 '15 at 10:33
  • I don't hear any sound. Should i use "stream.audioTracks.get(0)" in onAddStream() – Vinay Jul 21 '15 at 10:56
  • No, it seems you have a connection problem, could you provide SDP and turn on libjingle logging using Logging.enableTracing( "logcat:", EnumSet.of(Logging.TraceLevel.TRACE_DEFAULT), Logging.Severity.LS_SENSITIVE); and attach them too? – Alexey Osminin Jul 21 '15 at 11:01
  • I added th sdp and libjingle logging – Vinay Jul 21 '15 at 12:05
  • Now I see that your offer sdp doesn't have any ice candidates, do you add some ice servers (stun or turn) during creation of peerConnection object? Also you can check my answer http://stackoverflow.com/questions/26022790/libjingle-on-android-srtp-error-on-createanswer/31411224#31411224 here is normal SDP – Alexey Osminin Jul 21 '15 at 12:21
  • Ice candidates are sent separately. While adding them to the peerConnection "Candidate has unknown component " warning is displayed in the logcat – Vinay Jul 22 '15 at 03:58
  • Did you find root cause and solution? – Alexey Osminin Jul 28 '15 at 08:45
  • The reason was I was sending the offer before the peer's local video is launched.Now I got the remote video but it displays for a sec and the app crashes. Can anyone please help ? – Vinay Jul 29 '15 at 07:19
  • 07-29 14:37:17.054: E/rtc(5482): # Fatal error in../../webrtc/modules/video_coding/main/source/video_sender.cc, line 81, 07-29 14:37:17.055: A/libc(5482): Fatal signal 6 (SIGABRT), code -6 in tid 5631 (Thread-18959) – Vinay Jul 29 '15 at 09:08
  • Something wrong with local video stream, try to remove PeerConnectionFactory.initializeFieldTrials("WebRTC-SupportVP9/Enabled/"); to let webrtc use default vp8 codec, it might help – Alexey Osminin Jul 29 '15 at 09:31
  • can you tell me how to use codec for sending local video. – Vinay Jul 31 '15 at 05:24
  • see the sdp it's only contain audio : "m=audio..." so you can not get videoTrack from stream, i have same problem – famfamfam Aug 28 '20 at 04:19