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; };