去除缓存池功能

This commit is contained in:
xiongziliang 2018-03-02 14:33:57 +08:00
parent 5988376647
commit 28cc1433e5
3 changed files with 7 additions and 4 deletions

View File

@ -396,8 +396,6 @@ inline HttpSession::HttpCode HttpSession::Handle_Req_GET() {
}); });
GET_CONFIG_AND_REGISTER(uint32_t,sendBufSize,Config::Http::kSendBufSize); GET_CONFIG_AND_REGISTER(uint32_t,sendBufSize,Config::Http::kSendBufSize);
//不允许主动丢包
_sock->setShouldDropPacket(false);
//缓存大小为两个包,太大可能导致发送时间太长从而超时 //缓存大小为两个包,太大可能导致发送时间太长从而超时
_sock->setSendPktSize(2); _sock->setSendPktSize(2);
weak_ptr<HttpSession> weakSelf = dynamic_pointer_cast<HttpSession>(shared_from_this()); weak_ptr<HttpSession> weakSelf = dynamic_pointer_cast<HttpSession>(shared_from_this());

View File

@ -207,7 +207,7 @@ void RtmpProtocol::sendRtmp(uint8_t ui8Type, uint32_t ui32StreamId,
//估算rtmp包数据大小 //估算rtmp包数据大小
uint32_t capacity = ((bExtStamp ? 5 : 1) * (1 + (strBuf.size() / m_iChunkLenOut))) + strBuf.size() + sizeof(header); uint32_t capacity = ((bExtStamp ? 5 : 1) * (1 + (strBuf.size() / m_iChunkLenOut))) + strBuf.size() + sizeof(header);
uint32_t totalSize = 0; uint32_t totalSize = 0;
BufferRaw::Ptr buffer = m_bufferPool.obtain(); BufferRaw::Ptr buffer = obtainBuffer();
buffer->setCapacity(capacity); buffer->setCapacity(capacity);
memcpy(buffer->data() + totalSize,(char *) &header, sizeof(header)); memcpy(buffer->data() + totalSize,(char *) &header, sizeof(header));
totalSize += sizeof(header); totalSize += sizeof(header);
@ -687,5 +687,9 @@ void RtmpProtocol::handle_rtmpChunk(RtmpPacket& chunkData) {
} }
} }
BufferRaw::Ptr RtmpProtocol::obtainBuffer() {
return std::make_shared<BufferRaw>() ;//_bufferPool.obtain();
}
} /* namespace Rtmp */ } /* namespace Rtmp */
} /* namespace ZL */ } /* namespace ZL */

View File

@ -85,7 +85,8 @@ protected:
int m_iNowStreamID = 0; int m_iNowStreamID = 0;
int m_iNowChunkID = 0; int m_iNowChunkID = 0;
bool m_bDataStarted = false; bool m_bDataStarted = false;
ResourcePool<BufferRaw,MAX_SEND_PKT> m_bufferPool; BufferRaw::Ptr obtainBuffer();
//ResourcePool<BufferRaw,MAX_SEND_PKT> m_bufferPool;
private: private:
void handle_S0S1S2(const function<void()> &cb); void handle_S0S1S2(const function<void()> &cb);
void handle_C0C1(); void handle_C0C1();