mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-26 12:37:09 +08:00
Merge branch 'master' of https://gitee.com/xia-chu/ZLMediaKit into dev
This commit is contained in:
commit
46b84fcf39
@ -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全平台。
|
||||
@ -33,7 +33,7 @@
|
||||
|
||||
## 功能清单
|
||||
### 功能一览
|
||||
<img width="800" alt="图片" src="https://user-images.githubusercontent.com/11495632/102689561-09824200-423a-11eb-9cf9-b39d1378ef68.png">
|
||||
<img width="800" alt="功能一览" src="https://user-images.githubusercontent.com/11495632/114176523-d50fce80-996d-11eb-81f8-0a2e2715ba7b.png">
|
||||
|
||||
- RTSP[S]
|
||||
- RTSP[S] 服务器,支持RTMP/MP4/HLS转RTSP[S],支持亚马逊echo show这样的设备
|
||||
@ -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调试
|
||||
|
@ -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.
|
||||
|
@ -303,7 +303,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();
|
||||
|
@ -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);
|
||||
|
@ -53,13 +53,23 @@ 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];
|
||||
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();
|
||||
//需要添加4个字节的rtp over tcp头
|
||||
|
@ -198,6 +198,7 @@ protected:
|
||||
|
||||
private:
|
||||
uint32_t _ssrc[2] = {0, 0};
|
||||
Ticker _ssrc_alive[2];
|
||||
//rtp排序缓存,根据seq排序
|
||||
PacketSortor<RtpPacket::Ptr> _rtp_sortor[2];
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user