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

For #2142, Fix memory leak for bridger of RTC source stream. 4.0.61

This commit is contained in:
winlin 2021-01-15 14:16:32 +08:00
parent 50bb9eb391
commit 4e70bf5eaf
3 changed files with 60 additions and 24 deletions

View file

@ -55,6 +55,7 @@ class SrsRtpNackForReceiver;
class SrsJsonObject;
class SrsRtcPlayStreamStatistic;
class SrsErrorPithyPrint;
class SrsRtcDummyBridger;
class SrsNtp
{
@ -159,7 +160,7 @@ private:
SrsRequest* req;
ISrsRtcPublishStream* publish_stream_;
// Transmux RTMP to RTC.
ISrsSourceBridger* bridger_;
SrsRtcDummyBridger* bridger_;
// Steam description for this steam.
SrsRtcStreamDescription* stream_desc_;
private:
@ -264,14 +265,21 @@ private:
class SrsRtcDummyBridger : public ISrsSourceBridger
{
private:
SrsRtcStream* rtc_;
// The optional implementation bridger, ignore if NULL.
ISrsSourceBridger* impl_;
public:
SrsRtcDummyBridger();
SrsRtcDummyBridger(SrsRtcStream* s);
virtual ~SrsRtcDummyBridger();
public:
virtual srs_error_t on_publish();
virtual srs_error_t on_audio(SrsSharedPtrMessage* audio);
virtual srs_error_t on_video(SrsSharedPtrMessage* video);
virtual void on_unpublish();
public:
// Setup a new implementation bridger, which might be NULL to free previous one.
void setup(ISrsSourceBridger* impl);
};
// TODO: FIXME: Rename it.