修复MediaSource::close线程安全问题

主动或无人观看关闭流可能会由于线程安全问题导致崩溃
This commit is contained in:
xia-chu
2025-09-09 21:59:43 +08:00
parent c89caf560a
commit 5686027fc2
9 changed files with 23 additions and 49 deletions

View File

@@ -634,7 +634,10 @@ void installWebHook() {
// 边沿站无人观看时如果是拉流的则立即停止溯源 [AUTO-TRANSLATED:a1429c77]
// If no one is watching at the edge station, stop tracing immediately if it is pulling
if (!auto_close) {
sender.close(false);
auto ptr = sender.shared_from_this();
sender.getOwnerPoller()->async([ptr]() {
ptr->close(false);
});
WarnL << "Auto close stream when none reader: " << sender.getOriginUrl();
}
return;
@@ -661,7 +664,7 @@ void installWebHook() {
if (!flag || !err.empty() || !strongSrc) {
return;
}
strongSrc->close(false);
strongSrc->getOwnerPoller()->async([strongSrc]() { strongSrc->close(false); });
WarnL << "无人观看主动关闭流:" << strongSrc->getOriginUrl();
});
});