From 2206b031a9a708186ff42813bee6c227013df081 Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Sat, 4 Nov 2023 22:24:55 +0800 Subject: [PATCH] =?UTF-8?q?=E9=98=B2=E6=AD=A2=E6=9E=90=E6=9E=84=E6=97=B6?= =?UTF-8?q?=E6=8A=9B=E5=BC=82=E5=B8=B8=E5=AF=BC=E8=87=B4=E7=9A=84=E5=B4=A9?= =?UTF-8?q?=E6=BA=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Record/MP4Recorder.cpp | 8 ++++++-- src/TS/TSMediaSourceMuxer.h | 8 +++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/Record/MP4Recorder.cpp b/src/Record/MP4Recorder.cpp index 5373b8a1..59a0d590 100644 --- a/src/Record/MP4Recorder.cpp +++ b/src/Record/MP4Recorder.cpp @@ -34,8 +34,12 @@ MP4Recorder::MP4Recorder(const string &path, const string &vhost, const string & } MP4Recorder::~MP4Recorder() { - flush(); - closeFile(); + try { + flush(); + closeFile(); + } catch (std::exception &ex) { + WarnL << ex.what(); + } } void MP4Recorder::createFile() { diff --git a/src/TS/TSMediaSourceMuxer.h b/src/TS/TSMediaSourceMuxer.h index 389ea901..cdf08fbb 100644 --- a/src/TS/TSMediaSourceMuxer.h +++ b/src/TS/TSMediaSourceMuxer.h @@ -26,7 +26,13 @@ public: _media_src = std::make_shared(tuple); } - ~TSMediaSourceMuxer() override { MpegMuxer::flush(); }; + ~TSMediaSourceMuxer() override { + try { + MpegMuxer::flush(); + } catch (std::exception &ex) { + WarnL << ex.what(); + } + }; void setListener(const std::weak_ptr &listener){ setDelegate(listener);