大幅提升接收推流性能以及降低内存占用

This commit is contained in:
xiongziliang
2020-11-01 03:41:35 +08:00
parent 5c7a08eb7c
commit 700a16c759
38 changed files with 173 additions and 193 deletions

View File

@@ -121,8 +121,6 @@ void RtspPusher::onConnect(const SockException &err) {
onPublishResult(err, false);
return;
}
//推流器不需要多大的接收缓存,节省内存占用
getSock()->setReadBuffer(std::make_shared<BufferRaw>(1 * 1024));
sendAnnounce();
}
@@ -318,7 +316,7 @@ inline void RtspPusher::sendRtpPacket(const RtspMediaSource::RingDataType &pkt)
setSendFlushFlag(true);
}
BufferRtp::Ptr buffer(new BufferRtp(rtp));
send(buffer);
send(std::move(buffer));
});
break;
}
@@ -335,7 +333,7 @@ inline void RtspPusher::sendRtpPacket(const RtspMediaSource::RingDataType &pkt)
}
BufferRtp::Ptr buffer(new BufferRtp(rtp, 4));
pSock->send(buffer, nullptr, 0, ++i == size);
pSock->send(std::move(buffer), nullptr, 0, ++i == size);
});
break;
}
@@ -475,7 +473,7 @@ void RtspPusher::sendRtspRequest(const string &cmd, const string &url,const StrC
if (!sdp.empty()) {
printer << sdp;
}
SockSender::send(printer);
SockSender::send(std::move(printer));
}