From 5036aa5ec556adfb2603cec1b1e1bfebdde02627 Mon Sep 17 00:00:00 2001 From: xia-chu <771730766@qq.com> Date: Fri, 22 Mar 2024 20:29:22 +0800 Subject: [PATCH] BugFix: crashes when exceptions are thrown during destruction #3402 --- src/Rtmp/RtmpMediaSourceMuxer.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Rtmp/RtmpMediaSourceMuxer.h b/src/Rtmp/RtmpMediaSourceMuxer.h index 6572fae5..1d16d5de 100644 --- a/src/Rtmp/RtmpMediaSourceMuxer.h +++ b/src/Rtmp/RtmpMediaSourceMuxer.h @@ -29,7 +29,13 @@ public: getRtmpRing()->setDelegate(_media_src); } - ~RtmpMediaSourceMuxer() override { RtmpMuxer::flush(); } + ~RtmpMediaSourceMuxer() override { + try { + RtmpMuxer::flush(); + } catch (std::exception &ex) { + WarnL << ex.what(); + } + } void setListener(const std::weak_ptr &listener){ setDelegate(listener);