From 5daf52cafd859adb47c726a3437bf055338ed4fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=8F=E6=A5=9A?= <771730766@qq.com> Date: Wed, 24 Nov 2021 20:14:29 +0800 Subject: [PATCH 01/13] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=90=88=E4=BD=9C?= =?UTF-8?q?=E9=A1=B9=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4e79e725..0c46d8c5 100644 --- a/README.md +++ b/README.md @@ -164,8 +164,9 @@ bash build_docker_images.sh - [DotNetCore的RESTful客户端](https://github.com/MingZhuLiu/ZLMediaKit.DotNetCore.Sdk) - 播放器 + - [基于wasm支持H265的播放器](https://github.com/numberwolf/h265web.js) - [基于MSE的websocket-fmp4播放器](https://github.com/v354412101/wsPlayer) - + ## 授权协议 本项目自有代码使用宽松的MIT协议,在保留版权信息的情况下可以自由应用于各自商用、非商业的项目。 From c1b78629e13239688c2d1733724beadf3dcc0e5c Mon Sep 17 00:00:00 2001 From: xiongguangjie Date: Thu, 25 Nov 2021 20:42:51 +0800 Subject: [PATCH 02/13] fix rtc play signal stream only audio or video failed (#1239) --- webrtc/Sdp.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/webrtc/Sdp.cpp b/webrtc/Sdp.cpp index 0831a1cf..82f28acf 100644 --- a/webrtc/Sdp.cpp +++ b/webrtc/Sdp.cpp @@ -1737,16 +1737,21 @@ RETRY: void RtcConfigure::setPlayRtspInfo(const string &sdp){ RtcSession session; + video.direction = RtpDirection::inactive; + audio.direction = RtpDirection::inactive; + session.loadFrom(sdp); for (auto &m : session.media) { switch (m.type) { case TrackVideo : { + video.direction = RtpDirection::sendonly; _rtsp_video_plan = std::make_shared(m.plan[0]); video.preferred_codec.clear(); video.preferred_codec.emplace_back(getCodecId(_rtsp_video_plan->codec)); break; } case TrackAudio : { + audio.direction = RtpDirection::sendonly; _rtsp_audio_plan = std::make_shared(m.plan[0]); audio.preferred_codec.clear(); audio.preferred_codec.emplace_back(getCodecId(_rtsp_audio_plan->codec)); From 90315ebce5e49855423e1108da81c7a7a8cfbf46 Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Sat, 27 Nov 2021 21:30:46 +0800 Subject: [PATCH 03/13] =?UTF-8?q?RTC:=20srtp=E5=8F=91=E9=80=81=E5=87=8F?= =?UTF-8?q?=E5=B0=91=E4=B8=80=E6=AC=A1=E5=86=85=E5=AD=98=E6=8B=B7=E8=B4=9D?= =?UTF-8?q?=EF=BC=8C=E6=8F=90=E9=AB=98webrtc=E5=8F=91=E9=80=81=E6=80=A7?= =?UTF-8?q?=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webrtc/WebRtcTransport.cpp | 49 ++++++++++++++++++++------------------ webrtc/WebRtcTransport.h | 11 ++++----- 2 files changed, 31 insertions(+), 29 deletions(-) diff --git a/webrtc/WebRtcTransport.cpp b/webrtc/WebRtcTransport.cpp index 2f396374..738cd53b 100644 --- a/webrtc/WebRtcTransport.cpp +++ b/webrtc/WebRtcTransport.cpp @@ -46,6 +46,7 @@ static onceToken token([]() { WebRtcTransport::WebRtcTransport(const EventPoller::Ptr &poller) { _poller = poller; _identifier = to_string(reinterpret_cast(this)); + _packet_pool.setSize(64); } void WebRtcTransport::onCreate(){ @@ -69,7 +70,7 @@ const string &WebRtcTransport::getIdentifier() const { ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void WebRtcTransport::OnIceServerSendStunPacket(const RTC::IceServer *iceServer, const RTC::StunPacket *packet, RTC::TransportTuple *tuple) { - onSendSockData((char *) packet->GetData(), packet->GetSize(), (struct sockaddr_in *) tuple); + sendSockData((char *) packet->GetData(), packet->GetSize(), tuple); } void WebRtcTransport::OnIceServerSelectedTuple(const RTC::IceServer *iceServer, RTC::TransportTuple *tuple) { @@ -110,7 +111,7 @@ void WebRtcTransport::OnDtlsTransportConnected( } void WebRtcTransport::OnDtlsTransportSendData(const RTC::DtlsTransport *dtlsTransport, const uint8_t *data, size_t len) { - onSendSockData((char *)data, len); + sendSockData((char *)data, len, nullptr); } void WebRtcTransport::OnDtlsTransportConnecting(const RTC::DtlsTransport *dtlsTransport) { @@ -132,10 +133,10 @@ void WebRtcTransport::OnDtlsTransportApplicationDataReceived(const RTC::DtlsTran } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -void WebRtcTransport::onSendSockData(const char *buf, size_t len, bool flush){ - auto tuple = _ice_server->GetSelectedTuple(); - assert(tuple); - onSendSockData(buf, len, (struct sockaddr_in *) tuple, flush); +void WebRtcTransport::sendSockData(const char *buf, size_t len, RTC::TransportTuple *tuple){ + auto pkt = _packet_pool.obtain(); + pkt->assign(buf, len); + onSendSockData(std::move(pkt), true, tuple ? tuple : _ice_server->GetSelectedTuple()); } RTC::TransportTuple* WebRtcTransport::getSelectedTuple() const{ @@ -266,23 +267,28 @@ void WebRtcTransport::inputSockData(char *buf, int len, RTC::TransportTuple *tup void WebRtcTransport::sendRtpPacket(const char *buf, int len, bool flush, void *ctx) { if (_srtp_session_send) { + auto pkt = _packet_pool.obtain(); //预留rtx加入的两个字节 - CHECK((size_t)len + SRTP_MAX_TRAILER_LEN + 2 <= sizeof(_srtp_buf)); - memcpy(_srtp_buf, buf, len); - onBeforeEncryptRtp((char *) _srtp_buf, len, ctx); - if (_srtp_session_send->EncryptRtp(_srtp_buf, &len)) { - onSendSockData((char *) _srtp_buf, len, flush); + pkt->setCapacity((size_t) len + SRTP_MAX_TRAILER_LEN + 2); + pkt->assign(buf, len); + onBeforeEncryptRtp(pkt->data(), len, ctx); + if (_srtp_session_send->EncryptRtp(reinterpret_cast(pkt->data()), &len)) { + pkt->setSize(len); + onSendSockData(std::move(pkt), flush); } } } -void WebRtcTransport::sendRtcpPacket(const char *buf, int len, bool flush, void *ctx){ +void WebRtcTransport::sendRtcpPacket(const char *buf, int len, bool flush, void *ctx) { if (_srtp_session_send) { - CHECK((size_t)len + SRTP_MAX_TRAILER_LEN <= sizeof(_srtp_buf)); - memcpy(_srtp_buf, buf, len); - onBeforeEncryptRtcp((char *) _srtp_buf, len, ctx); - if (_srtp_session_send->EncryptRtcp(_srtp_buf, &len)) { - onSendSockData((char *) _srtp_buf, len, flush); + auto pkt = _packet_pool.obtain(); + //预留rtx加入的两个字节 + pkt->setCapacity((size_t) len + SRTP_MAX_TRAILER_LEN + 2); + pkt->assign(buf, len); + onBeforeEncryptRtcp(pkt->data(), len, ctx); + if (_srtp_session_send->EncryptRtcp(reinterpret_cast(pkt->data()), &len)) { + pkt->setSize(len); + onSendSockData(std::move(pkt), flush); } } } @@ -313,7 +319,6 @@ void WebRtcTransportImp::onCreate(){ WebRtcTransportImp::WebRtcTransportImp(const EventPoller::Ptr &poller) : WebRtcTransport(poller) { InfoL << getIdentifier(); - _packet_pool.setSize(64); } WebRtcTransportImp::~WebRtcTransportImp() { @@ -325,16 +330,14 @@ void WebRtcTransportImp::onDestory() { unregisterSelf(); } -void WebRtcTransportImp::onSendSockData(const char *buf, size_t len, struct sockaddr_in *dst, bool flush) { +void WebRtcTransportImp::onSendSockData(Buffer::Ptr buf, bool flush, RTC::TransportTuple *tuple) { if (!_session) { - WarnL << "send data failed:" << len; + WarnL << "send data failed:" << buf->size(); return; } - auto ptr = _packet_pool.obtain(); - ptr->assign(buf, len); //一次性发送一帧的rtp数据,提高网络io性能 _session->setSendFlushFlag(flush); - _session->send(std::move(ptr)); + _session->send(std::move(buf)); } /////////////////////////////////////////////////////////////////// diff --git a/webrtc/WebRtcTransport.h b/webrtc/WebRtcTransport.h index 2879944a..d557b710 100644 --- a/webrtc/WebRtcTransport.h +++ b/webrtc/WebRtcTransport.h @@ -135,7 +135,7 @@ protected: virtual void onStartWebRTC() = 0; virtual void onRtcConfigure(RtcConfigure &configure) const; virtual void onCheckSdp(SdpType type, RtcSession &sdp) = 0; - virtual void onSendSockData(const char *buf, size_t len, struct sockaddr_in *dst, bool flush = true) = 0; + virtual void onSendSockData(Buffer::Ptr buf, bool flush = true, RTC::TransportTuple *tuple = nullptr) = 0; virtual void onRtp(const char *buf, size_t len, uint64_t stamp_ms) = 0; virtual void onRtcp(const char *buf, size_t len) = 0; @@ -149,7 +149,7 @@ protected: void sendRtcpPli(uint32_t ssrc); private: - void onSendSockData(const char *buf, size_t len, bool flush = true); + void sendSockData(const char *buf, size_t len, RTC::TransportTuple *tuple); void setRemoteDtlsFingerprint(const RtcSession &remote); protected: @@ -157,7 +157,6 @@ protected: RtcSession::Ptr _answer_sdp; private: - uint8_t _srtp_buf[2000]; string _identifier; EventPoller::Ptr _poller; std::shared_ptr _ice_server; @@ -165,6 +164,8 @@ private: std::shared_ptr _srtp_session_send; std::shared_ptr _srtp_session_recv; Ticker _ticker; + //循环池 + ResourcePool _packet_pool; }; class RtpChannel; @@ -232,7 +233,7 @@ public: protected: WebRtcTransportImp(const EventPoller::Ptr &poller); void onStartWebRTC() override; - void onSendSockData(const char *buf, size_t len, struct sockaddr_in *dst, bool flush = true) override; + void onSendSockData(Buffer::Ptr buf, bool flush = true, RTC::TransportTuple *tuple = nullptr) override; void onCheckSdp(SdpType type, RtcSession &sdp) override; void onRtcConfigure(RtcConfigure &configure) const override; @@ -279,8 +280,6 @@ private: unordered_map _ssrc_to_track; //根据接收rtp的pt获取相关信息 unordered_map> _pt_to_track; - //循环池 - ResourcePool _packet_pool; }; class WebRtcTransportManager { From 8a1f9793759898b958a6d5390af74dbd7a0578c7 Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Sat, 27 Nov 2021 22:20:22 +0800 Subject: [PATCH 04/13] =?UTF-8?q?RTC:=20=E4=BF=AE=E5=A4=8Dtwcc=20rtp=20ext?= =?UTF-8?q?=20seq=E5=9B=9E=E9=80=80=E5=A4=84=E7=90=86=E9=80=BB=E8=BE=91bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webrtc/TwccContext.cpp | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/webrtc/TwccContext.cpp b/webrtc/TwccContext.cpp index 6a3bfbd6..ed565186 100644 --- a/webrtc/TwccContext.cpp +++ b/webrtc/TwccContext.cpp @@ -21,7 +21,7 @@ enum class ExtSeqStatus : int { void TwccContext::onRtp(uint32_t ssrc, uint16_t twcc_ext_seq, uint64_t stamp_ms) { switch ((ExtSeqStatus) checkSeqStatus(twcc_ext_seq)) { - case ExtSeqStatus::jumped: /*回环后,收到回环前的大ext seq包,过滤掉*/ return; + case ExtSeqStatus::jumped: /*seq异常,过滤掉*/ return; case ExtSeqStatus::looped: /*回环,触发发送twcc rtcp*/ onSendTwcc(ssrc); break; case ExtSeqStatus::normal: break; default: /*不可达*/assert(0); break; @@ -56,16 +56,29 @@ int TwccContext::checkSeqStatus(uint16_t twcc_ext_seq) const { return (int) ExtSeqStatus::normal; } auto max = _rtp_recv_status.rbegin()->first; - if (max > 0xFF00 && twcc_ext_seq < 0xFF) { - //发生回环了 + auto delta = (int32_t) twcc_ext_seq - (int32_t) max; + if (delta > 0 && delta < 0xFFFF / 2) { + //正常增长 + return (int) ExtSeqStatus::normal; + } + if (delta < -0xFF00) { + //回环 TraceL << "rtp twcc ext seq looped:" << max << " -> " << twcc_ext_seq; return (int) ExtSeqStatus::looped; } - if (twcc_ext_seq - max > 0xFFFF / 2) { - TraceL << "rtp twcc ext seq jumped:" << max << " -> " << twcc_ext_seq; + if (delta > 0xFF00) { + //回环后收到前面大的乱序的包,无法处理,丢弃 + TraceL << "rtp twcc ext seq jumped after looped:" << max << " -> " << twcc_ext_seq; return (int) ExtSeqStatus::jumped; } - return (int) ExtSeqStatus::normal; + auto min = _rtp_recv_status.begin()->first; + if (min <= twcc_ext_seq || twcc_ext_seq <= max) { + //正常回退 + return (int) ExtSeqStatus::normal; + } + //seq莫名的大幅增加或减少,无法处理,丢弃 + TraceL << "rtp twcc ext seq jumped:" << max << " -> " << twcc_ext_seq; + return (int) ExtSeqStatus::jumped; } void TwccContext::onSendTwcc(uint32_t ssrc) { From bc4453015f681aa7fe34fed05e602218fc4d4fad Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Sat, 27 Nov 2021 22:37:15 +0800 Subject: [PATCH 05/13] =?UTF-8?q?RTC:=20=E9=99=8D=E4=BD=8Ertx=E9=87=8D?= =?UTF-8?q?=E4=BC=A0=E6=97=A5=E5=BF=97=E4=BC=98=E5=85=88=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webrtc/WebRtcTransport.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/webrtc/WebRtcTransport.cpp b/webrtc/WebRtcTransport.cpp index 738cd53b..7d10b06f 100644 --- a/webrtc/WebRtcTransport.cpp +++ b/webrtc/WebRtcTransport.cpp @@ -810,7 +810,8 @@ void WebRtcTransportImp::onSendRtp(const RtpPacket::Ptr &rtp, bool flush, bool r } #endif } else { - WarnL << "send rtx rtp:" << rtp->getSeq(); + //发送rtx重传包 + TraceL << "send rtx rtp:" << rtp->getSeq(); } pair ctx{rtx, track.get()}; sendRtpPacket(rtp->data() + RtpPacket::kRtpTcpHeaderSize, rtp->size() - RtpPacket::kRtpTcpHeaderSize, flush, &ctx); From 01dbf8fdf225d76ac77dcffa72e8c1d996741044 Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Sun, 28 Nov 2021 20:44:19 +0800 Subject: [PATCH 06/13] =?UTF-8?q?Bugfix:=20=E6=9B=B4=E6=96=B0ZLToolKit?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E5=A4=8D=E5=A4=9A=E7=BA=BF=E7=A8=8B=E6=83=85?= =?UTF-8?q?=E5=86=B5=E5=A4=9A=E6=AC=A1=E9=87=8D=E5=A4=8D=E5=88=9B=E5=BB=BA?= =?UTF-8?q?UdpSession=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 3rdpart/ZLToolKit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/3rdpart/ZLToolKit b/3rdpart/ZLToolKit index 28c3d20c..32361898 160000 --- a/3rdpart/ZLToolKit +++ b/3rdpart/ZLToolKit @@ -1 +1 @@ -Subproject commit 28c3d20c3a94b6e72bcd2d4e7057d28b8215594a +Subproject commit 323618980315228e46a68204c88c482c150aab82 From 8b24088ab1883662ab1b048d6568f9b6d45d65dd Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Sun, 28 Nov 2021 21:15:03 +0800 Subject: [PATCH 07/13] =?UTF-8?q?Refine:=20h264=20rtp=20encoder=E4=B8=8D?= =?UTF-8?q?=E5=86=8D=E8=BF=87=E6=BB=A4sei=E3=80=81aud=E5=B8=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Extension/H264Rtp.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/Extension/H264Rtp.cpp b/src/Extension/H264Rtp.cpp index 143d3a94..e28cfa3d 100644 --- a/src/Extension/H264Rtp.cpp +++ b/src/Extension/H264Rtp.cpp @@ -268,10 +268,6 @@ void H264RtpEncoder::packRtpStapA(const char *ptr, size_t len, uint32_t pts, boo bool H264RtpEncoder::inputFrame(const Frame::Ptr &frame) { auto ptr = frame->data() + frame->prefixSize(); switch (H264_TYPE(ptr[0])) { - case H264Frame::NAL_AUD: - case H264Frame::NAL_SEI : { - return false; - } case H264Frame::NAL_SPS: { _sps = Frame::getCacheAbleFrame(frame); return true; From 341700fa5bcdb96365b667b961e5eaccb3873f89 Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Sun, 28 Nov 2021 21:18:09 +0800 Subject: [PATCH 08/13] =?UTF-8?q?Refine:=20main=E7=BA=BF=E7=A8=8B=E4=B8=8D?= =?UTF-8?q?=E5=86=8D=E8=AE=BE=E7=BD=AE=E7=BA=BF=E7=A8=8B=E5=90=8D=EF=BC=8C?= =?UTF-8?q?=E9=98=B2=E6=AD=A2=E8=A6=86=E7=9B=96=E8=BF=9B=E7=A8=8B=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/main.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/server/main.cpp b/server/main.cpp index bb972bfb..3dc74243 100644 --- a/server/main.cpp +++ b/server/main.cpp @@ -194,8 +194,6 @@ int start_main(int argc,char *argv[]) { string ssl_file = cmd_main["ssl"]; int threads = cmd_main["threads"]; - setThreadName("main thread"); - //设置日志 Logger::Instance().add(std::make_shared("ConsoleChannel", logLevel)); #ifndef ANDROID From 6b0903aa5fb68d47ee5ce3ee634d3153b8e9e4a6 Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Sun, 28 Nov 2021 21:19:08 +0800 Subject: [PATCH 09/13] =?UTF-8?q?Refine:=20=E7=B2=BE=E7=AE=80=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/main.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/server/main.cpp b/server/main.cpp index 3dc74243..0842f321 100644 --- a/server/main.cpp +++ b/server/main.cpp @@ -246,28 +246,28 @@ int start_main(int argc,char *argv[]) { //简单的telnet服务器,可用于服务器调试,但是不能使用23端口,否则telnet上了莫名其妙的现象 //测试方法:telnet 127.0.0.1 9000 - TcpServer::Ptr shellSrv = std::make_shared(); + auto shellSrv = std::make_shared(); //rtsp[s]服务器, 可用于诸如亚马逊echo show这样的设备访问 - TcpServer::Ptr rtspSrv = std::make_shared();; - TcpServer::Ptr rtspSSLSrv = std::make_shared();; + auto rtspSrv = std::make_shared();; + auto rtspSSLSrv = std::make_shared();; //rtmp[s]服务器 - TcpServer::Ptr rtmpSrv = std::make_shared();; - TcpServer::Ptr rtmpsSrv = std::make_shared();; + auto rtmpSrv = std::make_shared();; + auto rtmpsSrv = std::make_shared();; //http[s]服务器 - TcpServer::Ptr httpSrv = std::make_shared();; - TcpServer::Ptr httpsSrv = std::make_shared();; + auto httpSrv = std::make_shared();; + auto httpsSrv = std::make_shared();; #if defined(ENABLE_RTPPROXY) //GB28181 rtp推流端口,支持UDP/TCP - RtpServer::Ptr rtpServer = std::make_shared(); + auto rtpServer = std::make_shared(); #endif//defined(ENABLE_RTPPROXY) #if defined(ENABLE_WEBRTC) //webrtc udp服务器 - UdpServer::Ptr rtcSrv = std::make_shared(); + auto rtcSrv = std::make_shared(); rtcSrv->setOnCreateSocket([](const EventPoller::Ptr &poller, const Buffer::Ptr &buf, struct sockaddr *, int) { if (!buf) { return Socket::createSocket(poller, false); From 61c55f40309270e2be48e918a03784d0a400c498 Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Sun, 28 Nov 2021 21:42:54 +0800 Subject: [PATCH 10/13] =?UTF-8?q?Refine:=20=E4=BD=BF=E7=94=A8socket=20fd?= =?UTF-8?q?=E4=BD=9C=E4=B8=BA=E6=97=A5=E5=BF=97=E8=BF=BD=E8=B8=AAid?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webrtc/WebRtcSession.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webrtc/WebRtcSession.cpp b/webrtc/WebRtcSession.cpp index 1443269b..6a83ac06 100644 --- a/webrtc/WebRtcSession.cpp +++ b/webrtc/WebRtcSession.cpp @@ -55,7 +55,7 @@ void WebRtcSession::onRecv(const Buffer::Ptr &buffer) { //只允许寻找一次transport _find_transport = false; auto user_name = getUserName(buffer); - _identifier = user_name + '-' + to_string(reinterpret_cast(this)); + _identifier = to_string(getSock()->rawFD()) + '-' + user_name; auto transport = WebRtcTransportManager::Instance().getItem(user_name); CHECK(transport && transport->getPoller()->isCurrentThread()); transport->setSession(shared_from_this()); From f45830cbb8f86201891857d75c6bfa7a44b8d263 Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Sun, 28 Nov 2021 21:43:21 +0800 Subject: [PATCH 11/13] =?UTF-8?q?Refine:=20=E4=BC=98=E5=8C=96webrtc?= =?UTF-8?q?=E5=AF=B9=E8=B1=A1=E8=BF=BD=E8=B8=AA=E6=9C=BA=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 3rdpart/ZLToolKit | 2 +- webrtc/WebRtcTransport.cpp | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/3rdpart/ZLToolKit b/3rdpart/ZLToolKit index 32361898..6c476bed 160000 --- a/3rdpart/ZLToolKit +++ b/3rdpart/ZLToolKit @@ -1 +1 @@ -Subproject commit 323618980315228e46a68204c88c482c150aab82 +Subproject commit 6c476bed4f0d0ee51bb550757aad71b4a412d92f diff --git a/webrtc/WebRtcTransport.cpp b/webrtc/WebRtcTransport.cpp index 7d10b06f..822015f9 100644 --- a/webrtc/WebRtcTransport.cpp +++ b/webrtc/WebRtcTransport.cpp @@ -43,9 +43,11 @@ static onceToken token([]() { }//namespace RTC +static atomic s_key{0}; + WebRtcTransport::WebRtcTransport(const EventPoller::Ptr &poller) { _poller = poller; - _identifier = to_string(reinterpret_cast(this)); + _identifier = to_string(++s_key); _packet_pool.setSize(64); } From edbbaa454131eef0835c4f219912e184fc8a523b Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Sun, 28 Nov 2021 21:47:34 +0800 Subject: [PATCH 12/13] =?UTF-8?q?Refine:=20=E6=9B=B4=E6=96=B0ZLToolKit?= =?UTF-8?q?=EF=BC=8C=E4=BC=98=E5=8C=96=E6=97=A5=E5=BF=97=E5=AF=B9=E8=B1=A1?= =?UTF-8?q?=E8=BF=BD=E8=B8=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 3rdpart/ZLToolKit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/3rdpart/ZLToolKit b/3rdpart/ZLToolKit index 6c476bed..2bb688aa 160000 --- a/3rdpart/ZLToolKit +++ b/3rdpart/ZLToolKit @@ -1 +1 @@ -Subproject commit 6c476bed4f0d0ee51bb550757aad71b4a412d92f +Subproject commit 2bb688aa9b29b79f262e3f90613c177ebac109ac From 78d014cf5112854f4180f88d212f376b1065a326 Mon Sep 17 00:00:00 2001 From: xgj Date: Mon, 29 Nov 2021 16:54:40 +0800 Subject: [PATCH 13/13] fix chrome ufrag too short to play webrtc --- webrtc/WebRtcTransport.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webrtc/WebRtcTransport.cpp b/webrtc/WebRtcTransport.cpp index 822015f9..317140b8 100644 --- a/webrtc/WebRtcTransport.cpp +++ b/webrtc/WebRtcTransport.cpp @@ -47,7 +47,7 @@ static atomic s_key{0}; WebRtcTransport::WebRtcTransport(const EventPoller::Ptr &poller) { _poller = poller; - _identifier = to_string(++s_key); + _identifier = "zlm_"+to_string(++s_key); _packet_pool.setSize(64); }