mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-26 12:37:09 +08:00
完善fci相关代码
This commit is contained in:
parent
aa54adb1ab
commit
2d8ef45e4d
@ -12,6 +12,7 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include "Rtcp.h"
|
#include "Rtcp.h"
|
||||||
#include "Util/logger.h"
|
#include "Util/logger.h"
|
||||||
|
#include "RtcpFCI.h"
|
||||||
|
|
||||||
namespace mediakit {
|
namespace mediakit {
|
||||||
|
|
||||||
@ -493,18 +494,65 @@ string RtcpFB::dumpString() const {
|
|||||||
printer << RtcpHeader::dumpHeader();
|
printer << RtcpHeader::dumpHeader();
|
||||||
printer << "ssrc:" << ssrc << "\r\n";
|
printer << "ssrc:" << ssrc << "\r\n";
|
||||||
printer << "ssrc_media:" << ssrc_media << "\r\n";
|
printer << "ssrc_media:" << ssrc_media << "\r\n";
|
||||||
auto fci = (uint8_t *)&ssrc_media + sizeof(ssrc_media);
|
auto fci_data = (uint8_t *)&ssrc_media + sizeof(ssrc_media);
|
||||||
auto fci_len = getSize() - sizeof(RtcpFB);
|
auto fci_len = getSize() - sizeof(RtcpFB);
|
||||||
if (fci_len) {
|
switch ((RtcpType) pt) {
|
||||||
switch ((RtcpType) pt) {
|
case RtcpType::RTCP_PSFB : {
|
||||||
case RtcpType::RTCP_PSFB : {
|
switch ((PSFBType) report_count) {
|
||||||
break;
|
case PSFBType::RTCP_PSFB_SLI : {
|
||||||
}
|
FCI_SLI *fci = (FCI_SLI *) fci_data;
|
||||||
case RtcpType::RTCP_RTPFB : {
|
fci->check(fci_len);
|
||||||
break;
|
printer << "fci:" << psfbTypeToStr((PSFBType) report_count) << " " << fci->dumpString();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case PSFBType::RTCP_PSFB_PLI : {
|
||||||
|
CHECK(fci_len == 0);
|
||||||
|
printer << "fci:" << psfbTypeToStr((PSFBType) report_count);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case PSFBType::RTCP_PSFB_FIR : {
|
||||||
|
FCI_FIR *fci = (FCI_FIR *) fci_data;
|
||||||
|
fci->check(fci_len);
|
||||||
|
printer << "fci:" << psfbTypeToStr((PSFBType) report_count) << " " << fci->dumpString();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case PSFBType::RTCP_PSFB_REMB : {
|
||||||
|
FCI_REMB *fci = (FCI_REMB *) fci_data;
|
||||||
|
fci->check(fci_len);
|
||||||
|
printer << "fci:" << psfbTypeToStr((PSFBType) report_count) << " " << fci->dumpString();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:{
|
||||||
|
printer << "fci:" << psfbTypeToStr((PSFBType) report_count) << " " << hexdump(fci_data, fci_len);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
printer << "fci:" << hexdump(fci, fci_len);
|
case RtcpType::RTCP_RTPFB : {
|
||||||
|
switch ((RTPFBType) report_count) {
|
||||||
|
case RTPFBType::RTCP_RTPFB_NACK : {
|
||||||
|
FCI_NACK *fci = (FCI_NACK *) fci_data;
|
||||||
|
fci->check(fci_len);
|
||||||
|
printer << "fci:" << rtpfbTypeToStr((RTPFBType) report_count) << " " << fci->dumpString();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case RTPFBType::RTCP_RTPFB_TWCC : {
|
||||||
|
FCI_TWCC *fci = (FCI_TWCC *) fci_data;
|
||||||
|
fci->check(fci_len);
|
||||||
|
printer << "fci:" << rtpfbTypeToStr((RTPFBType) report_count) << " " << fci->dumpString(fci_len);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
printer << "fci:" << rtpfbTypeToStr((RTPFBType) report_count) << " " << hexdump(fci_data, fci_len);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default: /*不可达*/ assert(0); break;
|
||||||
}
|
}
|
||||||
return std::move(printer);
|
return std::move(printer);
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,7 @@ namespace mediakit {
|
|||||||
XX(RTCP_PSFB_TSTR, 5)\
|
XX(RTCP_PSFB_TSTR, 5)\
|
||||||
XX(RTCP_PSFB_TSTN, 6)\
|
XX(RTCP_PSFB_TSTN, 6)\
|
||||||
XX(RTCP_PSFB_VBCM, 7) \
|
XX(RTCP_PSFB_VBCM, 7) \
|
||||||
XX(RTCP_PSFB_AFB, 15)
|
XX(RTCP_PSFB_REMB, 15)
|
||||||
|
|
||||||
//https://tools.ietf.org/html/rfc4585#section-6.2
|
//https://tools.ietf.org/html/rfc4585#section-6.2
|
||||||
//6.2. Transport Layer Feedback Messages
|
//6.2. Transport Layer Feedback Messages
|
||||||
|
@ -453,7 +453,7 @@ map<uint16_t, std::pair<SymbolStatus, uint32_t/*stamp*/> > FCI_TWCC::getPacketCh
|
|||||||
string FCI_TWCC::dumpString(size_t total_size) const {
|
string FCI_TWCC::dumpString(size_t total_size) const {
|
||||||
_StrPrinter printer;
|
_StrPrinter printer;
|
||||||
auto map = getPacketChunkList(total_size);
|
auto map = getPacketChunkList(total_size);
|
||||||
printer << "twcc fci, base_seq:" << getBaseSeq() << ",pkt_status_count:" << getPacketCount() << ", ref time:" << getReferenceTime() << ", fb count:" << (int)fb_pkt_count << "\n";
|
printer << "twcc fci, base_seq:" << getBaseSeq() << ", pkt_status_count:" << getPacketCount() << ", ref time:" << getReferenceTime() << ", fb count:" << (int)fb_pkt_count << "\n";
|
||||||
for (auto &pr : map) {
|
for (auto &pr : map) {
|
||||||
printer << "rtp seq:" << pr.first <<", packet status:" << (int)(pr.second.first) << ", delta:" << pr.second.second << "\n";
|
printer << "rtp seq:" << pr.first <<", packet status:" << (int)(pr.second.first) << ", delta:" << pr.second.second << "\n";
|
||||||
}
|
}
|
||||||
|
@ -1257,18 +1257,29 @@ void RtcConfigure::RtcTrackConfigure::setDefaultSetting(TrackType type){
|
|||||||
//此处调整偏好的编码格式优先级
|
//此处调整偏好的编码格式优先级
|
||||||
preferred_codec = {CodecAAC, CodecG711U, CodecG711A, CodecOpus};
|
preferred_codec = {CodecAAC, CodecG711U, CodecG711A, CodecOpus};
|
||||||
rtcp_fb = {"transport-cc"};
|
rtcp_fb = {"transport-cc"};
|
||||||
extmap = {"1 urn:ietf:params:rtp-hdrext:ssrc-audio-level"};
|
extmap = {"1 urn:ietf:params:rtp-hdrext:ssrc-audio-level",
|
||||||
|
"2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time",
|
||||||
|
"3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01",
|
||||||
|
"4 urn:ietf:params:rtp-hdrext:sdes:mid",
|
||||||
|
"5 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id",
|
||||||
|
"6 urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id"};
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TrackVideo: {
|
case TrackVideo: {
|
||||||
//此处调整偏好的编码格式优先级
|
//此处调整偏好的编码格式优先级
|
||||||
preferred_codec = {CodecH264, CodecH265};
|
preferred_codec = {CodecH264, CodecH265};
|
||||||
rtcp_fb = {"nack", "ccm fir", "nack pli", "goog-remb", "transport-cc"};
|
rtcp_fb = {"nack", "ccm fir", "nack pli", "goog-remb", "transport-cc"};
|
||||||
extmap = {"2 urn:ietf:params:rtp-hdrext:toffset",
|
extmap = {"14 urn:ietf:params:rtp-hdrext:toffset",
|
||||||
"3 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time",
|
"2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time",
|
||||||
"4 urn:3gpp:video-orientation",
|
"13 urn:3gpp:video-orientation",
|
||||||
"5 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01",
|
"3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01",
|
||||||
"6 http://www.webrtc.org/experiments/rtp-hdrext/playout-delay"};
|
"12 http://www.webrtc.org/experiments/rtp-hdrext/playout-delay",
|
||||||
|
"11 http://www.webrtc.org/experiments/rtp-hdrext/video-content-type",
|
||||||
|
"7 http://www.webrtc.org/experiments/rtp-hdrext/video-timing",
|
||||||
|
"8 http://www.webrtc.org/experiments/rtp-hdrext/color-space",
|
||||||
|
"4 urn:ietf:params:rtp-hdrext:sdes:mid",
|
||||||
|
"5 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id",
|
||||||
|
"6 urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id"};
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TrackApplication: {
|
case TrackApplication: {
|
||||||
|
@ -544,7 +544,7 @@ void WebRtcTransportImp::onRtcp(const char *buf, size_t len) {
|
|||||||
}
|
}
|
||||||
case RtcpType::RTCP_PSFB:
|
case RtcpType::RTCP_PSFB:
|
||||||
case RtcpType::RTCP_RTPFB: {
|
case RtcpType::RTCP_RTPFB: {
|
||||||
InfoL << rtcp->dumpString();
|
InfoL << "\n" << rtcp->dumpString();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: break;
|
default: break;
|
||||||
|
@ -1,37 +1,11 @@
|
|||||||
# 致谢与声明
|
14 urn:ietf:params:rtp-hdrext:toffset
|
||||||
本文件夹下部分文件提取自[MediaSoup](https://github.com/versatica/mediasoup) ,分别为:
|
2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
|
||||||
|
13 urn:3gpp:video-orientation
|
||||||
- ice相关功能:
|
3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
|
||||||
- IceServer.cpp
|
12 http://www.webrtc.org/experiments/rtp-hdrext/playout-delay
|
||||||
- IceServer.hpp
|
11 http://www.webrtc.org/experiments/rtp-hdrext/video-content-type
|
||||||
- StunPacket.cpp
|
7 http://www.webrtc.org/experiments/rtp-hdrext/video-timing
|
||||||
- StunPacket.hpp
|
8 http://www.webrtc.org/experiments/rtp-hdrext/color-space
|
||||||
- Utils.hpp
|
4 urn:ietf:params:rtp-hdrext:sdes:mid
|
||||||
|
5 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id
|
||||||
- dtls相关功能:
|
6 urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id
|
||||||
- DtlsTransport.cpp
|
|
||||||
- DtlsTransport.hpp
|
|
||||||
|
|
||||||
- srtp相关功能:
|
|
||||||
- SrtpSession.cpp
|
|
||||||
- SrtpSession.hpp
|
|
||||||
|
|
||||||
|
|
||||||
以上源码有一定的修改和裁剪,感谢MediaSoup开源项目及作者,
|
|
||||||
用户在使用本项目的同时,应该同时遵循MediaSoup的开源协议。
|
|
||||||
|
|
||||||
同时,在此也感谢开源项目[easy_webrtc_server](https://github.com/Mihawk086/easy_webrtc_server) 及作者,
|
|
||||||
在集成MediaSoup相关代码前期,主要参考这个项目。
|
|
||||||
|
|
||||||
另外,感谢[big panda](<2381267071@qq.com>) 开发并贡献的webrtc js测试客户端(www/webrtc目录下文件),
|
|
||||||
其开源项目地址为:https://gitee.com/xiongguangjie/zlmrtcclient.js
|
|
||||||
|
|
||||||
# 现状与规划
|
|
||||||
ZLMediaKit的WebRTC相关功能目前仅供测试与开发,现在还不成熟,后续主要工作有:
|
|
||||||
|
|
||||||
- 1、完善webrtc rtcp相关功能,包括丢包重传、带宽检测等功能。
|
|
||||||
- 2、实现rtp重传等相关功能。
|
|
||||||
- 3、实现simulecast相关功能。
|
|
||||||
- 4、fec、rtp扩展等其他功能。
|
|
||||||
- 5、如果精力允许,逐步替换MediaSoup相关代码,改用自有版权代码。
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user