From 2f6f35cf041bb9389bd99e0495adeb00119c268f Mon Sep 17 00:00:00 2001 From: Aline Gondim Santos <aline.gondimsantos@savoirfairelinux.com> Date: Mon, 15 Aug 2022 14:39:00 -0300 Subject: [PATCH] video device: recheck the video properties We could recheck for the video device capabilities whenever the devices list is requested. This can avoid having a virtualcamera, like OBS, with mismatching information from what is available on the system. GitLab: https://git.jami.net/savoirfairelinux/jami-client-qt/-/issues/747 Change-Id: I012cfb71e12c8e9965b9d112e3ff0488c7cb285c --- src/media/video/winvideo/video_device_impl.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/media/video/winvideo/video_device_impl.cpp b/src/media/video/winvideo/video_device_impl.cpp index adb752423b..a7efcaa7fb 100644 --- a/src/media/video/winvideo/video_device_impl.cpp +++ b/src/media/video/winvideo/video_device_impl.cpp @@ -57,10 +57,11 @@ public: DeviceParams getDeviceParams() const; void setDeviceParams(const DeviceParams&); + void setup(); + private: std::unique_ptr<CaptureGraphInterfaces> cInterface; - void setup(); std::vector<VideoSize> sizeList_; std::map<VideoSize, std::vector<FrameRate>> rateList_; std::map<VideoSize, AM_MEDIA_TYPE*> capMap_; @@ -80,6 +81,13 @@ VideoDeviceImpl::VideoDeviceImpl(const std::string& id) void VideoDeviceImpl::setup() { + // Add new size, rate, bitrate, and cap map. + sizeList_.clear(); + rateList_.clear(); + capMap_.clear(); + + cInterface.reset(new CaptureGraphInterfaces()); + if (id == DEVICE_DESKTOP) { name = DEVICE_DESKTOP; VideoSize size {0, 0}; @@ -357,6 +365,7 @@ VideoDevice::VideoDevice(const std::string& path, DeviceParams VideoDevice::getDeviceParams() const { + deviceImpl_->setup(); return deviceImpl_->getDeviceParams(); } -- GitLab