mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
RTC: Fast copy shared message for RTP
This commit is contained in:
parent
9ee0ed919a
commit
4e474a24ce
4 changed files with 23 additions and 10 deletions
|
@ -361,14 +361,7 @@ SrsSharedPtrMessage* SrsSharedPtrMessage::copy()
|
|||
{
|
||||
srs_assert(ptr);
|
||||
|
||||
SrsSharedPtrMessage* copy = _srs_rtp_msg_cache_objs->allocate();
|
||||
|
||||
// We got an object from cache, the ptr might exists, so unwrap it.
|
||||
copy->unwrap();
|
||||
|
||||
// Reference to this message instead.
|
||||
copy->ptr = ptr;
|
||||
ptr->shared_count++;
|
||||
SrsSharedPtrMessage* copy = copy2();
|
||||
|
||||
copy->timestamp = timestamp;
|
||||
copy->stream_id = stream_id;
|
||||
|
@ -378,6 +371,20 @@ SrsSharedPtrMessage* SrsSharedPtrMessage::copy()
|
|||
return copy;
|
||||
}
|
||||
|
||||
SrsSharedPtrMessage* SrsSharedPtrMessage::copy2()
|
||||
{
|
||||
SrsSharedPtrMessage* copy = _srs_rtp_msg_cache_objs->allocate();
|
||||
|
||||
// We got an object from cache, the ptr might exists, so unwrap it.
|
||||
//srs_assert(!copy->ptr);
|
||||
|
||||
// Reference to this message instead.
|
||||
copy->ptr = ptr;
|
||||
ptr->shared_count++;
|
||||
|
||||
return copy;
|
||||
}
|
||||
|
||||
SrsFlvTransmuxer::SrsFlvTransmuxer()
|
||||
{
|
||||
writer = NULL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue