Skip to content

Commit

Permalink
Merge branch 'master' of https://gitee.com/xia-chu/ZLMediaKit
Browse files Browse the repository at this point in the history
  • Loading branch information
xia-chu committed Aug 8, 2023
2 parents ff0f776 + 383da1e commit 3f72fc7
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 71 deletions.
2 changes: 1 addition & 1 deletion 3rdpart/ZLToolKit
Submodule ZLToolKit updated from 79db40 to d20165
44 changes: 25 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,30 +169,36 @@ bash build_docker_images.sh
```

## 合作项目

- 视频管理平台
- [wvp-GB28181-pro](https://github.com/648540858/wvp-GB28181-pro) java实现的开箱即用的GB28181协议视频平台
- [AKStream](https://github.com/chatop2020/AKStream) c#实现的全功能的软NVR接口/GB28181平台
- [BXC_SipServer](https://github.com/any12345com/BXC_SipServer) c++实现的国标GB28181流媒体信令服务器
- [gosip](https://github.com/panjjo/gosip) golang实现的GB28181服务器
- [FreeEhome](https://github.com/tsingeye/FreeEhome) golang实现的海康ehome服务器

- 播放器
- [h265web.js](https://github.com/numberwolf/h265web.js) 基于wasm支持H265的播放器,支持本项目多种专属协议
- [jessibuca](https://github.com/langhuihui/jessibuca) 基于wasm支持H265的播放器
- [wsPlayer](https://github.com/v354412101/wsPlayer) 基于MSE的websocket-fmp4播放器
- [BXC_gb28181Player](https://github.com/any12345com/BXC_gb28181Player) C++开发的支持国标GB28181协议的视频流播放器

- 可视化管理网站
- [最新的前后端分离web项目,支持webrtc播放](https://github.com/langmansh/AKStreamNVR)
- [基于ZLMediaKit主线的管理WEB网站](https://gitee.com/kkkkk5G/MediaServerUI)
- [基于ZLMediaKit分支的管理WEB网站](https://github.com/chenxiaolei/ZLMediaKit_NVR_UI)
- [一个非常漂亮的可视化后台管理系统](https://github.com/MingZhuLiu/ZLMediaServerManagent)

- 流媒体管理平台
- [GB28181完整解决方案,自带web管理网站,支持webrtc、h265播放](https://github.com/648540858/wvp-GB28181-pro)
- [功能强大的流媒体控制管理接口平台,支持GB28181](https://github.com/chatop2020/AKStream)
- [Go实现的GB28181服务器](https://github.com/panjjo/gosip)
- [node-js版本的GB28181平台](https://gitee.com/hfwudao/GB28181_Node_Http)
- [Go实现的海康ehome服务器](https://github.com/tsingeye/FreeEhome)

- 客户端
- [c sdk完整c#包装库](https://github.com/malegend/ZLMediaKit.Autogen)
- WEB管理网站
- [AKStreamNVR](https://github.com/langmansh/AKStreamNVR) 前后端分离web项目,支持webrtc播放

- SDK
- [c# sdk](https://github.com/malegend/ZLMediaKit.Autogen) 本项目c sdk完整c#包装库
- [metaRTC](https://github.com/metartc/metaRTC) 全国产纯c webrtc sdk

- 其他项目(已停止更新)
- [NodeJS实现的GB28181平台](https://gitee.com/hfwudao/GB28181_Node_Http)
- [基于ZLMediaKit主线的管理WEB网站 ](https://gitee.com/kkkkk5G/MediaServerUI)
- [基于ZLMediaKit分支的管理WEB网站](https://github.com/chenxiaolei/ZLMediaKit_NVR_UI)
- [一个非常漂亮的可视化后台管理系统](https://github.com/MingZhuLiu/ZLMediaServerManagent)
- [基于C SDK实现的推流客户端](https://github.com/hctym1995/ZLM_ApiDemo)
- [C#版本的Http API与Hook](https://github.com/chengxiaosheng/ZLMediaKit.HttpApi)
- [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)
- [全国产webrtc sdk(metaRTC)](https://github.com/metartc/metaRTC)

## 授权协议

Expand Down
2 changes: 2 additions & 0 deletions README_en.md
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,7 @@ bash build_docker_images.sh
- Media management platform
- [GB28181 complete solution with web management website, supporting webrtc and h265 playback](https://github.com/648540858/wvp-GB28181-pro)
- [Powerful media control and management interface platform, supporting GB28181](https://github.com/chatop2020/AKStream)
- [GB28181 server implemented in C++](https://github.com/any12345com/BXC_SipServer)
- [GB28181 server implemented in Go](https://github.com/panjjo/gosip)
- [Node-js version of GB28181 platform](https://gitee.com/hfwudao/GB28181_Node_Http)
- [Hikvision ehome server implemented in Go](https://github.com/tsingeye/FreeEhome)
Expand All @@ -364,6 +365,7 @@ bash build_docker_images.sh
- [Player supporting H265 based on wasm](https://github.com/numberwolf/h265web.js)
- [WebSocket-fmp4 player based on MSE](https://github.com/v354412101/wsPlayer)
- [Domestic webrtc sdk(metaRTC)](https://github.com/metartc/metaRTC)
- [GB28181 player implemented in C++](https://github.com/any12345com/BXC_gb28181Player)

## License

Expand Down
2 changes: 0 additions & 2 deletions src/Common/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,12 +231,10 @@ static onceToken token([]() {
////////////RTMP服务器配置///////////
namespace Rtmp {
#define RTMP_FIELD "rtmp."
const string kModifyStamp = RTMP_FIELD "modifyStamp";
const string kHandshakeSecond = RTMP_FIELD "handshakeSecond";
const string kKeepAliveSecond = RTMP_FIELD "keepAliveSecond";

static onceToken token([]() {
mINI::Instance()[kModifyStamp] = false;
mINI::Instance()[kHandshakeSecond] = 15;
mINI::Instance()[kKeepAliveSecond] = 15;
});
Expand Down
8 changes: 5 additions & 3 deletions src/Rtmp/Rtmp.h
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,8 @@ enum class RtmpFrameType : uint8_t {
video_info_frame = 5, // video info/command frame
};

#define MKBETAG(a, b, c, d) ((d) | ((c) << 8) | ((b) << 16) | ((unsigned)(a) << 24))

// UB [4]; Codec Identifier.
enum class RtmpVideoCodec : uint32_t {
h263 = 2, // Sorenson H.263
Expand All @@ -274,9 +276,9 @@ enum class RtmpVideoCodec : uint32_t {
h265 = 12, // 国内扩展

// 增强型rtmp FourCC
fourcc_vp9 = 'vp09',
fourcc_av1 = 'av01',
fourcc_hevc = 'hvc1'
fourcc_vp9 = MKBETAG('v', 'p', '0', '9'),
fourcc_av1 = MKBETAG('a', 'v', '0', '1'),
fourcc_hevc = MKBETAG('h', 'v', 'c', '1')
};

// UI8;
Expand Down
1 change: 1 addition & 0 deletions src/Rtmp/RtmpSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,7 @@ void RtmpSession::sendPlayResponse(const string &err, const RtmpMediaSource::Ptr
if (!strong_self) {
return;
}
strong_self->sendUserControl(CONTROL_STREAM_EOF/*or CONTROL_STREAM_DRY ?*/, STREAM_MEDIA);
strong_self->shutdown(SockException(Err_shutdown,"rtmp ring buffer detached"));
});
src->pause(false);
Expand Down
54 changes: 11 additions & 43 deletions src/Rtsp/Rtsp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ static TrackType toTrackType(const string &str) {
}

void SdpParser::load(const string &sdp) {
std::multimap<char, std::string> global_infos;
{
_track_vec.clear();
SdpTrack::Ptr track = std::make_shared<SdpTrack>();
Expand All @@ -166,23 +165,17 @@ void SdpParser::load(const string &sdp) {
string opt_val = line.substr(2);
switch (opt) {
case 't':
if (_track_vec.size() == 1)
global_infos.emplace(opt, opt_val);
else
track->_t = opt_val;
track->_t = opt_val;
break;
case 'b':
if (_track_vec.size() == 1)
global_infos.emplace(opt, opt_val);
else
track->_b = opt_val;
track->_b = opt_val;
break;
case 'm': {
track = std::make_shared<SdpTrack>();
int pt, port, port_count;
char rtp[16] = { 0 }, type[16];
if (4 == sscanf(opt_val.data(), " %15[^ ] %d %15[^ ] %d", type, &port, rtp, &pt)
|| 5 == sscanf(opt_val.data(), " %15[^ ] %d/%d %15[^ ] %d", type, &port, &port_count, rtp, &pt)) {
char rtp[16] = {0}, type[16];
if (4 == sscanf(opt_val.data(), " %15[^ ] %d %15[^ ] %d", type, &port, rtp, &pt) ||
5 == sscanf(opt_val.data(), " %15[^ ] %d/%d %15[^ ] %d", type, &port, &port_count, rtp, &pt)) {
track->_pt = pt;
track->_samplerate = RtpPayload::getClockRate(pt);
track->_channel = RtpPayload::getAudioChannel(pt);
Expand All @@ -195,43 +188,17 @@ void SdpParser::load(const string &sdp) {
case 'a': {
string attr = findSubString(opt_val.data(), nullptr, ":");
if (attr.empty()) {
if (_track_vec.size() == 1)
global_infos.emplace(opt, opt_val);
else
track->_attr.emplace(opt_val, "");
track->_attr.emplace(opt_val, "");
} else {
if (_track_vec.size() == 1)
global_infos.emplace(opt, opt_val);
else
track->_attr.emplace(attr, findSubString(opt_val.data(), ":", nullptr));
}
break;
}
default: {
if (_track_vec.size() == 1) {
global_infos.emplace(opt, opt_val);
} else {
track->_other[opt] = opt_val;
track->_attr.emplace(attr, findSubString(opt_val.data(), ":", nullptr));
}
break;
}
default: track->_other[opt] = opt_val; break;
}
}
}

for (auto &info : global_infos) {
std::string attr;
switch (info.first) {
case 'a':
attr = findSubString(info.second.data(), nullptr, ":");
if (attr == "control") {
_control_url = findSubString(info.second.data(), ":", nullptr);
}
break;

default: break;
}
}
for (auto &track_ptr : _track_vec) {
auto &track = *track_ptr;
auto it = track._attr.find("range");
Expand Down Expand Up @@ -355,9 +322,10 @@ string SdpParser::toString() const {
}

std::string SdpParser::getControlUrl(const std::string &url) const {
if (_control_url.find("://") != string::npos) {
auto title_track = getTrack(TrackTitle);
if (title_track && title_track->_control.find("://") != string::npos) {
// 以rtsp://开头
return _control_url;
return title_track->_control;
}
return url;
}
Expand Down
1 change: 0 additions & 1 deletion src/Rtsp/Rtsp.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,6 @@ class SdpParser {

private:
std::vector<SdpTrack::Ptr> _track_vec;
std::string _control_url;
};

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Rtsp/RtspSession.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -721,11 +721,11 @@ void RtspSession::handleReq_Setup(const Parser &parser) {

auto peerAddr = SockUtil::make_sockaddr(get_peer_ip().data(), ui16RtpPort);
//设置rtp发送目标地址
pr.first->bindPeerAddr((struct sockaddr *) (&peerAddr));
pr.first->bindPeerAddr((struct sockaddr *) (&peerAddr), 0, true);

//设置rtcp发送目标地址
peerAddr = SockUtil::make_sockaddr(get_peer_ip().data(), ui16RtcpPort);
pr.second->bindPeerAddr((struct sockaddr *) (&peerAddr));
pr.second->bindPeerAddr((struct sockaddr *) (&peerAddr), 0, true);

//尝试获取客户端nat映射地址
startListenPeerUdpData(trackIdx);
Expand Down

0 comments on commit 3f72fc7

Please sign in to comment.