** 我正在使用 React Native 并在我的控制台日志中收到这两个错误:
下面是我的控制台日志**
LOG rn-webrtc:pc:DEBUG 0 addTrack +3s
LOG rn-webrtc:pc:DEBUG 0 createOffer +102ms
LOG rn-webrtc:pc:DEBUG 0 createOffer +25ms
LOG rn-webrtc:pc:DEBUG 0 createOffer OK +12ms
LOG rn-webrtc:pc:DEBUG 0 setLocalDescription +4ms
LOG rn-webrtc:pc:DEBUG 0 createOffer OK +14ms
LOG rn-webrtc:pc:DEBUG 0 setLocalDescription +2ms
LOG rn-webrtc:pc:DEBUG 0 setLocalDescription OK +78ms
DEBUG socket.io-parser encoded {"type":2,"data":["student-offer",{"to":"-iRPss5JKBlxXQMbAAAB",
"offer":{"type":"offer","sdp":"v=0\r\no=- 2287403258896374185 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE 0\r\na=extmap-allow-mixed\r\na=msid-semantic: WMS bfb7f5b2-32a4-4635-bd0f-c1c3d50b7075\r\nm=audio 9 UDP/TLS/RTP/SAVPF 111 63 9 102 0 8 13 110 126\r\nc=IN IP4 0.0.0.0\r\na=rtcp:9 IN IP4 0.0.0.0\r\na=ice-ufrag:jtR8\r\na=ice-pwd:FhO9CIH5eZXks7sqSr87kc3W\r\na=ice-options:trickle renomination\r\na=fingerprint:sha-256 80:37:6C:E6:78:2E:35:3C:FB:55:A5:F2:72:E9:46:02:B5:3E:DF:4E:70:87:06:A0:81:6E:0F:73:41:5B:AE:6B\r\na=setup:actpass\r\na=mid:0\r\na=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level\r\na=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time\r\na=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01\r\na=extmap:4 urn:ietf:params:rtp-hdrext:sdes:mid\r\na=sendrecv\r\na=msid:bfb7f5b2-32a4-4635-bd0f-c1c3d50b7075 fec6b43a-c2bc-406f-b488-df44eb1f4be1\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\na=rtpmap:63 red/48000/2\r\na=fmtp:63 111/111\r\na=rtpmap:9 G722/8000\r\na=rtpmap:102 ILBC/8000\r\na=rtpmap:0 PCMU/8000\r\na=rtpmap:8 PCMA/8000\r\na=rtpmap:13 CN/8000\r\na=rtpmap:110 telephone-event/48000\r\na=rtpmap:126 telephone-event/8000\r\na=ssrc:3159182572 cname:PCDAKJXlWTgrCQw9\r\na=ssrc:3159182572 msid:bfb7f5b2-32a4-4635-bd0f-c1c3d50b7075 fec6b43a-c2bc-406f-b488-df44eb1f4be1\r\n"}}],"options":{"compress":true},"nsp":"/"} as 2["student-offer",{"to":"-iRPss5JKBlxXQMbAAAB","offer":{"type":"offer","sdp":"v=0\r\no=- 2287403258896374185 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE 0\r\na=extmap-allow-mixed\r\na=msid-semantic: WMS bfb7f5b2-32a4-4635-bd0f-c1c3d50b7075\r\nm=audio 9 UDP/TLS/RTP/SAVPF 111 63 9 102 0 8 13 110 126\r\nc=IN IP4 0.0.0.0\r\na=rtcp:9 IN IP4 0.0.0.0\r\na=ice-ufrag:jtR8\r\na=ice-pwd:FhO9CIH5eZXks7sqSr87kc3W\r\na=ice-options:trickle renomination\r\na=fingerprint:sha-256 80:37:6C:E6:78:2E:35:3C:FB:55:A5:F2:72:E9:46:02:B5:3E:DF:4E:70:87:06:A0:81:6E:0F:73:41:5B:AE:6B\r\na=setup:actpass\r\na=mid:0\r\na=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level\r\na=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time\r\na=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01\r\na=extmap:4 urn:ietf:params:rtp-hdrext:sdes:mid\r\na=sendrecv\r\na=msid:bfb7f5b2-32a4-4635-bd0f-c1c3d50b7075 fec6b43a-c2bc-406f-b488-df44eb1f4be1\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\na=rtpmap:63 red/48000/2\r\na=fmtp:63 111/111\r\na=rtpmap:9 G722/8000\r\na=rtpmap:102 ILBC/8000\r\na=rtpmap:0 PCMU/8000\r\na=rtpmap:8 PCMA/8000\r\na=rtpmap:13 CN/8000\r\na=rtpmap:110 telephone-event/48000\r\na=rtpmap:126 telephone-event/8000\r\na=ssrc:3159182572 cname:PCDAKJXlWTgrCQw9\r\na=ssrc:3159182572 msid:bfb7f5b2-32a4-4635-bd0f-c1c3d50b7075 fec6b43a-c2bc-406f-b488-df44eb1f4be1\r\n"}}] +10ms
DEBUG socket.io-client:socket emitting event ["offer-accepted",{"from":"-iRPss5JKBlxXQMbAAAB",
"ans":{"type":"answer","sdp":"v=0\r\no=- 8253650245603910748 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE 0\r\na=extmap-allow-mixed\r\na=msid-semantic: WMS e0e92938-b3e3-4fca-bfd4-3eda5eeb5325\r\nm=audio 9 UDP/TLS/RTP/SAVPF 111 63 9 102 0 8 13 110 126\r\nc=IN IP4 0.0.0.0\r\na=rtcp:9 IN IP4 0.0.0.0\r\na=ice-ufrag:3pBx\r\na=ice-pwd:dFH3SZ6F2bc9QoG8FBshIduU\r\na=ice-options:trickle renomination\r\na=fingerprint:sha-256 BC:51:3B:D6:3B:8B:E8:E6:55:CA:2D:B2:A5:5A:B1:42:3C:1D:98:F1:8E:F1:74:C7:70:49:D3:46:D2:33:2F:71\r\na=setup:active\r\na=mid:0\r\na=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level\r\na=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time\r\na=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01\r\na=extmap:4 urn:ietf:params:rtp-hdrext:sdes:mid\r\na=sendrecv\r\na=msid:e0e92938-b3e3-4fca-bfd4-3eda5eeb5325 9bf1d093-64a1-4c5e-abef-10bc4163363c\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\na=rtpmap:63 red/48000/2\r\na=fmtp:63 111/111\r\na=rtpmap:9 G722/8000\r\na=rtpmap:102 ILBC/8000\r\na=rtpmap:0 PCMU/8000\r\na=rtpmap:8 PCMA/8000\r\na=rtpmap:13 CN/8000\r\na=rtpmap:110 telephone-event/48000\r\na=rtpmap:126 telephone-event/8000\r\na=ssrc:2611272474 cname:lZEiOr+ny1FHM0pn\r\n"}}] +4s
LOG rn-webrtc:pc:DEBUG 0 setRemoteDescription +1s
LOG rn-webrtc:pc:DEBUG 0 setRemoteDescription +3ms
LOG rn-webrtc:pc:DEBUG 0 ontrack +271ms
LOG rn-webrtc:pc:DEBUG 0 setRemoteDescription OK +48ms
WARN Possible Unhandled Promise Rejection (id: 0):
Error: Failed to set local offer sdp: The order of m-lines in subsequent offer doesn't match order from previous offer/answer.
Error: Failed to set remote answer sdp: Called in wrong state: stable
这是我用来创建报价和答案的代码:-
const getAnswer = async (offer) => {
if (peer) {
const offerDescription = new RTCSessionDescription( offer );
await peer.setRemoteDescription( offerDescription );
const ans = await peer.createAnswer();
await peer.setLocalDescription( ans );
return ans;
}
}
const setLocalDescription = async (ans) => {
if (peer) {
await peer.setRemoteDescription(new RTCSessionDescription(ans));
}
}
const getOffer = async () => {
if (peer) {
const offer = await peer.createOffer(sessionConstraints);
var res = await peer.setLocalDescription(new RTCSessionDescription(offer));
return offer;
}
}