mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
RTC: Apply RTP packet cache manager
This commit is contained in:
parent
86f43d4f72
commit
4cb3a18d1e
5 changed files with 100 additions and 58 deletions
|
@ -49,7 +49,7 @@ SrsRtpRingBuffer::~SrsRtpRingBuffer()
|
|||
{
|
||||
for (int i = 0; i < capacity_; ++i) {
|
||||
SrsRtpPacket2* pkt = queue_[i];
|
||||
srs_freep(pkt);
|
||||
_srs_rtp_cache->recycle(pkt);
|
||||
}
|
||||
srs_freepa(queue_);
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ void SrsRtpRingBuffer::set(uint16_t at, SrsRtpPacket2* pkt)
|
|||
SrsRtpPacket2* p = queue_[at % capacity_];
|
||||
|
||||
if (p) {
|
||||
srs_freep(p);
|
||||
_srs_rtp_cache->recycle(p);
|
||||
}
|
||||
|
||||
queue_[at % capacity_] = pkt;
|
||||
|
@ -164,7 +164,7 @@ void SrsRtpRingBuffer::clear_histroy(uint16_t seq)
|
|||
for (uint16_t i = 0; i < capacity_; i++) {
|
||||
SrsRtpPacket2* p = queue_[i];
|
||||
if (p && p->header.get_sequence() < seq) {
|
||||
srs_freep(p);
|
||||
_srs_rtp_cache->recycle(p);
|
||||
queue_[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -175,7 +175,7 @@ void SrsRtpRingBuffer::clear_all_histroy()
|
|||
for (uint16_t i = 0; i < capacity_; i++) {
|
||||
SrsRtpPacket2* p = queue_[i];
|
||||
if (p) {
|
||||
srs_freep(p);
|
||||
_srs_rtp_cache->recycle(p);
|
||||
queue_[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue