mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-25 20:27:34 +08:00
完善fci相关代码
This commit is contained in:
parent
aa54adb1ab
commit
2d8ef45e4d
@ -12,6 +12,7 @@
|
||||
#include <assert.h>
|
||||
#include "Rtcp.h"
|
||||
#include "Util/logger.h"
|
||||
#include "RtcpFCI.h"
|
||||
|
||||
namespace mediakit {
|
||||
|
||||
@ -493,18 +494,65 @@ string RtcpFB::dumpString() const {
|
||||
printer << RtcpHeader::dumpHeader();
|
||||
printer << "ssrc:" << ssrc << "\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);
|
||||
if (fci_len) {
|
||||
switch ((RtcpType) pt) {
|
||||
case RtcpType::RTCP_PSFB : {
|
||||
switch ((PSFBType) report_count) {
|
||||
case PSFBType::RTCP_PSFB_SLI : {
|
||||
FCI_SLI *fci = (FCI_SLI *) fci_data;
|
||||
fci->check(fci_len);
|
||||
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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
printer << "fci:" << hexdump(fci, fci_len);
|
||||
break;
|
||||
}
|
||||
default: /*不可达*/ assert(0); break;
|
||||
}
|
||||
return std::move(printer);
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ namespace mediakit {
|
||||
XX(RTCP_PSFB_TSTR, 5)\
|
||||
XX(RTCP_PSFB_TSTN, 6)\
|
||||
XX(RTCP_PSFB_VBCM, 7) \
|
||||
XX(RTCP_PSFB_AFB, 15)
|
||||
XX(RTCP_PSFB_REMB, 15)
|
||||
|
||||
//https://tools.ietf.org/html/rfc4585#section-6.2
|
||||
//6.2. Transport Layer Feedback Messages
|
||||
|
@ -1257,18 +1257,29 @@ void RtcConfigure::RtcTrackConfigure::setDefaultSetting(TrackType type){
|
||||
//此处调整偏好的编码格式优先级
|
||||
preferred_codec = {CodecAAC, CodecG711U, CodecG711A, CodecOpus};
|
||||
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;
|
||||
}
|
||||
case TrackVideo: {
|
||||
//此处调整偏好的编码格式优先级
|
||||
preferred_codec = {CodecH264, CodecH265};
|
||||
rtcp_fb = {"nack", "ccm fir", "nack pli", "goog-remb", "transport-cc"};
|
||||
extmap = {"2 urn:ietf:params:rtp-hdrext:toffset",
|
||||
"3 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time",
|
||||
"4 urn:3gpp:video-orientation",
|
||||
"5 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01",
|
||||
"6 http://www.webrtc.org/experiments/rtp-hdrext/playout-delay"};
|
||||
extmap = {"14 urn:ietf:params:rtp-hdrext:toffset",
|
||||
"2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time",
|
||||
"13 urn:3gpp:video-orientation",
|
||||
"3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01",
|
||||
"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;
|
||||
}
|
||||
case TrackApplication: {
|
||||
|
@ -544,7 +544,7 @@ void WebRtcTransportImp::onRtcp(const char *buf, size_t len) {
|
||||
}
|
||||
case RtcpType::RTCP_PSFB:
|
||||
case RtcpType::RTCP_RTPFB: {
|
||||
InfoL << rtcp->dumpString();
|
||||
InfoL << "\n" << rtcp->dumpString();
|
||||
break;
|
||||
}
|
||||
default: break;
|
||||
|
@ -1,37 +1,11 @@
|
||||
# 致谢与声明
|
||||
本文件夹下部分文件提取自[MediaSoup](https://github.com/versatica/mediasoup) ,分别为:
|
||||
|
||||
- ice相关功能:
|
||||
- IceServer.cpp
|
||||
- IceServer.hpp
|
||||
- StunPacket.cpp
|
||||
- StunPacket.hpp
|
||||
- Utils.hpp
|
||||
|
||||
- dtls相关功能:
|
||||
- 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相关代码,改用自有版权代码。
|
||||
|
||||
14 urn:ietf:params:rtp-hdrext:toffset
|
||||
2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
|
||||
13 urn:3gpp:video-orientation
|
||||
3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
|
||||
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
|
Loading…
Reference in New Issue
Block a user