防止对象析构时抛异常导致的崩溃

This commit is contained in:
xia-chu
2024-07-05 21:05:59 +08:00
parent 8815776b81
commit b4fecdc929
7 changed files with 56 additions and 8 deletions

View File

@@ -26,7 +26,13 @@ public:
_media_src = std::make_shared<FMP4MediaSource>(tuple);
}
~FMP4MediaSourceMuxer() override { MP4MuxerMemory::flush(); };
~FMP4MediaSourceMuxer() override {
try {
MP4MuxerMemory::flush();
} catch (std::exception &ex) {
WarnL << ex.what();
}
}
void setListener(const std::weak_ptr<MediaSourceEvent> &listener){
setDelegate(listener);