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

Unified Diff: content/browser/media/capture/capture_resolution_chooser.h

Issue 1135823004: Implement all resolution change policies for desktop and tab capture. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@resolution_change_policy_constraints_ITEM1_CR1
Patch Set: REBASE Created 5 years, 7 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/browser/media/capture/capture_resolution_chooser.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/media/capture/capture_resolution_chooser.h
diff --git a/content/browser/media/capture/capture_resolution_chooser.h b/content/browser/media/capture/capture_resolution_chooser.h
new file mode 100644
index 0000000000000000000000000000000000000000..f1bda79acb90346c5208c6ec40cdb57b43027b92
--- /dev/null
+++ b/content/browser/media/capture/capture_resolution_chooser.h
@@ -0,0 +1,59 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_BROWSER_MEDIA_CAPTURE_CAPTURE_RESOLUTION_CHOOSER_H_
+#define CONTENT_BROWSER_MEDIA_CAPTURE_CAPTURE_RESOLUTION_CHOOSER_H_
+
+#include "content/common/content_export.h"
+#include "media/base/video_capture_types.h"
+#include "ui/gfx/geometry/size.h"
+
+namespace content {
+
+// Encapsulates the logic that determines the capture frame resolution based on:
+// 1. The configured maximum frame resolution and resolution change policy.
+// 2. The resolution of the source content.
+// 3. The current capabilities of the end-to-end system, in terms of the
+// maximum number of pixels per frame.
+class CONTENT_EXPORT CaptureResolutionChooser {
+ public:
+ // media::ResolutionChangePolicy determines whether the variable frame
+ // resolutions being computed must adhere to a fixed aspect ratio or not, or
+ // that there must only be a single fixed resolution.
+ CaptureResolutionChooser(
+ const gfx::Size& max_frame_size,
+ media::ResolutionChangePolicy resolution_change_policy);
+ ~CaptureResolutionChooser();
+
+ // Returns the current capture frame resolution to use.
+ gfx::Size capture_size() const {
+ return capture_size_;
+ }
+
+ // Updates the capture size based on a change in the resolution of the source
+ // content.
+ void SetSourceSize(const gfx::Size& source_size);
+
+ private:
+ // Called after any update that requires |capture_size_| be re-computed.
+ void RecomputeCaptureSize();
+
+ // Hard constraints.
+ const gfx::Size max_frame_size_;
+ const gfx::Size min_frame_size_; // Computed from the ctor arguments.
+
+ // Specifies the set of heuristics to use.
+ const media::ResolutionChangePolicy resolution_change_policy_;
+
+ // The capture frame resolution to use, ignoring the limitations imposed by
+ // the capability metric.
+ gfx::Size constrained_size_;
+
+ // The current computed capture frame resolution.
+ gfx::Size capture_size_;
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_MEDIA_CAPTURE_RESOLUTION_CHOOSER_H_
« no previous file with comments | « no previous file | content/browser/media/capture/capture_resolution_chooser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698