More debugging around clearQueue. return early if deleting

This commit is contained in:
Isaac Connor 2021-06-04 15:03:08 -04:00
parent 205c488741
commit b16eb510d0
1 changed files with 12 additions and 0 deletions

View File

@ -178,6 +178,8 @@ void PacketQueue::clearPackets(const std::shared_ptr<ZMPacket> &add_packet) {
// //
// So start at the beginning, counting video packets until the next keyframe. // So start at the beginning, counting video packets until the next keyframe.
// Then if deleting those packets doesn't break 1 and 2, then go ahead and delete them. // Then if deleting those packets doesn't break 1 and 2, then go ahead and delete them.
if (deleting) return;
if (keep_keyframes and ! ( if (keep_keyframes and ! (
add_packet->packet.stream_index == video_stream_id add_packet->packet.stream_index == video_stream_id
and and
@ -331,10 +333,19 @@ void PacketQueue::clear() {
// Someone might have this packet, but not for very long and since we have locked the queue they won't be able to get another one // Someone might have this packet, but not for very long and since we have locked the queue they won't be able to get another one
ZMLockedPacket *lp = new ZMLockedPacket(packet); ZMLockedPacket *lp = new ZMLockedPacket(packet);
lp->lock(); lp->lock();
Debug(1,
"Deleting a packet with stream index:%d image_index:%d with keyframe:%d, video frames in queue:%d max: %d, queuesize:%zu",
packet->packet.stream_index,
packet->image_index,
packet->keyframe,
packet_counts[video_stream_id],
pre_event_video_packet_count,
pktQueue.size());
pktQueue.pop_front(); pktQueue.pop_front();
delete lp; delete lp;
//delete packet; //delete packet;
} }
Debug(1, "Packetqueue is clear, deleting iterators");
for ( for (
std::list<packetqueue_iterator *>::iterator iterators_it = iterators.begin(); std::list<packetqueue_iterator *>::iterator iterators_it = iterators.begin();
@ -349,6 +360,7 @@ void PacketQueue::clear() {
packet_counts = nullptr; packet_counts = nullptr;
max_stream_id = -1; max_stream_id = -1;
Debug(1, "Packetqueue is clear, notifying");
condition.notify_all(); condition.notify_all();
} }