Video capture: update video format with capability index change
Changing capability index also means we are also changing the capture
format, otherwise we might use a different format under the hood, while
still comparing to the previous one and also at the end reporting wrong
format we found as best matching.
Bug: webrtc:405996231
Change-Id: Ia8e6262f9eda318f7f98d31fcf15ae1471638898
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/382700
Reviewed-by: Ilya Nikolaevskiy <ilnik@webrtc.org>
Commit-Queue: Jan Grulich <grulja@gmail.com>
Cr-Commit-Position: refs/heads/main@{#44245}
diff --git a/modules/video_capture/BUILD.gn b/modules/video_capture/BUILD.gn
index c15dced..22f5ff2 100644
--- a/modules/video_capture/BUILD.gn
+++ b/modules/video_capture/BUILD.gn
@@ -33,6 +33,7 @@
"../../api/video:video_frame",
"../../api/video:video_rtp_headers",
"../../common_video",
+ "../../rtc_base:checks",
"../../rtc_base:event_tracer",
"../../rtc_base:logging",
"../../rtc_base:macromagic",
diff --git a/modules/video_capture/device_info_impl.cc b/modules/video_capture/device_info_impl.cc
index d55ea6d..dc49d8a 100644
--- a/modules/video_capture/device_info_impl.cc
+++ b/modules/video_capture/device_info_impl.cc
@@ -12,9 +12,16 @@
#include <stdlib.h>
+#include <cstdint>
+
#include "absl/strings/match.h"
#include "absl/strings/string_view.h"
+#include "api/video/video_rotation.h"
+#include "common_video/libyuv/include/webrtc_libyuv.h"
+#include "modules/video_capture/video_capture_defines.h"
+#include "rtc_base/checks.h"
#include "rtc_base/logging.h"
+#include "rtc_base/synchronization/mutex.h"
#ifndef abs
#define abs(a) (a >= 0 ? a : -a)
@@ -158,6 +165,7 @@
if (capability.height == requested.height &&
capability.width == requested.width &&
capability.maxFPS >= requested.maxFPS) {
+ bestVideoType = capability.videoType;
bestformatIndex = tmp;
}
} else // Better frame rate