添加性能测试模式

This commit is contained in:
xiongziliang
2020-04-08 11:16:09 +08:00
parent 5025d7d4cc
commit 0fc1499643
7 changed files with 23 additions and 0 deletions

View File

@@ -118,6 +118,8 @@ void RtmpPlayer::onPlayResult_l(const SockException &ex , bool handshakeComplete
//开始播放阶段
_pPlayTimer.reset();
onPlayResult(ex);
//是否为性能测试模式
_benchmark_mode = (*this)[Client::kBenchmarkMode].as<int>();
} else if (ex) {
//播放成功后异常断开回调
onShutdown(ex);
@@ -146,6 +148,11 @@ void RtmpPlayer::onConnect(const SockException &err){
}
void RtmpPlayer::onRecv(const Buffer::Ptr &pBuf){
try {
if(_benchmark_mode && !_pPlayTimer){
//在性能测试模式下如果rtmp握手完毕后不再解析rtmp包
_mediaTicker.resetTime();
return;
}
onParseRtmp(pBuf->data(), pBuf->size());
} catch (exception &e) {
SockException ex(Err_other, e.what());

View File

@@ -102,6 +102,8 @@ private:
uint32_t _aiNowStamp[2] = { 0, 0 };
Ticker _aNowStampTicker[2];
bool _metadata_got = false;
//是否为性能测试模式
bool _benchmark_mode = false;
};
} /* namespace mediakit */