修复stopSendRtp后无法触发无人观看事件的问题

This commit is contained in:
xia-chu 2023-04-18 10:53:00 +08:00
parent a93a985ae5
commit f1438986ad

View File

@ -389,12 +389,11 @@ void MultiMediaSourceMuxer::createGopCacheIfNeed() {
return; return;
} }
weak_ptr<MultiMediaSourceMuxer> weak_self = shared_from_this(); weak_ptr<MultiMediaSourceMuxer> weak_self = shared_from_this();
_ring = std::make_shared<RingType>(1024, [weak_self](int size) { auto src = std::make_shared<MediaSourceForMuxer>(weak_self.lock());
auto strong_self = weak_self.lock(); _ring = std::make_shared<RingType>(1024, [weak_self, src](int size) {
if (strong_self) { if (auto strong_self = weak_self.lock()) {
// 切换到归属线程 // 切换到归属线程
strong_self->getOwnerPoller(MediaSource::NullMediaSource())->async([=]() { strong_self->getOwnerPoller(MediaSource::NullMediaSource())->async([=]() {
auto src = std::make_shared<MediaSourceForMuxer>(strong_self);
strong_self->onReaderChanged(*src, strong_self->totalReaderCount()); strong_self->onReaderChanged(*src, strong_self->totalReaderCount());
}); });
} }