hls/http-ts播放器在消费完frame时再触发shutdown事件

This commit is contained in:
xiongziliang
2022-05-13 23:22:00 +08:00
parent d8b99101cf
commit fdbfccb32e
3 changed files with 32 additions and 8 deletions

View File

@@ -45,8 +45,15 @@ void TsPlayerImp::onPlayResult(const SockException &ex) {
}
void TsPlayerImp::onShutdown(const SockException &ex) {
PlayerImp<TsPlayer, PlayerBase>::onShutdown(ex);
_demuxer = nullptr;
if (_demuxer) {
std::weak_ptr<TsPlayerImp> weak_self = static_pointer_cast<TsPlayerImp>(shared_from_this());
static_pointer_cast<HlsDemuxer>(_demuxer)->pushTask([weak_self, ex]() {
auto strong_self = weak_self.lock();
if (strong_self) {
strong_self->PlayerImp<TsPlayer, PlayerBase>::onShutdown(ex);
}
});
}
}
vector<Track::Ptr> TsPlayerImp::getTracks(bool ready) const {