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

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

@@ -40,7 +40,13 @@ public:
TSMediaSource(const MediaTuple& tuple, int ring_size = TS_GOP_SIZE): MediaSource(TS_SCHEMA, tuple), _ring_size(ring_size) {}
~TSMediaSource() override { flush(); }
~TSMediaSource() override {
try {
flush();
} catch (std::exception &ex) {
WarnL << ex.what();
}
}
/**
* 获取媒体源的环形缓冲