Comments (5)
If no change added, below is the log. Up is normal close, down is WeChat unnormal close.
from windows-camera.
Hi @comor86, sorry for the delay in response, I was out for vacation and am back today. Indeed I would not advise that you shutdown the virtual camera upon stream stop :\ as this will lead to headaches when virtual camera user (i.e. an app on behalf of their consumer) stops then want to start again.
Looks like WeChat is keeping a hold onto the camera and not properly disposing of their camera handle when not using the camera which effectively locks the virtual camera from being used somewhere else (and the physical camera it wraps as well). If you use the API released in newer SDK, i.e.:
- asking for the MF_VIRTUALCAMERA_PROVIDE_ASSOCIATED_CAMERA_SOURCES
- then using the MF_VIRTUALCAMERA_ASSOCIATED_CAMERA_SOURCES to retrieve the IMFMediaSource of the target physical camera you wish to wrap
then the problem should be avoided. if not using this API then you would need to terminate the IMFMediaSource of the wrapped camera upon stopping the stream, and recreating it upon starting.. but this strategy would not guarantee success of recreating the device source of the wrapped camera if another app is holding onto it concurrently.
from windows-camera.
I wonder what this mean " If you use the API released in newer SDK"? I'm using SDK 10.0.22000.0.
According to the sample code, there is a comment about MF_VIRTUALCAMERA_PROVIDE_ASSOCIATED_CAMERA_SOURCES.
// The below 2 GUIDs are defined in Windows build 22621 and above only,
// if targetting SDK for Windows 22621 or higher this would need to be commented out.
// GUIDs for retrieving the device source instead of recreating it from within the vcam
DEFINE_GUID(MF_VIRTUALCAMERA_PROVIDE_ASSOCIATED_CAMERA_SOURCES,
0xF0273718, 0x4A4D, 0x4AC5, 0xA1, 0x5D, 0x30, 0x5E, 0xB5, 0xE9, 0x06, 0x67);
DEFINE_GUID(MF_VIRTUALCAMERA_ASSOCIATED_CAMERA_SOURCES,
0x1BB79E7C, 0x5D83, 0x438C, 0x94, 0xD8, 0xE5, 0xF0, 0xDF, 0x6D, 0x32, 0x79);
Does it mean that I can't use this two features on Windows 11 21H2, and could use them on 22H2? I have tried your suggestion and found that if (SUCCEEDED(m_spActivateAttributes->GetUnknown(MF_VIRTUALCAMERA_ASSOCIATED_CAMERA_SOURCES, IID_PPV_ARGS(&spCollection))))
didn't return S_OK, but RETURN_IF_FAILED(m_spActivateAttributes->SetUINT32(MF_VIRTUALCAMERA_PROVIDE_ASSOCIATED_CAMERA_SOURCES, 1));
actually called and return S_OK, so the problem still there.
from windows-camera.
There are 2 different topics to disambiguate:
- the SDK version your project targets (i.e. in the vcxproj that defines the minimum Windows version required to run this compiled binary)
- the OS version at runtime of the virtual camera consumer (an app/vcam built using 22000 SDK may run on Windows version 22000+).
This header defines GUID that are also defined in the 22621 SDK to opportunistically leverage functionalities available in Windows 22621 without changing the project target SDK version. That's why this comments says that if you change your project target to 22621, then you have to comment those GUID definition since they will conflict with the SDK defining them as well in a required header.
If this code runs on a machine updated to Windows 22621, then the line
if (SUCCEEDED(m_spActivateAttributes->GetUnknown(MF_VIRTUALCAMERA_ASSOCIATED_CAMERA_SOURCES, IID_PPV_ARGS(&spCollection))))
should return true and avoid the problem you exposed with WeChat. If running on Windows version 22000, then you can gracefully do something else meanwhile to accommodate the app not disposing properly of the camera when stopped and not in use.
If you can run exclusively on Windows 22621 and above then the problem would be avoided. If not, then you could put in place the aforementioned mitigation of disposing the of the IMFMediaSource on Stop, and recreating it upon start using again MFCreateDeviceSource()
(albeit with its set of caveats)
from windows-camera.
closing, please reopen if you encounter an issue still in your implementation
from windows-camera.
Related Issues (20)
- Error: 80040154:Class not registered HOT 3
- Doc: For Virtual Camera Sample, 'Microsoft Visual Studio Installer Project' extension is required for MSI project HOT 1
- Any question about VirtualCameraSimple project HOT 2
- Unable to install Virtual Camera on Windows 10 HOT 4
- Class not registered HOT 2
- AugmentedMediaSource not work HOT 3
- Can the virtual camera be accessed from multiple applications simultaneously? HOT 4
- This repo is missing important files
- [ExternalCameraSettingsAppSample][DefaultControlHelper] set DefaultValue error with Access is denied HOT 4
- RPC failed error with the code 0x800706BE when calling IMFVirtualCamera::Start HOT 4
- Win 11 22H2 has QR Code Reader HOT 1
- Debug output from avcore\mf\frameserver HOT 1
- Virtual Camera Sample Returns E_ACCESSDENIED in IMFVirtualCamera->Start HOT 3
- Can't get DefaultController when turning on the MEP Automatic Framing HOT 4
- Can't set default value of MEP Automatic Framing with DefaultController HOT 1
- How to register the VirtualCameraMediaSource DLL without the MSI? HOT 6
- How to run the example NetworkMediaStreamer? HOT 5
- How to send a frame into virtual camera? HOT 3
- 【NetworkMediaStreamer】Can this example run on UWP platform?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from windows-camera.