From 5a592e6db6af1b01b52f56354faebcc6a5f38d34 Mon Sep 17 00:00:00 2001 From: ziyue <1213642868@qq.com> Date: Thu, 6 Jan 2022 14:30:44 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=BE=AA=E7=8E=AF=E6=B1=A0?= =?UTF-8?q?=E6=80=A7=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 3rdpart/ZLToolKit | 2 +- src/Extension/Frame.h | 2 +- src/Http/HttpBody.cpp | 2 +- src/Record/MP4Demuxer.cpp | 2 +- src/Record/MPEG.cpp | 2 +- src/Rtmp/FlvMuxer.cpp | 2 +- src/Rtmp/Rtmp.cpp | 2 +- src/Rtmp/RtmpProtocol.cpp | 4 ++-- src/Rtsp/Rtsp.cpp | 2 +- webrtc/WebRtcTransport.cpp | 6 +++--- 10 files changed, 13 insertions(+), 13 deletions(-) diff --git a/3rdpart/ZLToolKit b/3rdpart/ZLToolKit index d04e9f8a..769f0191 160000 --- a/3rdpart/ZLToolKit +++ b/3rdpart/ZLToolKit @@ -1 +1 @@ -Subproject commit d04e9f8a111378ea5935cd9226b23ef9915e1941 +Subproject commit 769f01914970bd9021d59f3eba08233886abecb7 diff --git a/src/Extension/Frame.h b/src/Extension/Frame.h index 6d42928b..3e865750 100644 --- a/src/Extension/Frame.h +++ b/src/Extension/Frame.h @@ -185,7 +185,7 @@ public: static onceToken token([]() { packet_pool.setSize(1024); }); - auto ret = packet_pool.obtain(); + auto ret = packet_pool.obtain2(); ret->_buffer.clear(); ret->_prefix_size = 0; ret->_dts = 0; diff --git a/src/Http/HttpBody.cpp b/src/Http/HttpBody.cpp index fa1aaca2..14517c0f 100644 --- a/src/Http/HttpBody.cpp +++ b/src/Http/HttpBody.cpp @@ -129,7 +129,7 @@ Buffer::Ptr HttpFileBody::readData(size_t size) { if(!_map_addr){ //fread模式 ssize_t iRead; - auto ret = _pool.obtain(); + auto ret = _pool.obtain2(); ret->setCapacity(size + 1); do{ iRead = fread(ret->data(), 1, size, _fp.get()); diff --git a/src/Record/MP4Demuxer.cpp b/src/Record/MP4Demuxer.cpp index 90cbbc58..4db2278b 100644 --- a/src/Record/MP4Demuxer.cpp +++ b/src/Record/MP4Demuxer.cpp @@ -180,7 +180,7 @@ Frame::Ptr MP4Demuxer::readFrame(bool &keyFrame, bool &eof) { ctx->flags = flags; ctx->track_id = track_id; - ctx->buffer = ctx->thiz->_buffer_pool.obtain(); + ctx->buffer = ctx->thiz->_buffer_pool.obtain2(); ctx->buffer->setCapacity(bytes + DATA_OFFSET + 1); ctx->buffer->setSize(bytes + DATA_OFFSET); return ctx->buffer->data() + DATA_OFFSET; diff --git a/src/Record/MPEG.cpp b/src/Record/MPEG.cpp index 658d6700..c338b031 100644 --- a/src/Record/MPEG.cpp +++ b/src/Record/MPEG.cpp @@ -99,7 +99,7 @@ void MpegMuxer::createContext() { /*alloc*/ [](void *param, size_t bytes) { MpegMuxer *thiz = (MpegMuxer *) param; - thiz->_current_buffer = thiz->_buffer_pool.obtain();; + thiz->_current_buffer = thiz->_buffer_pool.obtain2(); thiz->_current_buffer->setCapacity(bytes + 1); return (void *) thiz->_current_buffer->data(); }, diff --git a/src/Rtmp/FlvMuxer.cpp b/src/Rtmp/FlvMuxer.cpp index ffcb9ef0..e59bbaca 100644 --- a/src/Rtmp/FlvMuxer.cpp +++ b/src/Rtmp/FlvMuxer.cpp @@ -72,7 +72,7 @@ void FlvMuxer::start(const EventPoller::Ptr &poller, const RtmpMediaSource::Ptr } BufferRaw::Ptr FlvMuxer::obtainBuffer() { - return _packet_pool.obtain(); + return _packet_pool.obtain2(); } BufferRaw::Ptr FlvMuxer::obtainBuffer(const void *data, size_t len) { diff --git a/src/Rtmp/Rtmp.cpp b/src/Rtmp/Rtmp.cpp index 451f54e9..97a5fa6e 100644 --- a/src/Rtmp/Rtmp.cpp +++ b/src/Rtmp/Rtmp.cpp @@ -138,7 +138,7 @@ RtmpPacket::Ptr RtmpPacket::create(){ static onceToken token([]() { packet_pool.setSize(1024); }); - auto ret = packet_pool.obtain(); + auto ret = packet_pool.obtain2(); ret->clear(); return ret; #else diff --git a/src/Rtmp/RtmpProtocol.cpp b/src/Rtmp/RtmpProtocol.cpp index 063e62f9..6f4c84a2 100644 --- a/src/Rtmp/RtmpProtocol.cpp +++ b/src/Rtmp/RtmpProtocol.cpp @@ -799,11 +799,11 @@ void RtmpProtocol::handle_chunk(RtmpPacket::Ptr packet) { } BufferRaw::Ptr RtmpProtocol::obtainBuffer(const void *data, size_t len) { - auto buffer = _packet_pool.obtain(); + auto buffer = _packet_pool.obtain2(); if (data && len) { buffer->assign((const char *) data, len); } - return std::move(buffer); + return buffer; } } /* namespace mediakit */ diff --git a/src/Rtsp/Rtsp.cpp b/src/Rtsp/Rtsp.cpp index 4912e3bd..0a7f4c35 100644 --- a/src/Rtsp/Rtsp.cpp +++ b/src/Rtsp/Rtsp.cpp @@ -555,7 +555,7 @@ RtpPacket::Ptr RtpPacket::create() { static onceToken token([]() { packet_pool.setSize(1024); }); - auto ret = packet_pool.obtain(); + auto ret = packet_pool.obtain2(); ret->setSize(0); return ret; #else diff --git a/webrtc/WebRtcTransport.cpp b/webrtc/WebRtcTransport.cpp index f6abf79e..7528dade 100644 --- a/webrtc/WebRtcTransport.cpp +++ b/webrtc/WebRtcTransport.cpp @@ -136,7 +136,7 @@ void WebRtcTransport::OnDtlsTransportApplicationDataReceived(const RTC::DtlsTran ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void WebRtcTransport::sendSockData(const char *buf, size_t len, RTC::TransportTuple *tuple){ - auto pkt = _packet_pool.obtain(); + auto pkt = _packet_pool.obtain2(); pkt->assign(buf, len); onSendSockData(std::move(pkt), true, tuple ? tuple : _ice_server->GetSelectedTuple()); } @@ -269,7 +269,7 @@ void WebRtcTransport::inputSockData(char *buf, int len, RTC::TransportTuple *tup void WebRtcTransport::sendRtpPacket(const char *buf, int len, bool flush, void *ctx) { if (_srtp_session_send) { - auto pkt = _packet_pool.obtain(); + auto pkt = _packet_pool.obtain2(); //预留rtx加入的两个字节 pkt->setCapacity((size_t) len + SRTP_MAX_TRAILER_LEN + 2); pkt->assign(buf, len); @@ -283,7 +283,7 @@ void WebRtcTransport::sendRtpPacket(const char *buf, int len, bool flush, void * void WebRtcTransport::sendRtcpPacket(const char *buf, int len, bool flush, void *ctx) { if (_srtp_session_send) { - auto pkt = _packet_pool.obtain(); + auto pkt = _packet_pool.obtain2(); //预留rtx加入的两个字节 pkt->setCapacity((size_t) len + SRTP_MAX_TRAILER_LEN + 2); pkt->assign(buf, len);