Image capture delivers empty result and finally goes to endless loop #136
Description
Hi,
first of all thank you for this great library! I have encountered a problem actually - and it might well be that I have misunderstood something here or used the library in a wrong way!
The scenario:
I try to capture an image every 5 seconds and store this to an Azure Blob storage. In a first step I went with the time lapse feature, but ditched that, because I could not find a way to resize the image before sending it to the capture handler. For this approach I created a dedicated AzureStorageCaptureHandler
that was based on the MemoryStreamCaptureHandler
while implementing the IFileStreamCaptureHandler
interface.
So I went and implemented my own mechanism. You can find a very stripped down implementation in the Spontifixus/mmalsharp-demo repository. The setup is derived from the "resizer component" example. In pseudo code it looks this way:
ConfigureCamera
For i = 0 To 100
memoryStreamHandler = new MemoryStreamCaptureHandler()
CaptureImage(memoryStreamHandler)
StoreImage(memoryStreamHandler)
memoryStreamHandler.Dispose()
Next
Expected behavior:
I expect the code to store 100 images, without capturing empty images, and without going into an endless loop.
Actual behavior
The application produces empty images every few captures and finally goes into an endless loop because a buffer cannot be released. Here's a log of the test run: debug.log, with the following interesting parts:
- Lines 105 - 154: Successful capture
- Lines 155 - 162: Successful storage
- Lines 495 - 542: Failed capture
- Lines 3051 - End: Capture Started, resulting in infinite loop.