diff --git a/trunk/src/kernel/srs_kernel_rtc_rtp.cpp b/trunk/src/kernel/srs_kernel_rtc_rtp.cpp index 80d6b8ff5..cbfe372af 100644 --- a/trunk/src/kernel/srs_kernel_rtc_rtp.cpp +++ b/trunk/src/kernel/srs_kernel_rtc_rtp.cpp @@ -766,7 +766,7 @@ SrsRtpPacket2::SrsRtpPacket2() { payload_ = NULL; payload_type_ = SrsRtpPacketPayloadTypeUnknown; - shared_buffer = NULL; + shared_buffer_ = NULL; actual_buffer_size_ = 0; nalu_type = SrsAvcNaluTypeReserved; @@ -823,29 +823,29 @@ cleanup: void SrsRtpPacket2::recycle_shared_buffer() { - if (!shared_buffer) { + if (!shared_buffer_) { return; } // Only recycle the message for UDP packets. - if (shared_buffer->payload && shared_buffer->size == kRtpPacketSize) { - if (_srs_rtp_msg_cache_objs->enabled() && shared_buffer->count() > 0) { + if (shared_buffer_->payload && shared_buffer_->size == kRtpPacketSize) { + if (_srs_rtp_msg_cache_objs->enabled() && shared_buffer_->count() > 0) { // Recycle the small shared message objects. - _srs_rtp_msg_cache_objs->recycle(shared_buffer); + _srs_rtp_msg_cache_objs->recycle(shared_buffer_); goto cleanup; } - if (_srs_rtp_msg_cache_buffers->enabled() && shared_buffer->count() == 0) { + if (_srs_rtp_msg_cache_buffers->enabled() && shared_buffer_->count() == 0) { // Recycle the UDP large buffer. - _srs_rtp_msg_cache_buffers->recycle(shared_buffer); + _srs_rtp_msg_cache_buffers->recycle(shared_buffer_); goto cleanup; } } - srs_freep(shared_buffer); + srs_freep(shared_buffer_); cleanup: - shared_buffer = NULL; + shared_buffer_ = NULL; actual_buffer_size_ = 0; } @@ -870,28 +870,28 @@ char* SrsRtpPacket2::wrap(int size) actual_buffer_size_ = size; // If the buffer is large enough, reuse it. - if (shared_buffer && shared_buffer->size >= size) { - return shared_buffer->payload; + if (shared_buffer_ && shared_buffer_->size >= size) { + return shared_buffer_->payload; } // Create a large enough message, with under-layer buffer. while (true) { - srs_freep(shared_buffer); - shared_buffer = _srs_rtp_msg_cache_buffers->allocate(); + srs_freep(shared_buffer_); + shared_buffer_ = _srs_rtp_msg_cache_buffers->allocate(); // If got a cached message(which has payload), but it's too small, // we free it and allocate a larger one. - if (shared_buffer->payload && shared_buffer->size < size) { + if (shared_buffer_->payload && shared_buffer_->size < size) { ++_srs_pps_objs_rothers->sugar; continue; } // Create under-layer buffer for new message - if (!shared_buffer->payload) { + if (!shared_buffer_->payload) { // For RTC, we use larger under-layer buffer for each packet. int nb_buffer = srs_max(size, kRtpPacketSize); char* buf = new char[nb_buffer]; - shared_buffer->wrap(buf, nb_buffer); + shared_buffer_->wrap(buf, nb_buffer); ++_srs_pps_objs_rbuf->sugar; } @@ -899,7 +899,7 @@ char* SrsRtpPacket2::wrap(int size) break; } - return shared_buffer->payload; + return shared_buffer_->payload; } char* SrsRtpPacket2::wrap(char* data, int size) @@ -914,12 +914,12 @@ char* SrsRtpPacket2::wrap(SrsSharedPtrMessage* msg) // Generally, the wrap(msg) is used for RTMP to RTC, which is not generated by RTC, // so we do not recycle the msg. It's ok to directly free the msg, event the msg is // allocated by object cache manager. - srs_freep(shared_buffer); + srs_freep(shared_buffer_); // Copy from the new message. - shared_buffer = msg->copy(); + shared_buffer_ = msg->copy(); // If we wrap a message, the size of packet equals to the message size. - actual_buffer_size_ = shared_buffer->size; + actual_buffer_size_ = shared_buffer_->size; return msg->payload; } @@ -931,14 +931,14 @@ SrsRtpPacket2* SrsRtpPacket2::copy() // We got packet from cache, the payload and message MUST be NULL, // because we had clear it in recycle. //srs_assert(!cp->payload_); - //srs_assert(!cp->shared_buffer); + //srs_assert(!cp->shared_buffer_); cp->header = header; cp->payload_ = payload_? payload_->copy():NULL; cp->payload_type_ = payload_type_; cp->nalu_type = nalu_type; - cp->shared_buffer = shared_buffer->copy2(); + cp->shared_buffer_ = shared_buffer_->copy2(); cp->actual_buffer_size_ = actual_buffer_size_; cp->frame_type = frame_type; diff --git a/trunk/src/kernel/srs_kernel_rtc_rtp.hpp b/trunk/src/kernel/srs_kernel_rtc_rtp.hpp index da885d4d5..5c29d67b5 100644 --- a/trunk/src/kernel/srs_kernel_rtc_rtp.hpp +++ b/trunk/src/kernel/srs_kernel_rtc_rtp.hpp @@ -290,7 +290,7 @@ private: private: // The original shared message, all RTP packets can refer to its data. // Note that the size of shared msg, is not the packet size, it's a larger aligned buffer. - SrsSharedPtrMessage* shared_buffer; + SrsSharedPtrMessage* shared_buffer_; // The size of original packet. int actual_buffer_size_; // Helper fields.