Cleanup LockedPacket, use RAII

This commit is contained in:
Isaac Connor 2022-02-08 10:10:00 -05:00
parent 8e689340ce
commit 8c13aa7d3a
1 changed files with 2 additions and 5 deletions

View File

@ -123,10 +123,9 @@ bool PacketQueue::queuePacket(std::shared_ptr<ZMPacket> add_packet) {
) {
std::shared_ptr <ZMPacket>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<ZMPacket> add_packet) {
max_video_packet_count,
pktQueue.size());
delete lp;
if (zm_packet->packet.stream_index == video_stream_id)
break;
} // end while