Skip to content

Commit 4c70655

Browse files
Log the # of packets removed
1 parent 014c35d commit 4c70655

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/zm_packetqueue.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,7 @@ void PacketQueue::clearPackets(const std::shared_ptr<ZMPacket> &add_packet) {
269269
Debug(1, "Tail count is %d, queue size is %zu, video_packets %d", tail_count, pktQueue.size(), packet_counts[video_stream_id]);
270270

271271
if (!keep_keyframes) {
272+
int packets_removed = 0;
272273
Debug(3, "Not keeping keyframes");
273274
// If not doing passthrough, we don't care about starting with a keyframe so logic is simpler
274275
while ((*pktQueue.begin() != add_packet) and (packet_counts[video_stream_id] > pre_event_video_packet_count + tail_count)) {
@@ -281,6 +282,7 @@ void PacketQueue::clearPackets(const std::shared_ptr<ZMPacket> &add_packet) {
281282
break;
282283
}
283284

285+
packets_removed ++;
284286
pktQueue.pop_front();
285287
int stream_index = zm_packet->packet ? zm_packet->packet->stream_index : 0;
286288
packet_counts[stream_index] -= 1;
@@ -293,8 +295,8 @@ void PacketQueue::clearPackets(const std::shared_ptr<ZMPacket> &add_packet) {
293295
pre_event_video_packet_count,
294296
pktQueue.size());
295297
} // end while
296-
Debug(3, "Done removing packets from queue. packet_counts %d >? pre_event %d + tail %d = %d",
297-
packet_counts[video_stream_id], pre_event_video_packet_count, tail_count, pre_event_video_packet_count + tail_count);
298+
Debug(3, "Done removing %d packets from queue. packet_counts %d >? pre_event %d + tail %d = %d",
299+
packets_removed, packet_counts[video_stream_id], pre_event_video_packet_count, tail_count, pre_event_video_packet_count + tail_count);
298300
return;
299301
}
300302

0 commit comments

Comments
 (0)