Hi,
we are using the RVMedia camera components in our Delphi application (AdvanTex ERP) and have run into an issue that we're struggling to reproduce reliably, so any hints would be greatly appreciated.
Problem description:
When a USB camera is used via RDP (Remote Desktop), the camera component at some point throws an "Interface not supported" error and can no longer be used within our application. The only recovery is a full restart of the station.
Importantly, after the error occurred, the same camera was tested using an external web-based tool and the camera was fully functional: reachable, live image smooth and without issues.
Stacktrace (from our internal bug report system):
main thread ($81e4):
004681b7 AdvanTex_CIA.exe System.SysUtils ErrorHandler
004079ee AdvanTex_CIA.exe System 1446 +0 ErrorAt
00407a32 AdvanTex_CIA.exe System 1446 +0 Error
034e6285 AdvanTex_CIA.exe MRVWinWebCamera 1602 +4 TRVWebCam.GetIAMCameraControl
034e642b AdvanTex_CIA.exe MRVWinWebCamera 1639 +5 TRVWebCam.UpdateCamControlProperties
034e6644 AdvanTex_CIA.exe MRVWinWebCamera 1692 +1 TRVWebCam.GetAvailableProperties
034fdddb AdvanTex_CIA.exe MRVCamera 5668 +12 TRVCamera.GetAccessibleCamMethods
034a1e4f AdvanTex_CIA.exe MRVCamView 1924 +86 TRVCamView.MouseMove
00629ec6 AdvanTex_CIA.exe Vcl.Controls TControl.WMMouseMove
006295b2 AdvanTex_CIA.exe Vcl.Controls TControl.WndProc
0062e507 AdvanTex_CIA.exe Vcl.Controls TWinControl.WndProc
0062da54 AdvanTex_CIA.exe Vcl.Controls TWinControl.MainWndProc
00514700 AdvanTex_CIA.exe System.Classes StdWndProc
7697651b USER32.dll DispatchMessageW
00755daf AdvanTex_CIA.exe Vcl.Forms TApplication.ProcessMessage
00755df2 AdvanTex_CIA.exe Vcl.Forms TApplication.HandleMessage
007511ce AdvanTex_CIA.exe Vcl.Forms TCustomForm.ShowModal
01f3e4ae AdvanTex_CIA.exe Adv_Forms 4844 +29 TAdvFormBasis.ShowModal
0351c0e7 AdvanTex_CIA.exe Form_CaptureWebCam 107 +11 CaptureWebCamForm
What we can see from the trace:
The error originates in 'TRVWebCam.GetIAMCameraControl', called from 'UpdateCamControlProperties' -> 'GetAvailableProperties' -> 'TRVCamera.GetAccessibleCamMethods'. Interestingly, the trigger is a simple 'MouseMove' event over the 'TRVCamView' control, so it appears the component queries camera control properties on mouse-over, and that is when the stale or invalidated interface pointer is exposed.
Questions:
1. Is there a known issue with the 'IAMCameraControl' interface becoming invalid during an RDP session?
2. Is there a recommended way to handle this gracefully in 'TRVCamView' / 'TRVCamera', for example catching the error and reinitializing the camera device instead of raising an unhandled exception?
3. Should we be proactively validating the camera interface before calling 'GetAvailableProperties' / 'GetIAMCameraControl', e.g. on re-entry into the camera dialog or on focus/activation events?
Any guidance on how to handle this scenario more robustly would be very much appreciated. Thanks in advance!
RVCamera Error during longer RDP Session
-
Sergey Tkachenko
- Site Admin
- Posts: 18147
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: RVCamera Error during longer RDP Session
After you assign a video device index, TRVCamera reads a list of camera properties only once. Later, it uses cached values.
So, I think this error may happen immediately after switching to another camera.
In the current version, RVMedia does detect changes in the list of available cameras. So, if you switch to an unavailable camera, it may be a problem.
Use RVCamera.UpdateVideoDeviceList to recreate a list of local cameras.
If you need, I can write a code that detects additions and removals of cameras.
So, I think this error may happen immediately after switching to another camera.
In the current version, RVMedia does detect changes in the list of available cameras. So, if you switch to an unavailable camera, it may be a problem.
Use RVCamera.UpdateVideoDeviceList to recreate a list of local cameras.
If you need, I can write a code that detects additions and removals of cameras.