Describe the Bug
Mutex is not nicely released when getting a buffer from the background thread and there is not one queued. This is expressed as a random pause in the camera stream followed by a large number of frames coming through at once. The specific line of issue is this one. It blocks while trying to grab a buffer from the queue, but since it is holding the mutex, the queue can never be filled. The loop also never yields control to the background thread which is what causes the long pause.
To Reproduce
Steps to reproduce the behavior:
Make some tool to display frames from the camera and enable run_in_background
Force it to grab a frame when there is not one available. Can be done by grabbing faster than frame rate.
Observe the large pause as the thread cannot gain possession of the mutex to add to the buffer queue.
Expected Behavior
No pause, the mutex is released back to the background thread and it provides the next buffer.
Configuration
OS: Windows
Python: Python 3.6
Harvester: 1.3.2
GenTL Producer: MatrixVision
Camera: Flir Blackfly
Actions You Have Taken
I have tested a solution to the problem and will be making a related PR.
Describe the Bug Mutex is not nicely released when getting a buffer from the background thread and there is not one queued. This is expressed as a random pause in the camera stream followed by a large number of frames coming through at once. The specific line of issue is this one. It blocks while trying to grab a buffer from the queue, but since it is holding the mutex, the queue can never be filled. The loop also never yields control to the background thread which is what causes the long pause.
To Reproduce Steps to reproduce the behavior:
Expected Behavior No pause, the mutex is released back to the background thread and it provides the next buffer.
Configuration
Actions You Have Taken
I have tested a solution to the problem and will be making a related PR.
[X] I've read the Harvester FAQ page.
Additional context In my application, I have to always have the background thread on