无人观看定时器指定为MediaSource对象所属poller以确保读取观看数是线程安全的

This commit is contained in:
custompal 2022-06-17 18:21:00 +08:00
parent 260b3ff02c
commit 3e62775db7

View File

@ -581,7 +581,7 @@ MediaSource::Ptr MediaSource::createFromMP4(const string &schema, const string &
/////////////////////////////////////MediaSourceEvent//////////////////////////////////////
void MediaSourceEvent::onReaderChanged(MediaSource &sender, int size){
if (size || totalReaderCount(sender)) {
if (size) {
//还有人观看该视频,不触发关闭事件
_async_close_timer = nullptr;
return;
@ -618,7 +618,7 @@ void MediaSourceEvent::onReaderChanged(MediaSource &sender, int size){
strong_sender->close(false);
}
return false;
}, nullptr);
}, getOwnerPoller(sender));
}
string MediaSourceEvent::getOriginUrl(MediaSource &sender) const {