From 0fb7cb935ffc4e9eebaf2c2a88c5e78ba984db8e Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Sun, 31 Jan 2021 11:42:51 -0500 Subject: [PATCH] Fix skipping over the head packet when deleting packets. --- src/zm_packetqueue.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/zm_packetqueue.cpp b/src/zm_packetqueue.cpp index 358885c61..6992df987 100644 --- a/src/zm_packetqueue.cpp +++ b/src/zm_packetqueue.cpp @@ -111,7 +111,6 @@ bool zm_packetqueue::queuePacket(ZMPacket* add_packet) { int video_stream_packets = 0; // Since we have many packets in the queue, we should NOT be pointing at end so don't need to test for that do { - it++; ZMPacket *zm_packet = *it; Debug(1, "Checking packet to see if we can delete them"); if ( zm_packet->packet.stream_index == video_stream_id ) { @@ -149,7 +148,7 @@ bool zm_packetqueue::queuePacket(ZMPacket* add_packet) { video_stream_packets = max_video_packet_count; } } // end foreach iterator - + it++; } while ( *it != add_packet ); Debug(1, "Resulting video_stream_packets count %d, %d > %d, pointing at latest packet? %d", video_stream_packets, @@ -448,6 +447,8 @@ ZMPacket *zm_packetqueue::get_packet(packetqueue_iterator *it) { if ( deleting or zm_terminate ) return nullptr; + Debug(4, "get_packet using it %p queue end? %d, packet %p", + *it, (*it == pktQueue.end()), *(*it)); ZMPacket *p = *(*it); if ( !p ) { Error("Null p?!");