From b54f50c7c0967ef021896c41f1350cd98123b014 Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Sat, 12 Nov 2022 09:57:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dhls=E6=B5=81=E6=B3=A8?= =?UTF-8?q?=E9=94=80=E6=97=B6=E7=9B=B8=E5=85=B3bug:#2082?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Common/MediaSource.cpp | 4 +++- src/Common/MediaSource.h | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Common/MediaSource.cpp b/src/Common/MediaSource.cpp index b1556efd..6c777a97 100644 --- a/src/Common/MediaSource.cpp +++ b/src/Common/MediaSource.cpp @@ -70,6 +70,7 @@ MediaSource::MediaSource(const string &schema, const string &vhost, const string _app = app; _stream_id = stream_id; _create_stamp = time(NULL); + _default_poller = EventPollerPool::Instance().getPoller(); } MediaSource::~MediaSource() { @@ -234,7 +235,8 @@ toolkit::EventPoller::Ptr MediaSource::getOwnerPoller() { if (listener) { return listener->getOwnerPoller(*this); } - throw std::runtime_error(toolkit::demangle(typeid(*this).name()) + "::getOwnerPoller failed:" + getUrl()); + WarnL << toolkit::demangle(typeid(*this).name()) + "::getOwnerPoller failed, now return default poller: " + getUrl(); + return _default_poller; } void MediaSource::onReaderChanged(int size) { diff --git a/src/Common/MediaSource.h b/src/Common/MediaSource.h index 3e3d45e3..aa168063 100644 --- a/src/Common/MediaSource.h +++ b/src/Common/MediaSource.h @@ -321,6 +321,7 @@ private: std::string _app; std::string _stream_id; std::weak_ptr _listener; + toolkit::EventPoller::Ptr _default_poller; // 对象个数统计 toolkit::ObjectStatistic _statistic; };