Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1933)

Unified Diff: content/renderer/media/media_stream_constraints_util_video_content.cc

Issue 2800343005: Update selection of resolution policy for screen capture with getUserMedia. (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/renderer/media/media_stream_constraints_util_video_content_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media/media_stream_constraints_util_video_content.cc
diff --git a/content/renderer/media/media_stream_constraints_util_video_content.cc b/content/renderer/media/media_stream_constraints_util_video_content.cc
index 3954477047fedcfd4a65c6cc41e680bf7d85ed15..a47db2a2fbe72c0e75184fec687eac5dfac02dc9 100644
--- a/content/renderer/media/media_stream_constraints_util_video_content.cc
+++ b/content/renderer/media/media_stream_constraints_util_video_content.cc
@@ -118,13 +118,26 @@ ResolutionSet ScreenCastResolutionCapabilities() {
media::ResolutionChangePolicy SelectResolutionPolicyFromCandidates(
const ResolutionSet& resolution_set) {
ResolutionSet capabilities = ScreenCastResolutionCapabilities();
+ // TODO(guidou): Since the real maximum screen resolution is not known, use
+ // max_width and max_height from |resolution_set| as the actual capability,
+ // if necessary, to decide the resolution policy. Update this to use the
+ // actual capability once the actual screen resolution is used as default.
+ // http://crbug.com/257097
+ int capabilities_max_height =
+ std::min(resolution_set.max_height(), capabilities.max_height());
+ int capabilities_max_width =
+ std::min(resolution_set.max_width(), capabilities.max_width());
+ double capabilities_min_aspect_ratio =
+ static_cast<double>(capabilities.min_width()) / capabilities_max_height;
+ double capabilities_max_aspect_ratio =
+ static_cast<double>(capabilities_max_width) / capabilities.min_height();
bool can_adjust_resolution =
resolution_set.min_height() <= capabilities.min_height() &&
- resolution_set.max_height() >= capabilities.max_height() &&
+ resolution_set.max_height() >= capabilities_max_height &&
resolution_set.min_width() <= capabilities.min_width() &&
- resolution_set.max_width() >= capabilities.max_width() &&
- resolution_set.min_aspect_ratio() <= capabilities.min_aspect_ratio() &&
- resolution_set.max_aspect_ratio() >= capabilities.max_aspect_ratio();
+ resolution_set.max_width() >= capabilities_max_width &&
+ resolution_set.min_aspect_ratio() <= capabilities_min_aspect_ratio &&
+ resolution_set.max_aspect_ratio() >= capabilities_max_aspect_ratio;
return can_adjust_resolution ? media::RESOLUTION_POLICY_ANY_WITHIN_LIMIT
: media::RESOLUTION_POLICY_FIXED_RESOLUTION;
« no previous file with comments | « no previous file | content/renderer/media/media_stream_constraints_util_video_content_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698