From fd23a87cfb0eb2818bbefa7116d48b5efedadb47 Mon Sep 17 00:00:00 2001 From: ziyue <1213642868@qq.com> Date: Thu, 1 Apr 2021 11:42:40 +0800 Subject: [PATCH] =?UTF-8?q?answer=20sdp=E9=80=9A=E8=BF=87chrome=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webrtc/Sdp.cpp | 3 +- webrtc/WebRtcTransport.cpp | 2 +- webrtc/answer.sdp | 42 ++++++++++--------- webrtc/janus_answer.sdp | 69 +++++++++++++++++++++++++++++++ webrtc/janus_offer.sdp | 83 ++++++++++++++++++++++++++++++++++++++ www/webrtc/ZLMRTCClient.js | 16 ++++---- 6 files changed, 185 insertions(+), 30 deletions(-) create mode 100644 webrtc/janus_answer.sdp create mode 100644 webrtc/janus_offer.sdp diff --git a/webrtc/Sdp.cpp b/webrtc/Sdp.cpp index 0230f914..ea0e8cf4 100644 --- a/webrtc/Sdp.cpp +++ b/webrtc/Sdp.cpp @@ -1176,7 +1176,7 @@ void RtcConfigure::RtcTrackConfigure::setDefaultSetting(TrackType type){ break; } case TrackApplication: { - enable = false; + enable = true; break; } default: break; @@ -1195,7 +1195,6 @@ void RtcConfigure::setDefaultSetting(string ice_ufrag, video.ice_pwd = audio.ice_pwd = application.ice_pwd = ice_pwd; video.direction = audio.direction = application.direction = direction; video.fingerprint = audio.fingerprint = application.fingerprint = fingerprint; - application.enable = false; } void RtcConfigure::addCandidate(const SdpAttrCandidate &candidate, TrackType type) { diff --git a/webrtc/WebRtcTransport.cpp b/webrtc/WebRtcTransport.cpp index 4c43f97d..439b9c28 100644 --- a/webrtc/WebRtcTransport.cpp +++ b/webrtc/WebRtcTransport.cpp @@ -104,7 +104,7 @@ std::string WebRtcTransport::getAnswerSdp(const string &offer){ throw std::invalid_argument("支持group BUNDLE模式"); } auto str = _answer_sdp->toString(); - InfoL << str; + InfoL << "\r\n" << str; return str; } diff --git a/webrtc/answer.sdp b/webrtc/answer.sdp index 82df3355..32045375 100644 --- a/webrtc/answer.sdp +++ b/webrtc/answer.sdp @@ -1,33 +1,35 @@ - v=0 -o=- 0 0 IN IP4 0.0.0.0 -s=zlmediakit_webrtc_session -i=zlmediakit_webrtc_session +v=0 +o=- 2712902958023202213 2 IN IP4 127.0.0.1 +s=- t=0 0 -c=IN IP4 0.0.0.0 -a=msid-semantic: WMS * a=group:BUNDLE 0 1 -m=audio 0 UDP/TLS/RTP/SAVPF 111 -a=mid:0 +a=msid-semantic: WMS +m=audio 9 UDP/TLS/RTP/SAVPF 111 c=IN IP4 0.0.0.0 -a=ice-ufrag:PdK3 -a=ice-pwd:PdK31zZ1sKhPU2ACzP5av37f -a=fingerprint:sha-256 D1:4F:7B:70:86:99:BE:1E:7E:B8:C7:0F:13:BC:78:C4:6A:F9:2C:F6:F3:5E:42:11:0F:1C:74:18:F6:DD:95:75 -a=setup:passive +a=rtcp:9 IN IP4 0.0.0.0 +a=ice-ufrag:68ws +a=ice-pwd:68wscAOadU4rdMwZ4Ow14M5u a=ice-options:trickle +a=fingerprint:sha-256 BF:F8:C2:35:19:2E:C3:17:44:5A:BA:DF:08:C4:65:87:AB:0C:85:B9:91:69:80:8E:55:D9:2F:EF:5C:D6:F3:A2 +a=setup:active +a=mid:0 +a=ice-lite 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 -m=video 0 UDP/TLS/RTP/SAVPF 102 121 -a=mid:1 +m=video 9 UDP/TLS/RTP/SAVPF 102 121 c=IN IP4 0.0.0.0 -a=ice-ufrag:PdK3 -a=ice-pwd:PdK31zZ1sKhPU2ACzP5av37f -a=fingerprint:sha-256 D1:4F:7B:70:86:99:BE:1E:7E:B8:C7:0F:13:BC:78:C4:6A:F9:2C:F6:F3:5E:42:11:0F:1C:74:18:F6:DD:95:75 -a=setup:passive +a=rtcp:9 IN IP4 0.0.0.0 +a=ice-ufrag:68ws +a=ice-pwd:68wscAOadU4rdMwZ4Ow14M5u a=ice-options:trickle +a=fingerprint:sha-256 BF:F8:C2:35:19:2E:C3:17:44:5A:BA:DF:08:C4:65:87:AB:0C:85:B9:91:69:80:8E:55:D9:2F:EF:5C:D6:F3:A2 +a=setup:active +a=mid:1 +a=ice-lite a=extmap:14 urn:ietf:params:rtp-hdrext:toffset a=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time a=extmap:13 urn:3gpp:video-orientation @@ -35,6 +37,7 @@ a=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extension a=extmap:12 http://www.webrtc.org/experiments/rtp-hdrext/playout-delay a=recvonly a=rtcp-mux +a=rtcp-rsize a=rtpmap:102 H264/90000 a=rtcp-fb:102 goog-remb a=rtcp-fb:102 transport-cc @@ -43,4 +46,5 @@ a=rtcp-fb:102 nack a=rtcp-fb:102 nack pli a=fmtp:102 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42001f a=rtpmap:121 rtx/90000 -a=fmtp:121 apt=102 \ No newline at end of file +a=fmtp:121 apt=102 + diff --git a/webrtc/janus_answer.sdp b/webrtc/janus_answer.sdp new file mode 100644 index 00000000..345c3de7 --- /dev/null +++ b/webrtc/janus_answer.sdp @@ -0,0 +1,69 @@ +v=0 +o=mozilla...THIS_IS_SDPARTA-87.0 5715694060540081921 0 IN IP4 0.0.0.0 +s=- +t=0 0 +a=fingerprint:sha-256 9C:9C:D9:4B:2B:82:84:95:C2:23:BC:3A:0B:BE:3B:8B:D5:6A:DA:A6:B2:F4:43:5E:C1:07:48:F8:AF:CE:FC:3D +a=group:BUNDLE video data +a=ice-options:trickle +a=msid-semantic:WMS * +m=video 9 UDP/TLS/RTP/SAVPF 120 122 121 123 126 127 97 98 +c=IN IP4 0.0.0.0 +a=sendrecv +a=extmap:3 urn:ietf:params:rtp-hdrext:sdes:mid +a=extmap:4 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time +a=extmap:5 urn:ietf:params:rtp-hdrext:toffset +a=extmap:7 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01 +a=fmtp:126 profile-level-id=42e01f;level-asymmetry-allowed=1;packetization-mode=1 +a=fmtp:97 profile-level-id=42e01f;level-asymmetry-allowed=1 +a=fmtp:120 max-fs=12288;max-fr=60 +a=fmtp:122 apt=120 +a=fmtp:121 max-fs=12288;max-fr=60 +a=fmtp:123 apt=121 +a=fmtp:127 apt=126 +a=fmtp:98 apt=97 +a=ice-pwd:518cb4fc626f82bef2ada4e9221dfb50 +a=ice-ufrag:d5484fed +a=mid:video +a=msid:{9cd17d8b-f96d-4663-866b-72ddd3b8b54b} {3dcd399d-4933-41d5-89fd-87070cfc3cf6} +a=rtcp-fb:120 nack +a=rtcp-fb:120 nack pli +a=rtcp-fb:120 ccm fir +a=rtcp-fb:120 goog-remb +a=rtcp-fb:120 transport-cc +a=rtcp-fb:121 nack +a=rtcp-fb:121 nack pli +a=rtcp-fb:121 ccm fir +a=rtcp-fb:121 goog-remb +a=rtcp-fb:121 transport-cc +a=rtcp-fb:126 nack +a=rtcp-fb:126 nack pli +a=rtcp-fb:126 ccm fir +a=rtcp-fb:126 goog-remb +a=rtcp-fb:126 transport-cc +a=rtcp-fb:97 nack +a=rtcp-fb:97 nack pli +a=rtcp-fb:97 ccm fir +a=rtcp-fb:97 goog-remb +a=rtcp-fb:97 transport-cc +a=rtcp-mux +a=rtpmap:120 VP8/90000 +a=rtpmap:122 rtx/90000 +a=rtpmap:121 VP9/90000 +a=rtpmap:123 rtx/90000 +a=rtpmap:126 H264/90000 +a=rtpmap:127 rtx/90000 +a=rtpmap:97 H264/90000 +a=rtpmap:98 rtx/90000 +a=setup:active +a=ssrc:697402393 cname:{f1ba68ef-ad59-4fff-a1f3-dbbb0cda3118} +a=ssrc:258662392 cname:{f1ba68ef-ad59-4fff-a1f3-dbbb0cda3118} +a=ssrc-group:FID 697402393 258662392 +m=application 9 UDP/DTLS/SCTP webrtc-datachannel +c=IN IP4 0.0.0.0 +a=sendrecv +a=ice-pwd:518cb4fc626f82bef2ada4e9221dfb50 +a=ice-ufrag:d5484fed +a=mid:data +a=setup:active +a=sctp-port:5000 +a=max-message-size:1073741823 diff --git a/webrtc/janus_offer.sdp b/webrtc/janus_offer.sdp new file mode 100644 index 00000000..f4f454ed --- /dev/null +++ b/webrtc/janus_offer.sdp @@ -0,0 +1,83 @@ +v=0 +o=mozilla...THIS_IS_SDPARTA-87.0 1617247876363377 1 IN IP4 23.101.8.213 +s=- +t=0 0 +a=group:BUNDLE video data +a=msid-semantic: WMS janus +a=ice-lite +a=sendrecv +m=video 9 UDP/TLS/RTP/SAVPF 120 121 126 97 122 123 127 98 +c=IN IP4 23.101.8.213 +a=sendrecv +a=mid:video +a=rtcp-mux +a=ice-ufrag:ePgh +a=ice-pwd:ZURiB67/xs69E76aOa7JDw +a=ice-options:trickle +a=fingerprint:sha-256 EF:7A:50:9C:05:8C:EF:84:4D:72:B2:74:30:BA:FD:82:76:D1:C3:FE:0C:A0:10:43:B8:6C:B2:ED:B3:F7:77:8B +a=setup:actpass +a=extmap:3 urn:ietf:params:rtp-hdrext:sdes:mid +a=extmap:4 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time +a=extmap:5 urn:ietf:params:rtp-hdrext:toffset +a=extmap:6/recvonly http://www.webrtc.org/experiments/rtp-hdrext/playout-delay +a=extmap:7 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01 +a=fmtp:126 profile-level-id=42e01f;level-asymmetry-allowed=1;packetization-mode=1 +a=fmtp:97 profile-level-id=42e01f;level-asymmetry-allowed=1 +a=fmtp:120 max-fs=12288;max-fr=60 +a=fmtp:121 max-fs=12288;max-fr=60 +a=rtcp-fb:120 nack +a=rtcp-fb:120 nack pli +a=rtcp-fb:120 ccm fir +a=rtcp-fb:120 goog-remb +a=rtcp-fb:120 transport-cc +a=rtcp-fb:121 nack +a=rtcp-fb:121 nack pli +a=rtcp-fb:121 ccm fir +a=rtcp-fb:121 goog-remb +a=rtcp-fb:121 transport-cc +a=rtcp-fb:126 nack +a=rtcp-fb:126 nack pli +a=rtcp-fb:126 ccm fir +a=rtcp-fb:126 goog-remb +a=rtcp-fb:126 transport-cc +a=rtcp-fb:97 nack +a=rtcp-fb:97 nack pli +a=rtcp-fb:97 ccm fir +a=rtcp-fb:97 goog-remb +a=rtcp-fb:97 transport-cc +a=rtpmap:120 VP8/90000 +a=rtpmap:121 VP9/90000 +a=rtpmap:126 H264/90000 +a=rtpmap:97 H264/90000 +a=rtpmap:122 rtx/90000 +a=fmtp:122 apt=120 +a=rtpmap:123 rtx/90000 +a=fmtp:123 apt=121 +a=rtpmap:127 rtx/90000 +a=fmtp:127 apt=126 +a=rtpmap:98 rtx/90000 +a=fmtp:98 apt=97 +a=ssrc-group:FID 3581519470 2258376012 +a=msid:janus janusv0 +a=ssrc:3581519470 cname:janus +a=ssrc:3581519470 msid:janus janusv0 +a=ssrc:3581519470 mslabel:janus +a=ssrc:3581519470 label:janusv0 +a=ssrc:2258376012 cname:janus +a=ssrc:2258376012 msid:janus janusv0 +a=ssrc:2258376012 mslabel:janus +a=ssrc:2258376012 label:janusv0 +a=candidate:1 1 udp 2013266431 23.101.8.213 41901 typ host +a=end-of-candidates +m=application 9 UDP/DTLS/SCTP webrtc-datachannel +c=IN IP4 23.101.8.213 +a=sendrecv +a=sctp-port:5000 +a=mid:data +a=ice-ufrag:ePgh +a=ice-pwd:ZURiB67/xs69E76aOa7JDw +a=ice-options:trickle +a=fingerprint:sha-256 EF:7A:50:9C:05:8C:EF:84:4D:72:B2:74:30:BA:FD:82:76:D1:C3:FE:0C:A0:10:43:B8:6C:B2:ED:B3:F7:77:8B +a=setup:actpass +a=candidate:1 1 udp 2013266431 23.101.8.213 41901 typ host +a=end-of-candidates diff --git a/www/webrtc/ZLMRTCClient.js b/www/webrtc/ZLMRTCClient.js index 76557c32..b1e049ab 100644 --- a/www/webrtc/ZLMRTCClient.js +++ b/www/webrtc/ZLMRTCClient.js @@ -4,7 +4,7 @@ var ZLMRTCClient = (function (exports) { const Events$1 = { WEBRTC_NOT_SUPPORT: 'WEBRTC_NOT_SUPPORT', WEBRTC_ICE_CANDIDATE_ERROR: 'WEBRTC_ICE_CANDIDATE_ERROR', - WEBRTC_OFFER_ANWSER_EXCHANGE_FAILED: 'WEBRTC_OFFER_ANWSER_EXCHANGE_FAILED', + WEBRTC_OFFER_answer_EXCHANGE_FAILED: 'WEBRTC_OFFER_answer_EXCHANGE_FAILED', WEBRTC_ON_REMOTE_STREAMS: 'WEBRTC_ON_REMOTE_STREAMS', WEBRTC_ON_LOCAL_STREAM: 'WEBRTC_ON_LOCAL_STREAM' }; @@ -7360,16 +7360,16 @@ var ZLMRTCClient = (function (exports) { let ret = response.data; if (ret.code != 0) { - // mean failed for offer/anwser exchange - this.dispatch(Events$1.WEBRTC_OFFER_ANWSER_EXCHANGE_FAILED, ret); + // mean failed for offer/answer exchange + this.dispatch(Events$1.WEBRTC_OFFER_answer_EXCHANGE_FAILED, ret); return; } - let anwser = {}; - anwser.sdp = ret.sdp; - anwser.type = 'anwser'; - log(this.TAG, 'anwser:', ret.sdp); - this.pc.setRemoteDescription(anwser).then(() => { + let answer = {}; + answer.sdp = ret.sdp; + answer.type = 'answer'; + log(this.TAG, 'answer:', ret.sdp); + this.pc.setRemoteDescription(answer).then(() => { log(this.TAG, 'set remote sucess'); }).catch(e => { error(this.TAG, e);