Cleanup LockedPacket, use RAII

pull/4202/head
Isaac Connor 2022-02-08 10:10:00 -05:00
parent b552436375
commit 10d8ccf244
1 changed files with 2 additions and 5 deletions

View File

@ -126,10 +126,9 @@ bool PacketQueue::queuePacket(std::shared_ptr<ZMPacket> add_packet) {
) { ) {
std::shared_ptr <ZMPacket>zm_packet = *it; std::shared_ptr <ZMPacket>zm_packet = *it;
ZMLockedPacket *lp = new ZMLockedPacket(zm_packet); ZMLockedPacket lp(zm_packet);
if (!lp->trylock()) { if (!lp.trylock()) {
Warning("Found locked packet when trying to free up video packets. This basically means that decoding is not keeping up."); Warning("Found locked packet when trying to free up video packets. This basically means that decoding is not keeping up.");
delete lp;
++it; ++it;
continue; continue;
} }
@ -158,8 +157,6 @@ bool PacketQueue::queuePacket(std::shared_ptr<ZMPacket> add_packet) {
max_video_packet_count, max_video_packet_count,
pktQueue.size()); pktQueue.size());
delete lp;
if (zm_packet->packet.stream_index == video_stream_id) if (zm_packet->packet.stream_index == video_stream_id)
break; break;
} // end while } // end while