如何使用冰候选者处理sdp报价并产生合适的响应

时间:2016-08-10 11:06:20

标签: webrtc kurento

我正在尝试为sdp商品生成sdp答案。我也在使用ICE,但冰候选人正在与sdp报价一起发送。

如何生成适当的sdp答案以及这些冰候选对的响应。

以下是我接受的sdp优惠:

v=0
o=root 1557075227 1557075227 IN IP4 172.24.9.236
s=***********
c=IN IP4 172.24.9.236
t=0 0
m=audio 19376 RTP/AVP 0 8 3 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:3 GSM/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=maxptime:150
a=ice-ufrag:37bcc460577fe3dc590be4916da2574e
a=ice-pwd:39bc5db21294c65840c4442943921476
a=candidate:Hac1809ec 1 UDP 2130706431 172.24.9.236 19376 typ host
a=candidate:S31f8f89e 1 UDP 1694498815 **.***.***.158 19376 typ srflx raddr 172.24.9.236 rport 19376
a=candidate:Hac1809ec 2 UDP 2130706430 172.24.9.236 19377 typ host
a=candidate:S31f8f89e 2 UDP 1694498814 **.***.***.158 19377 typ srflx raddr 172.24.9.236 rport 19377
a=sendrecv

以下是webrtcendpoint.processSdpOffer()生成的sdpanswer:

v=0
o=- 3679812671 3679812671 IN IP4 0.0.0.0
s=Kurento Media Server
c=IN IP4 0.0.0.0
t=0 0
m=audio 0 RTP/AVP 0 8 3 101
a=inactive
a=ssrc:1635381884 cname:user1999328188@host-4a845cab
a=ice-ufrag:MdZD
a=ice-pwd:+ZxngOqy+6x1MM+0lI+CGD
a=fingerprint:sha-256 02:B7:04:92:F3:69:72:2C:15:E0:D5:FE:CE:20:63:75:B3:FD:77:DC:6E:88:FB:64:7B:B7:A6:DF:BE:A7:E7:DD
a=mid:audio0

在处理优惠之前/之后对 gatherCandidates()的调用没有任何区别。 我无法为音频呼叫建立媒体流。我想原因是冰协商没有完成。我哪里错了。

1 个答案:

答案 0 :(得分:0)

生成答案后,您可能需要设置localDescription

例如,在JavaScript中,可以执行以下操作:

var sdp = " ... "; // This is the SDP

remoterequest = new RTCSessionDescription({"type": "offer", "sdp": sdp});

peer.setRemoteDescription (remoterequest);

peer.createAnswer((sessionDesc) => {
   peer.setLocalDescription(sessionDesc);
}, (err) => { 
   console.log (err); 
}, {} );

看起来你有一个" SDP答案"但是,一旦你生成了localDescription,你是否将答案设置为init