代码之家  ›  专栏  ›  技术社区  ›  FranP

WebRTC不显示远程媒体

  •  0
  • FranP  · 技术社区  · 6 年前

    我正在开发我的第一个WebRTC应用程序(视频聊天),我遇到了一些问题。

    问题是,我不能在本地对等机上正确地显示远程流,但它只是偶尔发生。

    我是说,例如 经常工作很好 :

    • 在Chrome/Opera for Android和Android/Opera for Windows之间
    • 当我在电脑上使用同一个浏览器的两个标签时。

      但是 不好用吗? :

    • 当我试图在两台不同的计算机之间建立连接时,无论哪个浏览器都无关紧要。

    信令服务器是用node.js和 websocket 图书馆。

    问题是,连接似乎工作正常(当被叫方到来时,有一个连接设置和一个提供/应答传输)。

    我会把我的SDP代码放在这里,也许你能帮我看看是否出了问题:

    被叫方(收到的报价):

    "v=0
    o=- 6054484206475406414 2 IN IP4 127.0.0.1
    s=-
    t=0 0
    a=group:BUNDLE audio video
    a=msid-semantic: WMS RkydrovqF8H5a1LGU8Bcl0GG1bmgsSHCjKaB
    m=audio 9 UDP/TLS/RTP/SAVPF 111 103 104 9 0 8 106 105 13 110 112 113 126
    c=IN IP4 0.0.0.0
    a=rtcp:9 IN IP4 0.0.0.0
    a=ice-ufrag:W3ex
    a=ice-pwd:V0W/L093KmN2xg3/YNkN8WRs
    a=ice-options:trickle
    a=fingerprint:sha-256      46:E4:F6:13:B4:19:D6:12:55:8A:56:66:77:34:51:73:5F:CF:A1:1A:DC:00:E9:46:D5:FF:EF:  72:6D:E6:A9:D6
    a=setup:actpass
    a=mid:audio
    a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level
    a=sendrecv
    a=rtcp-mux
    a=rtpmap:111 opus/48000/2
    a=rtcp-fb:111 transport-cc
    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:110 telephone-event/48000
    a=rtpmap:112 telephone-event/32000
    a=rtpmap:113 telephone-event/16000
    a=rtpmap:126 telephone-event/8000
    a=ssrc:1569538704 cname:SKNCGEejjnbKbP66
    a=ssrc:1569538704 msid:RkydrovqF8H5a1LGU8Bcl0GG1bmgsSHCjKaB 9077db38-7e9d- 4c6d-80b8-74c8396f0ca6
    a=ssrc:1569538704 mslabel:RkydrovqF8H5a1LGU8Bcl0GG1bmgsSHCjKaB
    a=ssrc:1569538704 label:9077db38-7e9d-4c6d-80b8-74c8396f0ca6
    m=video 9 UDP/TLS/RTP/SAVPF 96 97 98 99 100 101 102 122 127 121 125 107 108 109 124 120 123 119 114
    c=IN IP4 0.0.0.0
    a=rtcp:9 IN IP4 0.0.0.0
    a=ice-ufrag:W3ex
    a=ice-pwd:V0W/L093KmN2xg3/YNkN8WRs
    a=ice-options:trickle
    a=fingerprint:sha-256 46:E4:F6:13:B4:19:D6:12:55:8A:56:66:77:34:51:73:5F:CF:A1:1A:DC:00:E9:46:D5:FF:EF:72:6D:E6:A9:D6
    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=extmap:5 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc- extensions-01
    a=extmap:6 http://www.webrtc.org/experiments/rtp-hdrext/playout-delay
    a=extmap:7 http://www.webrtc.org/experiments/rtp-hdrext/video-content-type
    a=extmap:8 http://www.webrtc.org/experiments/rtp-hdrext/video-timing
    a=extmap:10 http://tools.ietf.org/html/draft-ietf-avtext-framemarking-07
    a=sendrecv
    a=rtcp-mux
    a=rtcp-rsize
    a=rtpmap:96 VP8/90000
    a=rtcp-fb:96 goog-remb
    a=rtcp-fb:96 transport-cc
    a=rtcp-fb:96 ccm fir
    a=rtcp-fb:96 nack
    a=rtcp-fb:96 nack pli
    a=rtpmap:97 rtx/90000
    a=fmtp:97 apt=96
    a=rtpmap:98 VP9/90000
    a=rtcp-fb:98 goog-remb
    a=rtcp-fb:98 transport-cc
    a=rtcp-fb:98 ccm fir
    a=rtcp-fb:98 nack
    a=rtcp-fb:98 nack pli
    a=fmtp:98 profile-id=0
    a=rtpmap:99 rtx/90000
    a=fmtp:99 apt=98
    a=rtpmap:100 H264/90000
    a=rtcp-fb:100 goog-remb
    a=rtcp-fb:100 transport-cc
    a=rtcp-fb:100 ccm fir
    a=rtcp-fb:100 nack
    a=rtcp-fb:100 nack pli
    a=fmtp:100 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42001f
    a=rtpmap:101 rtx/90000
    a=fmtp:101 apt=100
    a=rtpmap:102 H264/90000
    a=rtcp-fb:102 goog-remb
    a=rtcp-fb:102 transport-cc
    a=rtcp-fb:102 ccm fir
    a=rtcp-fb:102 nack
    a=rtcp-fb:102 nack pli
    a=fmtp:102 level-asymmetry-allowed=1;packetization-mode=0;profile-level-id=42001f
    a=rtpmap:122 rtx/90000
    a=fmtp:122 apt=102
    a=rtpmap:127 H264/90000
    a=rtcp-fb:127 goog-remb
    a=rtcp-fb:127 transport-cc
    a=rtcp-fb:127 ccm fir
    a=rtcp-fb:127 nack
    a=rtcp-fb:127 nack pli
    a=fmtp:127 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f
    a=rtpmap:121 rtx/90000
    a=fmtp:121 apt=127
    a=rtpmap:125 H264/90000
    a=rtcp-fb:125 goog-remb
    a=rtcp-fb:125 transport-cc
    a=rtcp-fb:125 ccm fir
    a=rtcp-fb:125 nack
    a=rtcp-fb:125 nack pli
    a=fmtp:125 level-asymmetry-allowed=1;packetization-mode=0;profile-level-id=42e01f
    a=rtpmap:107 rtx/90000
    a=fmtp:107 apt=125
    a=rtpmap:108 H264/90000
    a=rtcp-fb:108 goog-remb
    a=rtcp-fb:108 transport-cc
    a=rtcp-fb:108 ccm fir
    a=rtcp-fb:108 nack
    a=rtcp-fb:108 nack pli
    a=fmtp:108 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=4d0032
    a=rtpmap:109 rtx/90000
    a=fmtp:109 apt=108
    a=rtpmap:124 H264/90000
    a=rtcp-fb:124 goog-remb
    a=rtcp-fb:124 transport-cc
    a=rtcp-fb:124 ccm fir
    a=rtcp-fb:124 nack
    a=rtcp-fb:124 nack pli
    a=fmtp:124 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=640032
    a=rtpmap:120 rtx/90000
    a=fmtp:120 apt=124
    a=rtpmap:123 red/90000
    a=rtpmap:119 rtx/90000
    a=fmtp:119 apt=123
    a=rtpmap:114 ulpfec/90000
    a=ssrc-group:FID 1391635065 3022413398
    a=ssrc:1391635065 cname:SKNCGEejjnbKbP66
    a=ssrc:1391635065 msid:RkydrovqF8H5a1LGU8Bcl0GG1bmgsSHCjKaB f8c6a0bd-4438-495c-895e-0f4180112cea
    a=ssrc:1391635065 mslabel:RkydrovqF8H5a1LGU8Bcl0GG1bmgsSHCjKaB
    a=ssrc:1391635065 label:f8c6a0bd-4438-495c-895e-0f4180112cea
    a=ssrc:3022413398 cname:SKNCGEejjnbKbP66
    a=ssrc:3022413398 msid:RkydrovqF8H5a1LGU8Bcl0GG1bmgsSHCjKaB f8c6a0bd-4438-495c-895e-0f4180112cea
    a=ssrc:3022413398 mslabel:RkydrovqF8H5a1LGU8Bcl0GG1bmgsSHCjKaB
    a=ssrc:3022413398 label:f8c6a0bd-4438-495c-895e-0f4180112cea
    "
    

    呼叫者(收到的应答):

    "v=0
    o=- 7085228660038989257 2 IN IP4 127.0.0.1
    s=-
    t=0 0
    a=group:BUNDLE audio video
    a=msid-semantic: WMS
    m=audio 9 UDP/TLS/RTP/SAVPF 111 103 104 9 0 8 106 105 13 110 112 113 126
    c=IN IP4 0.0.0.0
    a=rtcp:9 IN IP4 0.0.0.0
    a=ice-ufrag:xq7k
    a=ice-pwd:TJdcAwO4t3idGbRFAzjGxShI
    a=ice-options:trickle
    a=fingerprint:sha-256 F5:95:1F:17:E2:F1:DB:29:78:9A:0C:F5:2F:90:8D:F7:1C:28:A6:40:6A:52:5D:C0:74:C1:CB:B8:29:55:42:5D
    a=setup:active
    a=mid:audio
    a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level
    a=recvonly
    a=rtcp-mux
    a=rtpmap:111 opus/48000/2
    a=rtcp-fb:111 transport-cc
    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:110 telephone-event/48000
    a=rtpmap:112 telephone-event/32000
    a=rtpmap:113 telephone-event/16000
    a=rtpmap:126 telephone-event/8000
    m=video 9 UDP/TLS/RTP/SAVPF 96 97 98 99 100 101 102 122 127 121 125 107 108 109 124 120 123 119 114
    c=IN IP4 0.0.0.0
    a=rtcp:9 IN IP4 0.0.0.0
    a=ice-ufrag:xq7k
    a=ice-pwd:TJdcAwO4t3idGbRFAzjGxShI
    a=ice-options:trickle
    a=fingerprint:sha-256 F5:95:1F:17:E2:F1:DB:29:78:9A:0C:F5:2F:90:8D:F7:1C:28:A6:40:6A:52:5D:C0:74:C1:CB:B8:29:55:42:5D
    a=setup:active
    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=extmap:5 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
    a=extmap:6 http://www.webrtc.org/experiments/rtp-hdrext/playout-delay
    a=extmap:7 http://www.webrtc.org/experiments/rtp-hdrext/video-content-type
    a=extmap:8 http://www.webrtc.org/experiments/rtp-hdrext/video-timing
    a=recvonly
    a=rtcp-mux
    a=rtcp-rsize
    a=rtpmap:96 VP8/90000
    a=rtcp-fb:96 goog-remb
    a=rtcp-fb:96 transport-cc
    a=rtcp-fb:96 ccm fir
    a=rtcp-fb:96 nack
    a=rtcp-fb:96 nack pli
    a=rtpmap:97 rtx/90000
    a=fmtp:97 apt=96
    a=rtpmap:98 VP9/90000
    a=rtcp-fb:98 goog-remb
    a=rtcp-fb:98 transport-cc
    a=rtcp-fb:98 ccm fir
    a=rtcp-fb:98 nack
    a=rtcp-fb:98 nack pli
    a=fmtp:98 x-google-profile-id=0
    a=rtpmap:99 rtx/90000
    a=fmtp:99 apt=98
    a=rtpmap:100 H264/90000
    a=rtcp-fb:100 goog-remb
    a=rtcp-fb:100 transport-cc
    a=rtcp-fb:100 ccm fir
    a=rtcp-fb:100 nack
    a=rtcp-fb:100 nack pli
    a=fmtp:100 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42001f
    a=rtpmap:101 rtx/90000
    a=fmtp:101 apt=100
    a=rtpmap:102 H264/90000
    a=rtcp-fb:102 goog-remb
    a=rtcp-fb:102 transport-cc
    a=rtcp-fb:102 ccm fir
    a=rtcp-fb:102 nack
    a=rtcp-fb:102 nack pli
    a=fmtp:102 level-asymmetry-allowed=1;packetization-mode=0;profile-level-id=42001f
    a=rtpmap:122 rtx/90000
    a=fmtp:122 apt=102
    a=rtpmap:127 H264/90000
    a=rtcp-fb:127 goog-remb
    a=rtcp-fb:127 transport-cc
    a=rtcp-fb:127 ccm fir
    a=rtcp-fb:127 nack
    a=rtcp-fb:127 nack pli
    a=fmtp:127 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f
    a=rtpmap:121 rtx/90000
    a=fmtp:121 apt=127
    a=rtpmap:125 H264/90000
    a=rtcp-fb:125 goog-remb
    a=rtcp-fb:125 transport-cc
    a=rtcp-fb:125 ccm fir
    a=rtcp-fb:125 nack
    a=rtcp-fb:125 nack pli
    a=fmtp:125 level-asymmetry-allowed=1;packetization-mode=0;profile-level-id=42e01f
    a=rtpmap:107 rtx/90000
    a=fmtp:107 apt=125
    a=rtpmap:108 H264/90000
    a=rtcp-fb:108 goog-remb
    a=rtcp-fb:108 transport-cc
    a=rtcp-fb:108 ccm fir
    a=rtcp-fb:108 nack
    a=rtcp-fb:108 nack pli
    a=fmtp:108 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=4d0032
    a=rtpmap:109 rtx/90000
    a=fmtp:109 apt=108
    a=rtpmap:124 H264/90000
    a=rtcp-fb:124 goog-remb
    a=rtcp-fb:124 transport-cc
    a=rtcp-fb:124 ccm fir
    a=rtcp-fb:124 nack
    a=rtcp-fb:124 nack pli
    a=fmtp:124 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=640032
    a=rtpmap:120 rtx/90000
    a=fmtp:120 apt=124
    a=rtpmap:123 red/90000
    a=rtpmap:119 rtx/90000
    a=fmtp:119 apt=123
    a=rtpmap:114 ulpfec/90000
    "
    

    我使用的turn和sturn服务器是公共服务器,获得 here :

    "iceServers":[
                  {
                        urls:"stun:stun.sipgate.net:3478"
                  }, 
                  {
                        urls: 'turn:192.158.29.39:3478?transport=udp',
                        credential: 'JZEOEt2V3Qb0y27GRntt2u2PAYA=',
                        username: '28224511:1379330808'
                  },
                  {
                        urls: 'turn:192.158.29.39:3478?transport=tcp',
                        credential: 'JZEOEt2V3Qb0y27GRntt2u2PAYA=',
                        username: '28224511:1379330808'
                  }
    
    ]
    
    1 回复  |  直到 6 年前
        1
  •  2
  •   Philipp Hancke    6 年前

    https://testrtc.com/webrtc-api-trace/ 描述如何调试此类问题。然而,既然你说的是“公共转向服务器”,那么解决方案就很明显了:公共转向服务器是一个神话,没有人会为你的应用程序产生的流量买单。自己跑。

    您使用的凭据来自 https://www.html5rocks.com/en/tutorials/webrtc/infrastructure/ 于2013年9月到期。