使用临时变量和std::move减少智能指针的拷贝构造

This commit is contained in:
xiongziliang
2020-10-10 18:23:25 +08:00
parent 83a24a5863
commit dfaa8b540c
12 changed files with 31 additions and 30 deletions

View File

@@ -47,7 +47,7 @@ public:
/**
* 输入rtp并解析
*/
void onWrite(const RtpPacket::Ptr &rtp, bool key_pos) override {
void onWrite(RtpPacket::Ptr rtp, bool key_pos) override {
if (_all_track_ready && !_muxer->isEnabled()) {
//获取到所有Track后并且未开启转协议那么不需要解复用rtp
//在关闭rtp解复用后无法知道是否为关键帧这样会导致无法秒开或者开播花屏
@@ -56,7 +56,7 @@ public:
//需要解复用rtp
key_pos = _demuxer->inputRtp(rtp);
}
RtspMediaSource::onWrite(rtp, key_pos);
RtspMediaSource::onWrite(std::move(rtp), key_pos);
}
/**