From 8c13aa7d3ad1ed6ed504e4f3838b51d8c6d78df9 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Tue, 8 Feb 2022 10:10:00 -0500 Subject: [PATCH] Cleanup LockedPacket, use RAII --- src/zm_packetqueue.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/zm_packetqueue.cpp b/src/zm_packetqueue.cpp index 7daf0503d..d5407b05d 100644 --- a/src/zm_packetqueue.cpp +++ b/src/zm_packetqueue.cpp @@ -123,10 +123,9 @@ bool PacketQueue::queuePacket(std::shared_ptr add_packet) { ) { std::shared_ptr zm_packet = *it; - ZMLockedPacket *lp = new ZMLockedPacket(zm_packet); - if (!lp->trylock()) { + ZMLockedPacket lp(zm_packet); + if (!lp.trylock()) { Warning("Found locked packet when trying to free up video packets. This basically means that decoding is not keeping up."); - delete lp; ++it; continue; } @@ -155,8 +154,6 @@ bool PacketQueue::queuePacket(std::shared_ptr add_packet) { max_video_packet_count, pktQueue.size()); - delete lp; - if (zm_packet->packet.stream_index == video_stream_id) break; } // end while