mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
Perf: Refine the recycle RTP packet, user should reset it
This commit is contained in:
parent
b71cafea58
commit
8de201b635
4 changed files with 27 additions and 8 deletions
|
@ -1130,6 +1130,9 @@ srs_error_t SrsRtcPublishStream::on_rtp_plaintext(char* plaintext, int nb_plaint
|
|||
// Allocate packet form cache.
|
||||
SrsRtpPacket2* pkt = _srs_rtp_cache->allocate();
|
||||
|
||||
// It's better to reset it before decode it.
|
||||
pkt->reset();
|
||||
|
||||
// Copy the packet body.
|
||||
char* p = pkt->wrap(plaintext, nb_plaintext);
|
||||
|
||||
|
|
|
@ -589,6 +589,9 @@ std::vector<SrsRtcTrackDescription*> SrsRtcStream::get_track_desc(std::string ty
|
|||
SrsRtpPacketCacheHelper::SrsRtpPacketCacheHelper()
|
||||
{
|
||||
pkt = _srs_rtp_cache->allocate();
|
||||
|
||||
// We MUST reset the packet, when got from cache.
|
||||
pkt->reset();
|
||||
}
|
||||
|
||||
SrsRtpPacketCacheHelper::~SrsRtpPacketCacheHelper()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue