1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

RTC: Fix memory leak

This commit is contained in:
winlin 2020-12-30 16:03:28 +08:00
parent 03389f5e8c
commit 78fcaaf7b1
2 changed files with 20 additions and 2 deletions

View file

@ -481,6 +481,9 @@ void SrsRtcStream::on_unpublish()
h->on_unpublish();
}
// release unpublish stream description.
set_stream_desc(NULL);
// TODO: FIXME: Handle by statistic.
}
@ -527,7 +530,10 @@ srs_error_t SrsRtcStream::on_rtp(SrsRtpPacket2* pkt)
void SrsRtcStream::set_stream_desc(SrsRtcStreamDescription* stream_desc)
{
srs_freep(stream_desc_);
stream_desc_ = stream_desc->copy();
if (stream_desc) {
stream_desc_ = stream_desc->copy();
}
}
std::vector<SrsRtcTrackDescription*> SrsRtcStream::get_track_desc(std::string type, std::string media_name)