Move the logic of whether to queue a packet into packetqueue::queuePacket
This commit is contained in:
parent
0a1bd3537d
commit
393e8b582a
|
@ -2615,13 +2615,8 @@ int Monitor::Capture() {
|
|||
shared_data->last_write_time = packet->timestamp->tv_sec;
|
||||
image_count++;
|
||||
|
||||
if (GetFunction() != Function::MONITOR
|
||||
and (packetqueue.packet_count(video_stream_id) or packet->keyframe or event)) {
|
||||
Debug(2, "Have video packet for image index (%d), adding to queue", index);
|
||||
packetqueue.queuePacket(packet);
|
||||
} else {
|
||||
Debug(2, "Not queuing video packet for index (%d) packet count %d",
|
||||
index, packetqueue.packet_count(video_stream_id));
|
||||
// Will only be queued if there are iterators allocated in the queue.
|
||||
if ( !packetqueue.queuePacket(packet) ) {
|
||||
delete packet;
|
||||
}
|
||||
UpdateCaptureFPS();
|
||||
|
|
|
@ -72,6 +72,14 @@ PacketQueue::~PacketQueue() {
|
|||
|
||||
bool PacketQueue::queuePacket(ZMPacket* add_packet) {
|
||||
Debug(4, "packetqueue queuepacket %p %d", add_packet, add_packet->image_index);
|
||||
if (iterators.empty()) {
|
||||
Debug(4, "No iterators so no one needs us to queue packets.");
|
||||
return false;
|
||||
}
|
||||
if (!packet_counts[video_stream_id] and !add_packet->keyframe) {
|
||||
Debug(4, "No video keyframe so no one needs us to queue packets.");
|
||||
return false;
|
||||
}
|
||||
mutex.lock();
|
||||
|
||||
pktQueue.push_back(add_packet);
|
||||
|
|
Loading…
Reference in New Issue