修复hls流注销时相关bug:#2082

This commit is contained in:
xiongziliang 2022-11-12 09:57:47 +08:00
parent a37268f003
commit b54f50c7c0
2 changed files with 4 additions and 1 deletions

View File

@ -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) {

View File

@ -321,6 +321,7 @@ private:
std::string _app;
std::string _stream_id;
std::weak_ptr<MediaSourceEvent> _listener;
toolkit::EventPoller::Ptr _default_poller;
// 对象个数统计
toolkit::ObjectStatistic<MediaSource> _statistic;
};