修复RtpProcess析构导致的线程问题

This commit is contained in:
ziyue
2022-11-01 16:05:23 +08:00
parent f5a032c9a0
commit bfe118d94e
3 changed files with 17 additions and 2 deletions

View File

@@ -112,6 +112,13 @@ RtpProcessHelper::RtpProcessHelper(const string &stream_id, const weak_ptr<RtpSe
}
RtpProcessHelper::~RtpProcessHelper() {
auto process = std::move(_process);
try {
// flush时确保线程安全
process->getOwnerPoller(MediaSource::NullMediaSource())->async([process]() { process->flush(); });
} catch (...) {
// 忽略getOwnerPoller可能抛出的异常
}
}
void RtpProcessHelper::attachEvent() {