mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-22 10:40:05 +08:00
优化webrtc jitter buffer相关参数
This commit is contained in:
parent
34bb843e9c
commit
1ef3642ed4
@ -20,6 +20,28 @@
|
|||||||
|
|
||||||
namespace mediakit {
|
namespace mediakit {
|
||||||
|
|
||||||
|
// RTC配置项目
|
||||||
|
namespace Rtc {
|
||||||
|
|
||||||
|
//~ nack接收端(rtp发送端)
|
||||||
|
// Nack缓存包最早时间间隔
|
||||||
|
extern const std::string kMaxNackMS;
|
||||||
|
// Nack包检查间隔(包数量)
|
||||||
|
extern const std::string kRtpCacheCheckInterval;
|
||||||
|
|
||||||
|
//~ nack发送端(rtp接收端)
|
||||||
|
// 最大保留的rtp丢包状态个数
|
||||||
|
extern const std::string kNackMaxSize;
|
||||||
|
// rtp丢包状态最长保留时间
|
||||||
|
extern const std::string kNackMaxMS;
|
||||||
|
// nack最多请求重传次数
|
||||||
|
extern const std::string kNackMaxCount;
|
||||||
|
// nack重传频率,rtt的倍数
|
||||||
|
extern const std::string kNackIntervalRatio;
|
||||||
|
// nack包中rtp个数,减小此值可以让nack包响应更灵敏
|
||||||
|
extern const std::string kNackRtpSize;
|
||||||
|
} // namespace Rtc
|
||||||
|
|
||||||
class NackList {
|
class NackList {
|
||||||
public:
|
public:
|
||||||
void pushBack(RtpPacket::Ptr rtp);
|
void pushBack(RtpPacket::Ptr rtp);
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
#include "Util/base64.h"
|
#include "Util/base64.h"
|
||||||
#include "Network/sockutil.h"
|
#include "Network/sockutil.h"
|
||||||
#include "Common/config.h"
|
#include "Common/config.h"
|
||||||
|
#include "Nack.h"
|
||||||
#include "RtpExt.h"
|
#include "RtpExt.h"
|
||||||
#include "Rtcp/Rtcp.h"
|
#include "Rtcp/Rtcp.h"
|
||||||
#include "Rtcp/RtcpFCI.h"
|
#include "Rtcp/RtcpFCI.h"
|
||||||
@ -57,9 +58,6 @@ const string kMinBitrate = RTC_FIELD "min_bitrate";
|
|||||||
// 数据通道设置
|
// 数据通道设置
|
||||||
const string kDataChannelEcho = RTC_FIELD "datachannel_echo";
|
const string kDataChannelEcho = RTC_FIELD "datachannel_echo";
|
||||||
|
|
||||||
// rtp丢包状态最长保留时间
|
|
||||||
const string kNackMaxMS = RTC_FIELD "nackMaxMS";
|
|
||||||
|
|
||||||
static onceToken token([]() {
|
static onceToken token([]() {
|
||||||
mINI::Instance()[kTimeOutSec] = 15;
|
mINI::Instance()[kTimeOutSec] = 15;
|
||||||
mINI::Instance()[kExternIP] = "";
|
mINI::Instance()[kExternIP] = "";
|
||||||
@ -72,8 +70,6 @@ static onceToken token([]() {
|
|||||||
mINI::Instance()[kMinBitrate] = 0;
|
mINI::Instance()[kMinBitrate] = 0;
|
||||||
|
|
||||||
mINI::Instance()[kDataChannelEcho] = true;
|
mINI::Instance()[kDataChannelEcho] = true;
|
||||||
|
|
||||||
mINI::Instance()[kNackMaxMS] = 3 * 1000;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
} // namespace RTC
|
} // namespace RTC
|
||||||
@ -806,7 +802,8 @@ public:
|
|||||||
setOnSorted(std::move(cb));
|
setOnSorted(std::move(cb));
|
||||||
//设置jitter buffer参数
|
//设置jitter buffer参数
|
||||||
GET_CONFIG(uint32_t, nack_maxms, Rtc::kNackMaxMS);
|
GET_CONFIG(uint32_t, nack_maxms, Rtc::kNackMaxMS);
|
||||||
RtpTrackImp::setParams(1024, nack_maxms, 512);
|
GET_CONFIG(uint32_t, nack_max_rtp, Rtc::kNackMaxSize);
|
||||||
|
RtpTrackImp::setParams(nack_max_rtp, nack_maxms, nack_max_rtp / 2);
|
||||||
_nack_ctx.setOnNack([this](const FCI_NACK &nack) { onNack(nack); });
|
_nack_ctx.setOnNack([this](const FCI_NACK &nack) { onNack(nack); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user