From 67eb75048cdefc7e1e84f56f8a84ef71aefa469a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=8F=E6=A5=9A?= <771730766@qq.com> Date: Thu, 8 Apr 2021 18:11:21 +0800 Subject: [PATCH 1/5] Update README.md --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 73ba90eb..f4712868 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ ## 项目特点 - 基于C++11开发,避免使用裸指针,代码稳定可靠,性能优越。 -- 支持多种协议(RTSP/RTMP/HLS/HTTP-FLV/WebSocket-FLV/GB28181/HTTP-TS/WebSocket-TS/HTTP-fMP4/WebSocket-fMP4/MP4),支持协议互转。 +- 支持多种协议(RTSP/RTMP/HLS/HTTP-FLV/WebSocket-FLV/GB28181/HTTP-TS/WebSocket-TS/HTTP-fMP4/WebSocket-fMP4/MP4/WebRTC),支持协议互转。 - 使用多路复用/多线程/异步网络IO模式开发,并发性能优越,支持海量客户端连接。 - 代码经过长期大量的稳定性、性能测试,已经在线上商用验证已久。 - 支持linux、macos、ios、android、windows全平台。 @@ -92,6 +92,10 @@ - RTSP/RTMP/HTTP-FLV/WS-FLV支持MP4文件点播,支持seek - 支持H264/H265/AAC/G711/OPUS编码 +- WebRTC(体验,请使用dev分支) + - 支持WebRTC推流,支持转其他协议 + - 支持WebRTC播放,支持其他协议转WebRTC + - 其他 - 支持丰富的restful api以及web hook事件 - 支持简单的telnet调试 From e899064b2a273b494f8694628ae830e2cf3ddf99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=8F=E6=A5=9A?= <771730766@qq.com> Date: Fri, 9 Apr 2021 19:58:40 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E6=B7=BB=E5=8A=A0webrtc=E7=9B=B8=E5=85=B3?= =?UTF-8?q?=E6=8F=8F=E8=BF=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f4712868..1322dfa5 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ ## 功能清单 ### 功能一览 -图片 +功能一览 - RTSP[S] - RTSP[S] 服务器,支持RTMP/MP4/HLS转RTSP[S],支持亚马逊echo show这样的设备 From 9b57edff09cfb4b71696c15dc133343eac258add Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=8F=E6=A5=9A?= <771730766@qq.com> Date: Fri, 9 Apr 2021 20:10:57 +0800 Subject: [PATCH 3/5] webrtc supported --- README_en.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README_en.md b/README_en.md index a89d0ded..b37074c3 100644 --- a/README_en.md +++ b/README_en.md @@ -11,7 +11,7 @@ ## Why ZLMediaKit? - Developed based on C++ 11, the code is stable and reliable, avoiding the use of raw pointers, cross-platform porting is simple and convenient, and the code is clear and concise. -- Support rich streaming media protocols(`RTSP/RTMP/HLS/HTTP-FLV/WebSocket-flv/HTTP-TS/WebSocket-TS/HTTP-fMP4/Websocket-fMP4/MP4`),and support Inter-protocol conversion. +- Support rich streaming media protocols(`RTSP/RTMP/HLS/HTTP-FLV/WebSocket-flv/HTTP-TS/WebSocket-TS/HTTP-fMP4/Websocket-fMP4/MP4/WebRTC`),and support Inter-protocol conversion. - Multiplexing asynchronous network IO based on epoll and multi thread,extreme performance. - Well performance and stable test,can be used commercially. - Support linux, macos, ios, android, Windows Platforms. @@ -55,6 +55,10 @@ - WebSocket Server and Client. - File access authentication. +- WebRTC(experiential, dev branch) + - Support webrtc push stream and transfer to other protocols + - Support webrtc play, support other protocol to webrtc + - Others - Support stream proxy by ffmpeg. - RESTful http api and http hook event api. From 271b180004e6c66c8277cc3b87f250d070987eb5 Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Sun, 11 Apr 2021 11:39:49 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=B5=81=E6=B3=A8?= =?UTF-8?q?=E5=86=8C=E4=BA=8B=E4=BB=B6track=E5=92=8Cregist=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E7=BC=BA=E5=A4=B1=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/WebApi.cpp | 2 +- server/WebHook.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/server/WebApi.cpp b/server/WebApi.cpp index ad0c7bd8..6c88f4f5 100755 --- a/server/WebApi.cpp +++ b/server/WebApi.cpp @@ -272,7 +272,7 @@ Value makeMediaSourceJson(MediaSource &media){ item["originSock"] = Json::nullValue; } - for(auto &track : media.getTracks()){ + for(auto &track : media.getTracks(false)){ Value obj; auto codec_type = track->getTrackType(); obj["codec_id"] = track->getCodecId(); diff --git a/server/WebHook.cpp b/server/WebHook.cpp index 1bd47ffb..d1df3308 100755 --- a/server/WebHook.cpp +++ b/server/WebHook.cpp @@ -301,14 +301,15 @@ void installWebHook(){ return; } ArgsType body; - body["regist"] = bRegist; if (bRegist) { body = makeMediaSourceJson(sender); + body["regist"] = bRegist; } else { body["schema"] = sender.getSchema(); body["vhost"] = sender.getVhost(); body["app"] = sender.getApp(); body["stream"] = sender.getId(); + body["regist"] = bRegist; } //执行hook do_http_hook(hook_stream_chaned,body, nullptr); From 8a51bd2d9e7a9998d6771f87e649928a80f867c0 Mon Sep 17 00:00:00 2001 From: xia-chu <771730766@qq.com> Date: Sun, 11 Apr 2021 20:35:00 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E6=96=B0=E5=A2=9Ertp=20ssrc=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=E5=A4=84=E7=90=86=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Rtsp/RtpReceiver.cpp | 18 ++++++++++++++---- src/Rtsp/RtpReceiver.h | 1 + 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/Rtsp/RtpReceiver.cpp b/src/Rtsp/RtpReceiver.cpp index 711ce9e8..c33c2b5a 100644 --- a/src/Rtsp/RtpReceiver.cpp +++ b/src/Rtsp/RtpReceiver.cpp @@ -53,12 +53,22 @@ bool RtpReceiver::handleOneRtp(int index, TrackType type, int sample_rate, uint8 auto ssrc = ntohl(header->ssrc); if (!_ssrc[index]) { - //保存SSRC至track对象 + //记录并锁定ssrc _ssrc[index] = ssrc; - } else if (_ssrc[index] != ssrc) { + _ssrc_alive[index].resetTime(); + } else if (_ssrc[index] == ssrc) { + //ssrc匹配正确,刷新计时器 + _ssrc_alive[index].resetTime(); + } else { //ssrc错误 - WarnL << "ssrc错误:" << ssrc << " != " << _ssrc[index]; - return false; + if (_ssrc_alive[index].elapsedTime() < 10 * 1000) { + //接受正确ssrc的rtp在10秒内,那么我们认为存在多路rtp,忽略掉ssrc不匹配的rtp + WarnL << "ssrc比匹配,rtp已丢弃:" << ssrc << " != " << _ssrc[index]; + return false; + } + InfoL << "rtp流ssrc切换:" << _ssrc[index] << " -> " << ssrc; + _ssrc[index] = ssrc; + _ssrc_alive[index].resetTime(); } auto rtp = RtpPacket::create(); diff --git a/src/Rtsp/RtpReceiver.h b/src/Rtsp/RtpReceiver.h index 99cba9d3..f8d2fde9 100644 --- a/src/Rtsp/RtpReceiver.h +++ b/src/Rtsp/RtpReceiver.h @@ -198,6 +198,7 @@ protected: private: uint32_t _ssrc[2] = {0, 0}; + Ticker _ssrc_alive[2]; //rtp排序缓存,根据seq排序 PacketSortor _rtp_sortor[2]; };