mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-07-28 21:14:03 +08:00
bugfix: MediaSource 经 listener->getMuxer() 的空指针竞态崩溃 (#4775)
This commit is contained in:
@@ -238,7 +238,10 @@ toolkit::EventPoller::Ptr MediaSource::getOwnerPoller() {
|
||||
|
||||
std::shared_ptr<MultiMediaSourceMuxer> MediaSource::getMuxer() const {
|
||||
auto listener = _listener.lock();
|
||||
return listener ? listener->getMuxer(const_cast<MediaSource&>(*this)) : nullptr;
|
||||
if (listener) {
|
||||
return listener->getMuxer(const_cast<MediaSource &>(*this));
|
||||
}
|
||||
throw std::runtime_error("MediaSourceEvent is empty");
|
||||
}
|
||||
|
||||
std::shared_ptr<RtpProcess> MediaSource::getRtpProcess() const {
|
||||
|
||||
@@ -96,7 +96,7 @@ public:
|
||||
|
||||
// 获取MultiMediaSourceMuxer对象 [AUTO-TRANSLATED:2de96d44]
|
||||
// Get MultiMediaSourceMuxer object
|
||||
virtual std::shared_ptr<MultiMediaSourceMuxer> getMuxer(MediaSource &sender) const { return nullptr; }
|
||||
virtual std::shared_ptr<MultiMediaSourceMuxer> getMuxer(MediaSource &sender) const { throw NotImplemented(toolkit::demangle(typeid(*this).name()) + "::getMuxer not implemented"); }
|
||||
// 获取RtpProcess对象 [AUTO-TRANSLATED:c6b7da43]
|
||||
// Get RtpProcess object
|
||||
virtual std::shared_ptr<RtpProcess> getRtpProcess(MediaSource &sender) const { return nullptr; }
|
||||
|
||||
Reference in New Issue
Block a user