WebRTC:在SDP中没有捆绑线路的音频通话中添加视频

WebRTC: Adding Video To Audio Call With No BUNDLE Lines in SDP

本文关键字:音频 视频 添加 线路 SDP WebRTC      更新时间:2023-09-26

我希望你们中的一位WebRTC专家能够指出我正确的方向,或者告诉我我正在尝试做的事情在当前的Chrome浏览器中是否可行/受支持,或者即使Chrome将来会支持这个用例。

我已经搜索了一个答案并在我的代码中尝试了很多东西,但我无法让以下内容工作:

我正在尝试进行呼叫升级(将视频添加到现有的仅音频呼叫中),而无需SDP中的捆绑线路。我的网络不支持端口捆绑,因此我需要音频和视频端口不同的 SDP。我想指出,如果我删除捆绑行(保留默认 SDP),我可以让它工作。

用例:

  1. 在用户 A 和用户 B 之间设置初始视频通话
  2. 用户 A 执行呼叫降级(通过将视频端口设置为 0 来删除视频)
  3. 用户 A 执行呼叫升级(使用新getUserMedia再次添加视频)
  4. 用户 B 接受呼叫升级(使用新getUserMedia再次添加视频)

注意:在执行任何_pc.setLocalDescription之前,我以这种方式从SDP中删除捆绑行:

sessionDescription.sdp = sessionDescription.sdp.replace(/a=group:BUNDLE audio'r'n/g, "");
sessionDescription.sdp = sessionDescription.sdp.replace(/a=group:BUNDLE audio video'r'n/g, "");

这确实有效,因为我在"m=音频"和"m=视频"上获得了不同的端口,这是预期的行为。

您可以使用此客户端复制行为(只需按照步骤操作并查看控制台日志以获取最后一步):

http://webrtc.utopicum.com/

结果:

我无法执行升级,步骤 4 失败!!

基本上,如果调用对"m

=audio"和"m=video"线路使用相同的端口,浏览器只能连续多次成功执行升级。如果端口不同,则从降级呼叫传递到再次视频呼叫不起作用。

