优化rtmp内存估算

This commit is contained in:
771730766@qq.com 2018-01-30 13:52:11 +08:00
parent a97b7ce701
commit 8f10cdbacd

View File

@ -202,7 +202,7 @@ void RtmpProtocol::sendRtmp(uint8_t ui8Type, uint32_t ui32StreamId,
set_le32(header.streamId, ui32StreamId); set_le32(header.streamId, ui32StreamId);
//估算rtmp包数据大小 //估算rtmp包数据大小
uint32_t capacity = ((bExtStamp ? 5 : 1) * ((strBuf.size() / m_iChunkLenOut))) + strBuf.size() + sizeof(header) + 32; uint32_t capacity = ((bExtStamp ? 5 : 1) * (1 + (strBuf.size() / m_iChunkLenOut))) + strBuf.size() + sizeof(header);
uint32_t totalSize = 0; uint32_t totalSize = 0;
Socket::BufferRaw::Ptr buffer = m_bufferPool.obtain(); Socket::BufferRaw::Ptr buffer = m_bufferPool.obtain();
buffer->setCapacity(capacity); buffer->setCapacity(capacity);