예제 #1
0
        private void RefreshResolutionsAsync(ConfigChangedItem configChangedItem)
        {
            if (configChangedItem.value == NonExclusiveItem)
            {
                return;
            }

            Camera videoDeviceInfo = _sdkService.GetCameraInfo(configChangedItem.value);


            if (configChangedItem.key == ConfigItemKey.MainCamera)
            {
                if (videoDeviceInfo.CameraParameters.Count > 0)
                {
                    MeetingConfigParameter.UserCameraSetting.ResolutionList.Clear();

                    CameraParameter cameraParameter = videoDeviceInfo.CameraParameters[0];

                    foreach (Size t in cameraParameter.VideoSizes)
                    {
                        string resolution = $"{t.Width}*{t.Height}";

                        if (!MeetingConfigParameter.UserCameraSetting.ResolutionList.Contains(resolution))
                        {
                            MeetingConfigParameter.UserCameraSetting.ResolutionList.Add(resolution);
                        }
                    }
                }

                if (
                    MeetingConfigParameter.UserCameraSetting.ResolutionList.Contains(
                        GlobalData.Instance.AggregatedConfig.MainCamera.Resolution))
                {
                    MeetingConfigResult.MainCamera.Resolution =
                        GlobalData.Instance.AggregatedConfig.MainCamera.Resolution;
                }
                else if (MeetingConfigParameter.UserCameraSetting.ResolutionList.Count > 0)
                {
                    MeetingConfigResult.MainCamera.Resolution =
                        MeetingConfigParameter.UserCameraSetting.ResolutionList[0];
                }
            }

            if (configChangedItem.key == ConfigItemKey.SecondaryCamera)
            {
                if (videoDeviceInfo.CameraParameters.Count > 0)
                {
                    MeetingConfigParameter.DataCameraSetting.ResolutionList.Clear();

                    CameraParameter cameraParameter = videoDeviceInfo.CameraParameters[0];

                    foreach (Size t in cameraParameter.VideoSizes)
                    {
                        string resolution = $"{t.Width}*{t.Height}";

                        if (!MeetingConfigParameter.DataCameraSetting.ResolutionList.Contains(resolution))
                        {
                            MeetingConfigParameter.DataCameraSetting.ResolutionList.Add(resolution);
                        }
                    }
                }

                if (
                    MeetingConfigParameter.DataCameraSetting.ResolutionList.Contains(
                        GlobalData.Instance.AggregatedConfig.SecondaryCamera.Resolution))
                {
                    MeetingConfigResult.SecondaryCamera.Resolution =
                        GlobalData.Instance.AggregatedConfig.SecondaryCamera.Resolution;
                }
                else if (MeetingConfigParameter.DataCameraSetting.ResolutionList.Count > 0)
                {
                    MeetingConfigResult.SecondaryCamera.Resolution =
                        MeetingConfigParameter.DataCameraSetting.ResolutionList[0];
                }
            }
        }