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