-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Troubleshooting scCreateCamera Failure. #64
Comments
Thank you for your interest and the detailed report! I noticed that you wrote in the issue explanation that the program completed running the loop without any hitches. However, the program's correct behavior is to keep sending frames. It stops only after about 30 minutes (100000 frames) or if you explicitly kill the process by, for example, pressing CTRL+C on the terminal or using the task manager. If the loop has been completed, the program prints a message Regarding the second point, I believe your plan would work. However, you should ensure that the file's format is exactly 24-bit BMP and the width and height are multiple of 4. |
Focusing on loop cycles and whether the sender completed all 100,000 iterations; I added a message to display the number of iterations completed by the sender. When a commercial software application I was using crashed unexpectedly, the sender couldn't finish its loop iterations and would stop before deleting the softcam instance. To troubleshoot, I reduced the loop iterations to 10,000 and found that the issue could be reproduced with this specific commercial software. If you're interested, I can share the name of that commercial application. After restarting the machine without using the same application, the sender worked and completed its tasks a few times. However, upon subsequent restarts, it failed again due to the softcam instance not being deleted properly, even though the sender had finished its loop iterations and attempted to delete the instance. Thanks for your help and support. |
Thank you for the investigation. So, when you are using that specific software the sender works only once, right? Now I think perhaps I can fix this issue. I will work on this issue later. |
That is true. |
While investigating the issue further, I discovered that the failure of the scCreateCam() function is caused by a specific inter-process shared memory handle. When I manually close this handle using Process Explorer, the scCreateCam() function starts working correctly and no longer fails. Interestingly, closing this handle does not cause any failures in the main application or the other application that is supposed to receive the shared memory data. Any pointers on what should be modified in the code to prevent this issue from occurring to ensure that scCreateCam() calls always succeed. Is it the SharedMemory class or the FrameBuffer class, or Both? The DLL itself is working perfectly, and everything else in the project is functioning as expected—this is the only issue that needs to be addressed for my situation. Thanks for your help, and I really appreciate the great work on this project! |
In Misc.cpp line 125: it seems that changing the line from if (m_handle && GetLastError() != ERROR_ALREADY_EXISTS) to if(m_handle) would solve the problem but the question is would that create problems over time and repeated usage? Thanks for your help. |
Thank you for giving further information! It might get in trouble if your sender application with the modification on the Misc.cpp somehow happens to be launched twice. The second instance needs to fail to create a new camera instance but the modification forces it to succeed. I still do not have confidence but I think your issue might be able to be reproduced if there exists a receiver application that creates an instance of Video Input Device but does not try to receive frames or stops receiving them without destructing the instance. I don't know if such an application could exist but such behavior would not be illegal. So, softcam has to work even if such an application exists. |
The building process was smooth without any issues. I initiated the demo sender program, and it connected and completed running the loop without any hitches. However, upon restarting the sender, it consistently fails because scCreateCamera always returns NULL. In the softcam.h file, it is mentioned that scCreateCamera would return null if another instance already exists in the system. Rebuilding the DLL or unregistering and re-registering again does not resolve the issue. I observed that the last image from the demo always appears in other application programs. I built and tested the win32 version and after the first successful run chaining the build type didn't resolve this issue. There were no modifications to the code in any way.
Upon restarting the machine the sender demo program works once and then it would start failing again for the same reason "scCreateCamera returns null".
My assumption is that if I load a .bmp file, extract its width and height after excluding the header information, I could simply transmit the bits to the softcam receiver. Since it is in RGB 24 format, the image should display correctly. Is this assumption accurate? Thank you for your assistance.
The text was updated successfully, but these errors were encountered: