http-flv拉流客户端支持压测模式

This commit is contained in:
xia-chu 2023-09-23 20:34:43 +08:00
parent 585f7c3a3a
commit d542eca4d7
2 changed files with 6 additions and 1 deletions

View File

@ -54,7 +54,10 @@ void FlvPlayer::onResponseCompleted(const SockException &ex) {
}
void FlvPlayer::onResponseBody(const char *buf, size_t size) {
if (!_benchmark_mode) {
// 性能测试模式不做数据解析节省cpu
FlvSplitter::input(buf, size);
}
}
bool FlvPlayer::onRecvMetadata(const AMFValue &metadata) {
@ -64,6 +67,7 @@ bool FlvPlayer::onRecvMetadata(const AMFValue &metadata) {
void FlvPlayer::onRecvRtmpPacket(RtmpPacket::Ptr packet) {
if (!_play_result && !packet->isConfigFrame()) {
_play_result = true;
_benchmark_mode = (*this)[Client::kBenchmarkMode].as<int>();
onPlayResult(SockException(Err_success, "play http-flv success"));
}
onRtmpPacket(std::move(packet));

View File

@ -40,6 +40,7 @@ private:
private:
bool _play_result = false;
bool _benchmark_mode = false;
};
using FlvPlayerImp = FlvPlayerBase<FlvPlayer>;