Skip to content

Commit

Permalink
RTC2RTMP
Browse files Browse the repository at this point in the history
* fix memory leak when replace rtp packet in cache.
  • Loading branch information
xiaozhihong committed Dec 6, 2021
1 parent 3eb8fa2 commit 0d95b85
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions trunk/src/app/srs_app_rtc_source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1437,6 +1437,7 @@ srs_error_t SrsRtmpFromRtcBridger::packet_video(SrsRtpPacket* src)
// store in cache
int index = cache_index(pkt->header.get_sequence());
cache_video_pkts_[index].in_use = true;
srs_freep(cache_video_pkts_[index].pkt);
cache_video_pkts_[index].pkt = pkt;
cache_video_pkts_[index].sn = pkt->header.get_sequence();
cache_video_pkts_[index].ts = pkt->get_avsync_time();
Expand Down Expand Up @@ -1526,6 +1527,7 @@ srs_error_t SrsRtmpFromRtcBridger::packet_video_key_frame(SrsRtpPacket* pkt)

uint16_t index = cache_index(pkt->header.get_sequence());
cache_video_pkts_[index].in_use = true;
srs_freep(cache_video_pkts_[index].pkt);
cache_video_pkts_[index].pkt = pkt;
cache_video_pkts_[index].sn = pkt->header.get_sequence();
cache_video_pkts_[index].ts = pkt->get_avsync_time();
Expand Down

0 comments on commit 0d95b85

Please sign in to comment.