In this section where we handle full queues...
|
if (!camInstance.seqMode_){ |
|
if ((int)camInstance.frameQueue_.size() >= camInstance.buffer_frame_count_) { |
|
//printf("Queue size: %zd",camInstance.frameQueue_.size()); |
|
//printf("Buffer size: %zd",camInstance.buffer_frame_count_); |
|
camInstance.frameQueue_.pop(); |
|
printf("Lost frame\n"); |
|
} |
|
} |
|
|
|
frame.count = camInstance.frameCnt_; |
|
camInstance.frameQueue_.push(frame); |
|
camInstance.newData_ = true; |
... I believe we should reduce the queue size down to (camInstance.buffer_frame_count_-1) , not just by -1. Imagine that the system is temporarily overloaded and the queue size grows multiple items beyond camInstance.buffer_frame_count_. It has no chance of getting reduced again because a few lines further down we always push one frame back in.
So I believe we need a while loop
if ((int)camInstance.frameQueue_.size() >= camInstance.buffer_frame_count_) {
int n_dropped = 0
while ((int)camInstance.frameQueue_.size() >= camInstance.buffer_frame_count_) {
camInstance.frameQueue_.pop();
n_dropped++
}
printf("Dropped %zd frame(s)\n", n_dropped);
}
In this section where we handle full queues...
PyVCAM/src/pyvcam/pvcmodule.cpp
Lines 291 to 302 in 06f7eee
... I believe we should reduce the queue size down to (
camInstance.buffer_frame_count_-1) , not just by-1. Imagine that the system is temporarily overloaded and the queue size grows multiple items beyondcamInstance.buffer_frame_count_. It has no chance of getting reduced again because a few lines further down we always push one frame back in.So I believe we need a while loop