以下是我用于执行升级的详细步骤:

  1. webkitGetUserMedia({audio: true, video: true}, function(stream)...
  2. 删除现有流_pc.removeStream(localStream)
  3. 添加新的流_pc.addStream(stream)
  4. 创建新的产品/服务_pc.createOffer
  5. 删除捆绑线
  6. setLocalSDP _pc.setLocalDescription
  7. 获取 IC 候选人
  8. 向远程对等方发送报价

这些是我用来执行降级的详细步骤:

  1. 创建新产品/_pc.创建具有约束的报价"OfferToReceiveVideo"设置为 false
  2. 删除捆绑线
  3. 将视频端口设置为 0(另外,请确保我们处于"sendrecv"模式)
  4. setLocalSDP _pc.setLocalDescription
  5. 向远程对等方发送报价

在 LOGS 中,我可以看到我的用例第 4 步的 SDP 缺少 ice-ufrag 和 ice-pwd,并且视频端口设置为 1...

请参阅升级优惠:

v=0
o=- 4834140171951113916 5 IN IP4 127.0.0.1
s=-
t=0 0
a=msid-semantic: WMS z4nWgYpFsPw6UThtfe5tJOwKwfD3WTEl39Dt
m=audio 52158 RTP/SAVPF 111 103 104 0 8 126
c=IN IP4 125.113.122.55
a=rtcp:52159 IN IP4 142.133.123.33
a=candidate:437151159 1 udp 2122260223 142.133.123.33 52158 typ host generation 0
a=candidate:437151159 2 udp 2122260222 142.133.123.33 52159 typ host generation 0
a=candidate:1418565959 1 tcp 1518280447 142.133.123.33 0 typ host tcptype active generation 0
a=candidate:1418565959 2 tcp 1518280446 142.133.123.33 0 typ host tcptype active generation 0
a=ice-ufrag:yTCE4QuOaRby5yJd
a=ice-pwd:KKHBT1dd/0NoScpt8Iiix8ub
a=ice-options:google-ice
a=fingerprint:sha-256 F3:E1:6D:88:FD:B7:DA:55:BB:C8:10:DC:9C:12:C2:9E:C4:E7:49:03:88:C4:7A:10:D1:EA:DA:62:30:85:83:45
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=sendrecv
a=rtcp-mux
a=rtpmap:111 opus/48000/2
a=fmtp:111 minptime=10
a=rtpmap:103 ISAC/16000
a=rtpmap:104 ISAC/32000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:126 telephone-event/8000
a=maxptime:60
a=ssrc:2250182501 cname:GVPQmpDpIZXlFcBr
a=ssrc:2250182501 msid:z4nWgYpFsPw6UThtfe5tJOwKwfD3WTEl39Dt 4ef7d31c-eae4-4314-9732-6a100b53e42e
a=ssrc:2250182501 mslabel:z4nWgYpFsPw6UThtfe5tJOwKwfD3WTEl39Dt
a=ssrc:2250182501 label:4ef7d31c-eae4-4314-9732-6a100b53e42e
m=video 52169 RTP/SAVPF 100 116 117 96
c=IN IP4 125.113.122.55
a=rtcp:52170 IN IP4 142.133.123.33
a=candidate:437151159 1 udp 2122260223 142.133.123.33 52169 typ host generation 0
a=candidate:437151159 2 udp 2122260222 142.133.123.33 52170 typ host generation 0
a=candidate:1418565959 1 tcp 1518280447 142.133.123.33 0 typ host tcptype active generation 0
a=candidate:1418565959 2 tcp 1518280446 142.133.123.33 0 typ host tcptype active generation 0
a=candidate:437151159 1 udp 2122260223 142.133.123.33 61801 typ host generation 0
a=candidate:437151159 2 udp 2122260222 142.133.123.33 61802 typ host generation 0
a=candidate:1418565959 1 tcp 1518280447 142.133.123.33 0 typ host tcptype active generation 0
a=candidate:1418565959 2 tcp 1518280446 142.133.123.33 0 typ host tcptype active generation 0
a=ice-ufrag:yTCE4QuOaRby5yJd
a=ice-pwd:KKHBT1dd/0NoScpt8Iiix8ub
a=ice-options:google-ice
a=fingerprint:sha-256 F3:E1:6D:88:FD:B7:DA:55:BB:C8:10:DC:9C:12:C2:9E:C4:E7:49:03:88:C4:7A:10:D1:EA:DA:62:30:85:83:45
a=setup:actpass
a=mid:video
a=extmap:2 urn:ietf:params:rtp-hdrext:toffset
a=extmap:14 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
a=sendrecv
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
a=ssrc-group:FID 454679926 4043911517
a=ssrc:454679926 cname:GVPQmpDpIZXlFcBr
a=ssrc:454679926 msid:z4nWgYpFsPw6UThtfe5tJOwKwfD3WTEl39Dt 09c6faeb-b226-49b0-9ce4-40378af9558e
a=ssrc:454679926 mslabel:z4nWgYpFsPw6UThtfe5tJOwKwfD3WTEl39Dt
a=ssrc:454679926 label:09c6faeb-b226-49b0-9ce4-40378af9558e
a=ssrc:4043911517 cname:GVPQmpDpIZXlFcBr
a=ssrc:4043911517 msid:z4nWgYpFsPw6UThtfe5tJOwKwfD3WTEl39Dt 09c6faeb-b226-49b0-9ce4-40378af9558e
a=ssrc:4043911517 mslabel:z4nWgYpFsPw6UThtfe5tJOwKwfD3WTEl39Dt
a=ssrc:4043911517 label:09c6faeb-b226-49b0-9ce4-40378af9558e

请参阅浏览器答案:

m=video 1 RTP/SAVPF 100 116 117 96
c=IN IP4 0.0.0.0
a=rtcp:1 IN IP4 0.0.0.0
a=ice-ufrag:
a=ice-pwd:
v=0
o=- 6057878882910049263 5 IN IP4 127.0.0.1
s=-
t=0 0
a=msid-semantic: WMS z5IdhGE6udWLNtZ5j1De4o0cKSTc2H4wo3U1
m=audio 52163 RTP/SAVPF 111 103 104 0 8 126
c=IN IP4 125.113.122.55
a=rtcp:1 IN IP4 0.0.0.0
a=candidate:437151159 1 udp 2122260223 142.133.123.33 52163 typ host generation 0
a=candidate:1418565959 1 tcp 1518280447 142.133.123.33 0 typ host tcptype active generation 0
a=ice-ufrag:FjQgNw/qg0UA36ZH
a=ice-pwd:kHYooqwEWmTn7Pco1mh4Af+E
a=fingerprint:sha-256 F3:E1:6D:88:FD:B7:DA:55:BB:C8:10:DC:9C:12:C2:9E:C4:E7:49:03:88:C4:7A:10:D1:EA:DA:62:30:85:83:45
a=setup:active
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=sendrecv
a=rtcp-mux
a=rtpmap:111 opus/48000/2
a=fmtp:111 minptime=10
a=rtpmap:103 ISAC/16000
a=rtpmap:104 ISAC/32000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:126 telephone-event/8000
a=maxptime:60
a=ssrc:2432452571 cname:jbVMZw57KYOje031
a=ssrc:2432452571 msid:z5IdhGE6udWLNtZ5j1De4o0cKSTc2H4wo3U1 147c3eaf-87cc-457f-bf9c-1610deff30b4
a=ssrc:2432452571 mslabel:z5IdhGE6udWLNtZ5j1De4o0cKSTc2H4wo3U1
a=ssrc:2432452571 label:147c3eaf-87cc-457f-bf9c-1610deff30b4
m=video 1 RTP/SAVPF 100 116 117 96
c=IN IP4 0.0.0.0
a=rtcp:1 IN IP4 0.0.0.0
a=ice-ufrag:
a=ice-pwd:
a=fingerprint:sha-256 F3:E1:6D:88:FD:B7:DA:55:BB:C8:10:DC:9C:12:C2:9E:C4:E7:49:03:88:C4:7A:10:D1:EA:DA:62:30:85:83:45
a=setup:active
a=mid:video
a=extmap:2 urn:ietf:params:rtp-hdrext:toffset
a=extmap:14 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
a=sendrecv
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
a=ssrc-group:FID 3620434458 3089122764
a=ssrc:3620434458 cname:jbVMZw57KYOje031
a=ssrc:3620434458 msid:z5IdhGE6udWLNtZ5j1De4o0cKSTc2H4wo3U1 acb064af-1bc3-4d0e-80fe-9ed251bbc8ca
a=ssrc:3620434458 mslabel:z5IdhGE6udWLNtZ5j1De4o0cKSTc2H4wo3U1
a=ssrc:3620434458 label:acb064af-1bc3-4d0e-80fe-9ed251bbc8ca
a=ssrc:3089122764 cname:jbVMZw57KYOje031
a=ssrc:3089122764 msid:z5IdhGE6udWLNtZ5j1De4o0cKSTc2H4wo3U1 acb064af-1bc3-4d0e-80fe-9ed251bbc8ca
a=ssrc:3089122764 mslabel:z5IdhGE6udWLNtZ5j1De4o0cKSTc2H4wo3U1
a=ssrc:3089122764 label:acb064af-1bc3-4d0e-80fe-9ed251bbc8ca

WebRTC -> 无法设置会话描述: 无法设置本地答案 sdp: 使用 SDP 调用,没有 ice-ufrag 和 ice-pwd。

任何帮助将不胜感激!!

提前感谢!

我在webRTC讨论组中讨论了这个问题,并确定这个问题应该作为Chrome中的TR提出。

这是问题所在:

https://code.google.com/p/webrtc/issues/detail?id=4260