From 28cc1433e512ae2f019a85d5c277634ccd33ea05 Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Fri, 2 Mar 2018 14:33:57 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E7=BC=93=E5=AD=98=E6=B1=A0?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Http/HttpSession.cpp | 2 -- src/Rtmp/RtmpProtocol.cpp | 6 +++++- src/Rtmp/RtmpProtocol.h | 3 ++- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Http/HttpSession.cpp b/src/Http/HttpSession.cpp index 21b0d226..984ec9dd 100644 --- a/src/Http/HttpSession.cpp +++ b/src/Http/HttpSession.cpp @@ -396,8 +396,6 @@ inline HttpSession::HttpCode HttpSession::Handle_Req_GET() { }); GET_CONFIG_AND_REGISTER(uint32_t,sendBufSize,Config::Http::kSendBufSize); - //不允许主动丢包 - _sock->setShouldDropPacket(false); //缓存大小为两个包,太大可能导致发送时间太长从而超时 _sock->setSendPktSize(2); weak_ptr weakSelf = dynamic_pointer_cast(shared_from_this()); diff --git a/src/Rtmp/RtmpProtocol.cpp b/src/Rtmp/RtmpProtocol.cpp index 4605628b..edc07ae2 100644 --- a/src/Rtmp/RtmpProtocol.cpp +++ b/src/Rtmp/RtmpProtocol.cpp @@ -207,7 +207,7 @@ void RtmpProtocol::sendRtmp(uint8_t ui8Type, uint32_t ui32StreamId, //估算rtmp包数据大小 uint32_t capacity = ((bExtStamp ? 5 : 1) * (1 + (strBuf.size() / m_iChunkLenOut))) + strBuf.size() + sizeof(header); uint32_t totalSize = 0; - BufferRaw::Ptr buffer = m_bufferPool.obtain(); + BufferRaw::Ptr buffer = obtainBuffer(); buffer->setCapacity(capacity); memcpy(buffer->data() + totalSize,(char *) &header, sizeof(header)); totalSize += sizeof(header); @@ -687,5 +687,9 @@ void RtmpProtocol::handle_rtmpChunk(RtmpPacket& chunkData) { } } +BufferRaw::Ptr RtmpProtocol::obtainBuffer() { + return std::make_shared() ;//_bufferPool.obtain(); +} + } /* namespace Rtmp */ } /* namespace ZL */ diff --git a/src/Rtmp/RtmpProtocol.h b/src/Rtmp/RtmpProtocol.h index 3f09a123..88fb05ae 100644 --- a/src/Rtmp/RtmpProtocol.h +++ b/src/Rtmp/RtmpProtocol.h @@ -85,7 +85,8 @@ protected: int m_iNowStreamID = 0; int m_iNowChunkID = 0; bool m_bDataStarted = false; - ResourcePool m_bufferPool; + BufferRaw::Ptr obtainBuffer(); + //ResourcePool m_bufferPool; private: void handle_S0S1S2(const function &cb); void handle_C0C1();