webrtc-sdk / libwebrtc

A C++ wrapper for binary release, mainly used for flutter-webrtc desktop (windows, linux, embedded).
MIT License
382 stars 78 forks source link

[windows] Crash accessing video camera if the camera is used by other app #18

Closed ashellunts closed 2 years ago

ashellunts commented 2 years ago

Crash occurs when calling base_->factory_->CreateVideoTrack(source, uuid.c_str()); in FlutterMediaStream::GetUserVideo.

Crash is inside libwebrtc. Also there is no (or I don't see) a way to understand that camera is busy and don't call createVideoTrack.

cloudwebrtc commented 2 years ago

I think this needs to be traced to the video capture device level to find a solution.

https://github.com/webrtc-sdk/webrtc/tree/main/modules/video_capture/windows

cloudwebrtc commented 2 years ago

1, If flutter-webrtc itself needs to create video capture multiple times, we need a video capture proxy to allow multiple sinks to capture the camera

2,If other applications occupy the camera, we can only inform the user that the camera cannot be obtained and prevent the crash from occurring.

ashellunts commented 2 years ago

Sounds good 👍

ashellunts commented 2 years ago

Currently https://github.com/webrtc-sdk/webrtc/blob/main/test/vcm_capturer.h is used for capturing on windows. Will try to fix the bug if it takes not too long.