From fd4f00dd6310ad1e7446d7d52b5f59eecdfb50dd Mon Sep 17 00:00:00 2001 From: xiongguangjie Date: Mon, 7 Apr 2025 20:50:03 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=9D=9E=E6=B3=95rtp?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=AF=BC=E8=87=B4=E7=A9=BA=E6=8C=87=E9=92=88?= =?UTF-8?q?=E5=B4=A9=E6=BA=83=E9=97=AE=E9=A2=98=20(#4226)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Rtsp/RtpReceiver.h | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Rtsp/RtpReceiver.h b/src/Rtsp/RtpReceiver.h index 4c9d10c8..8b9e4ba0 100644 --- a/src/Rtsp/RtpReceiver.h +++ b/src/Rtsp/RtpReceiver.h @@ -188,8 +188,14 @@ private: } iterator popIterator(iterator it) { - output(it->first, std::move(it->second)); - return _pkt_sort_cache_map.erase(it); + try { + output(it->first, std::move(it->second)); + return _pkt_sort_cache_map.erase(it); + } catch (...) { + // 防止抛异常未移除迭代器,导致rtp包为空 + _pkt_sort_cache_map.erase(it); + throw; + } } void output(SEQ seq, T packet) {