优化rtmp性能

This commit is contained in:
xia-chu
2021-02-04 17:58:51 +08:00
parent 827158af73
commit bc6286553a
19 changed files with 88 additions and 72 deletions

View File

@@ -319,7 +319,7 @@ void RtmpPlayer::onStreamDry(uint32_t stream_index) {
onPlayResult_l(SockException(Err_other, "rtmp stream dry"), true);
}
void RtmpPlayer::onMediaData_l(const RtmpPacket::Ptr &chunk_data) {
void RtmpPlayer::onMediaData_l(RtmpPacket::Ptr chunk_data) {
_rtmp_recv_ticker.resetTime();
if (!_play_timer) {
//已经触发了onPlayResult事件直接触发onMediaData事件
@@ -338,8 +338,8 @@ void RtmpPlayer::onMediaData_l(const RtmpPacket::Ptr &chunk_data) {
}
}
void RtmpPlayer::onRtmpChunk(RtmpPacket &chunk_data) {
void RtmpPlayer::onRtmpChunk(RtmpPacket::Ptr packet) {
auto &chunk_data = *packet;
typedef void (RtmpPlayer::*rtmp_func_ptr)(AMFDecoder &dec);
static unordered_map<string, rtmp_func_ptr> s_func_map;
static onceToken token([]() {
@@ -379,7 +379,7 @@ void RtmpPlayer::onRtmpChunk(RtmpPacket &chunk_data) {
}
_metadata_got = true;
}
onMediaData_l(std::make_shared<RtmpPacket>(std::move(chunk_data)));
onMediaData_l(std::move(packet));
break;
}