避免内存拷贝,大幅提高rtmp服务器的性能

This commit is contained in:
xiongziliang
2019-03-22 14:37:03 +08:00
parent 2b4d8a123d
commit e445c7e14c
5 changed files with 87 additions and 56 deletions

View File

@@ -200,7 +200,7 @@ inline void RtmpPusher::send_metaData(){
sendRequest(MSG_DATA, enc.data());
src->getConfigFrame([&](const RtmpPacket::Ptr &pkt){
sendRtmp(pkt->typeId, _ui32StreamId, pkt->strBuf, pkt->timeStamp, pkt->chunkId );
sendRtmp(pkt->typeId, _ui32StreamId, pkt, pkt->timeStamp, pkt->chunkId );
});
_pRtmpReader = src->getRing()->attach(getPoller());
@@ -210,7 +210,7 @@ inline void RtmpPusher::send_metaData(){
if(!strongSelf) {
return;
}
strongSelf->sendRtmp(pkt->typeId, strongSelf->_ui32StreamId, pkt->strBuf, pkt->timeStamp, pkt->chunkId);
strongSelf->sendRtmp(pkt->typeId, strongSelf->_ui32StreamId, pkt, pkt->timeStamp, pkt->chunkId);
});
_pRtmpReader->setDetachCB([weakSelf](){
auto strongSelf = weakSelf.lock();