我正在构建基于 Janus 媒体服务器的网络聊天。当我在移动浏览器中测试并更改网络(例如禁用/启用 Wi-Fi)时,会出现此问题。
在我这样做之后,有些东西阻止了建立有效的对等连接 - 将媒体流附加到视频组件时,没有视频并且比特率为 0。此外,如果我从该移动用户发布视频,另一端的订阅者可以订阅我的流,但也会获得空的视频/音频。
我已经尝试过触发 ICE 重新协商,但没有效果。
让我丧命的是,通常人们在没有页面刷新等的情况下努力“顺利”修复对等连接。在我的情况下,页面刷新、Janus 服务器重启和后端服务器重启都无济于事。这是我不责怪内部逻辑的主要原因之一。一段时间后问题得到解决(我通常在第二天测试)。
如果我切换回初始连接类型并重新订阅 - 视频流将恢复。
我不希望在这里获得完整的解决方案,而是希望就可能导致给定症状的原因获得建议。我已经花了几个星期来解决这个问题。
这是来自管理监视器的订户句柄信息:
{
"session_id": 5720008786817209,
"session_last_activity": 6209682888251,
"session_transport": "janus.transport.http",
"handle_id": 6533528277151528,
"opaque_id": "sfutest-680291",
"loop-running": true,
"created": 6209682084107,
"current_time": 6209693977397,
"plugin": "janus.plugin.videoroom",
"plugin_specific": {
"type": "subscriber",
"room": 681365,
"private_id": 1730265710,
"feed_id": 4541903455858496,
"feed_display": "681365",
"media": {
"audio": true,
"audio-offered": true,
"video": true,
"video-offered": true,
"data": false,
"data-offered": true
},
"simulcast": {
"substream": -1,
"substream-target": 2,
"temporal-layer": -1,
"temporal-layer-target": 2
},
"hangingup": 0,
"destroyed": 0
},
"flags": {
"got-offer": true,
"got-answer": true,
"negotiated": true,
"processing-offer": false,
"starting": true,
"ice-restart": false,
"ready": true,
"stopped": false,
"alert": false,
"trickle": true,
"all-trickles": true,
"resend-trickles": false,
"trickle-synced": false,
"data-channels": false,
"has-audio": true,
"has-video": true,
"new-datachan-sdp": false,
"rfc4588-rtx": true,
"cleaning": false
},
"agent-created": 6209682284915,
"ice-mode": "full",
"ice-role": "controlling",
"sdps": {
"profile": "UDP/TLS/RTP/SAVPF",
"local": "v=0\r\no=- 1596975263019095 1 IN IP4 185.12.12.24\r\ns=VideoRoom 681365\r\nt=0 0\r\na=group:BUNDLE audio video\r\na=msid-semantic: WMS janus\r\nm=audio 9 UDP/TLS/RTP/SAVPF 111\r\nc=IN IP4 185.12.12.24\r\na=sendonly\r\na=mid:audio\r\na=rtcp-mux\r\na=ice-ufrag:sCux\r\na=ice-pwd:NK9E7vrPjeXDO2Q0DL3hIf\r\na=ice-options:trickle\r\na=fingerprint:sha-256 39:45:8D:E3:AB:4E:6D:55:63:07:16:39:14:FF:C1:8F:8C:3A:C1:32:FF:B8:2D:B5:42:C0:99:06:DB:BE:71:43\r\na=setup:actpass\r\na=rtpmap:111 opus/48000/2\r\na=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level\r\na=extmap:2 urn:ietf:params:rtp-hdrext:sdes:mid\r\na=rtcp-fb:111 transport-cc\r\na=msid:janus janusa0\r\na=ssrc:3513017309 cname:janus\r\na=ssrc:3513017309 msid:janus janusa0\r\na=ssrc:3513017309 mslabel:janus\r\na=ssrc:3513017309 label:janusa0\r\na=candidate:1 1 udp 2015363327 185.12.12.24 58146 typ host\r\na=end-of-candidates\r\nm=video 9 UDP/TLS/RTP/SAVPF 96 97\r\nc=IN IP4 185.12.12.24\r\na=sendonly\r\na=mid:video\r\na=rtcp-mux\r\na=ice-ufrag:sCux\r\na=ice-pwd:NK9E7vrPjeXDO2Q0DL3hIf\r\na=ice-options:trickle\r\na=fingerprint:sha-256 39:45:8D:E3:AB:4E:6D:55:63:07:16:39:14:FF:C1:8F:8C:3A:C1:32:FF:B8:2D:B5:42:C0:99:06:DB:BE:71:43\r\na=setup:actpass\r\na=rtpmap:96 VP8/90000\r\na=rtcp-fb:96 ccm fir\r\na=rtcp-fb:96 nack\r\na=rtcp-fb:96 nack pli\r\na=rtcp-fb:96 goog-remb\r\na=extmap:2 urn:ietf:params:rtp-hdrext:sdes:mid\r\na=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01\r\na=extmap:12 http://www.webrtc.org/experiments/rtp-hdrext/playout-delay\r\na=extmap:13 urn:3gpp:video-orientation\r\na=rtpmap:97 rtx/90000\r\na=fmtp:97 apt=96\r\na=ssrc-group:FID 163753807 2929619259\r\na=msid:janus janusv0\r\na=ssrc:163753807 cname:janus\r\na=ssrc:163753807 msid:janus janusv0\r\na=ssrc:163753807 mslabel:janus\r\na=ssrc:163753807 label:janusv0\r\na=ssrc:2929619259 cname:janus\r\na=ssrc:2929619259 msid:janus janusv0\r\na=ssrc:2929619259 mslabel:janus\r\na=ssrc:2929619259 label:janusv0\r\na=candidate:1 1 udp 2015363327 185.12.12.24 58146 typ host\r\na=end-of-candidates\r\n",
"remote": "v=0\r\no=- 2846574689702018810 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE audio video\r\na=msid-semantic: WMS\r\nm=audio 9 UDP/TLS/RTP/SAVPF 111\r\nc=IN IP4 0.0.0.0\r\na=rtcp:9 IN IP4 0.0.0.0\r\na=ice-ufrag:iTKh\r\na=ice-pwd:YcBYvuoYtPN74wLGsmRYZPkC\r\na=ice-options:trickle\r\na=fingerprint:sha-256 44:62:26:8A:9B:2C:35:82:62:07:1C:36:1B:3D:84:B0:D7:1C:A2:9D:A3:57:D0:41:E8:D6:F9:D8:9A:77:04:FE\r\na=setup:active\r\na=mid:audio\r\na=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level\r\na=extmap:2 urn:ietf:params:rtp-hdrext:sdes:mid\r\na=recvonly\r\na=rtcp-mux\r\na=rtpmap:111 opus/48000/2\r\na=rtcp-fb:111 transport-cc\r\na=fmtp:111 minptime=10;useinbandfec=1\r\nm=video 9 UDP/TLS/RTP/SAVPF 96 97\r\nc=IN IP4 0.0.0.0\r\na=rtcp:9 IN IP4 0.0.0.0\r\na=ice-ufrag:iTKh\r\na=ice-pwd:YcBYvuoYtPN74wLGsmRYZPkC\r\na=ice-options:trickle\r\na=fingerprint:sha-256 44:62:26:8A:9B:2C:35:82:62:07:1C:36:1B:3D:84:B0:D7:1C:A2:9D:A3:57:D0:41:E8:D6:F9:D8:9A:77:04:FE\r\na=setup:active\r\na=mid:video\r\na=extmap:13 urn:3gpp:video-orientation\r\na=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01\r\na=extmap:12 http://www.webrtc.org/experiments/rtp-hdrext/playout-delay\r\na=extmap:2 urn:ietf:params:rtp-hdrext:sdes:mid\r\na=recvonly\r\na=rtcp-mux\r\na=rtpmap:96 VP8/90000\r\na=rtcp-fb:96 goog-remb\r\na=rtcp-fb:96 ccm fir\r\na=rtcp-fb:96 nack\r\na=rtcp-fb:96 nack pli\r\na=rtpmap:97 rtx/90000\r\na=fmtp:97 apt=96\r\n"
},
"queued-packets": 0,
"streams": [
{
"id": 1,
"ready": -1,
"ssrc": {
"audio": 3513017309,
"video": 163753807,
"video-rtx": 2929619259
},
"direction": {
"audio-send": true,
"audio-recv": false,
"video-send": true,
"video-recv": false
},
"extensions": {
"urn:ietf:params:rtp-hdrext:sdes:mid": 2,
"http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01": 3,
"urn:ietf:params:rtp-hdrext:ssrc-audio-level": 1,
"urn:3gpp:video-orientation": 13
},
"bwe": {
"twcc": true,
"twcc-ext-id": 3
},
"nack-queue-ms": 200,
"rtcp_stats": {
"audio": {
"base": 48000,
"rtt": 0,
"lost": 0,
"lost-by-remote": 0,
"jitter-local": 0,
"jitter-remote": 0,
"in-link-quality": 0,
"in-media-link-quality": 0,
"out-link-quality": 0,
"out-media-link-quality": 0
},
"video": {
"base": 90000,
"rtt": 0,
"lost": 0,
"lost-by-remote": 0,
"jitter-local": 0,
"jitter-remote": 0,
"in-link-quality": 0,
"in-media-link-quality": 0,
"out-link-quality": 0,
"out-media-link-quality": 0
}
},
"components": [
{
"id": 1,
"state": "ready",
"connected": 6209682688321,
"local-candidates": [
"1 1 udp 2015363327 185.12.12.24 58146 typ host"
],
"remote-candidates": [
"remote1 1 udp 1853759231 188.26.223.217 59505 typ prflx raddr 188.26.223.217 rport 59505\r\n",
"1287214573 1 udp 2122194687 192.168.1.131 59505 typ host generation 0 ufrag iTKh network-id 1 network-cost 10",
"4213993584 1 udp 2122262783 2a0c:5a80:190e:2b00:6d56:6bd7:468e:1b1b 53024 typ host generation 0 ufrag iTKh network-id 2 network-cost 10"
],
"selected-pair": "185.12.12.24:58146 [host,udp] <-> 188.26.223.217:59505 [prflx,udp]",
"dtls": {
"fingerprint": "39:45:8D:E3:AB:4E:6D:55:63:07:16:39:14:FF:C1:8F:8C:3A:C1:32:FF:B8:2D:B5:42:C0:99:06:DB:BE:71:43",
"remote-fingerprint": "44:62:26:8A:9B:2C:35:82:62:07:1C:36:1B:3D:84:B0:D7:1C:A2:9D:A3:57:D0:41:E8:D6:F9:D8:9A:77:04:FE",
"remote-fingerprint-hash": "sha-256",
"dtls-role": "passive",
"dtls-state": "connected",
"retransmissions": 0,
"valid": true,
"srtp-profile": "SRTP_AEAD_AES_256_GCM",
"ready": true,
"handshake-started": 6209682688345,
"connected": 6209682837110,
"sctp-association": false
},
"in_stats": {
"audio_packets": 0,
"audio_bytes": 0,
"audio_bytes_lastsec": 0,
"do_audio_nacks": false,
"video_packets": 0,
"video_bytes": 0,
"video_bytes_lastsec": 0,
"do_video_nacks": true,
"video_nacks": 0,
"video_retransmissions": 0,
"data_packets": 4,
"data_bytes": 1056
},
"out_stats": {
"audio_packets": 0,
"audio_bytes": 0,
"audio_bytes_lastsec": 0,
"audio_nacks": 0,
"video_packets": 0,
"video_bytes": 0,
"video_bytes_lastsec": 0,
"video_nacks": 0,
"data_packets": 2,
"data_bytes": 1259
}
}
]
}
]
}