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

Unified Diff: content/browser/media/capture/capture_resolution_evaluator.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: Addressed Dale's comments. 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
Index: content/browser/media/capture/capture_resolution_evaluator.h
diff --git a/content/browser/media/capture/capture_resolution_evaluator.h b/content/browser/media/capture/capture_resolution_evaluator.h
new file mode 100644
index 0000000000000000000000000000000000000000..bba51bb3f068db7c7816e6613d3bb83f1956281f
--- /dev/null
+++ b/content/browser/media/capture/capture_resolution_evaluator.h
@@ -0,0 +1,60 @@
+// 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_EVALUATOR_H_
+#define CONTENT_BROWSER_MEDIA_CAPTURE_CAPTURE_RESOLUTION_EVALUATOR_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 data
+// volume.
+class CONTENT_EXPORT CaptureResolutionEvaluator {
Wez 2015/05/13 19:05:08 nit: Evaluator doesn't seem the right name for thi
miu 2015/05/14 01:21:32 Done. I like "chooser," since an upcoming change
+ public:
+ CaptureResolutionEvaluator(
+ const gfx::Size& max_frame_size,
+ media::ResolutionChangePolicy resolution_change_policy);
Wez 2015/05/13 19:05:09 Suggest briefly explaining what resolution_change_
miu 2015/05/14 01:21:32 Done.
+ ~CaptureResolutionEvaluator();
+
+ // 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 UpdateForNewSourceSize(const gfx::Size& source_size);
Wez 2015/05/13 19:05:08 nit: I'd suggest naming these SetSourceSize() and
miu 2015/05/14 01:21:32 Done.
+
+ // Updates the capture size to one that satisfies the current capabilities of
+ // the system, in terms of |num_pixels| per frame.
Wez 2015/05/13 19:05:09 I think it'd be clearer to split what the function
miu 2015/05/14 01:21:32 Done. I liked your wording, so I plagiarized it.
+ void UpdateForNewCapabilityLimit(int num_pixels);
+
+ private:
+ // Called after any update that requires |capture_size_| be re-computed.
+ void UpdateCaptureSize();
Wez 2015/05/13 19:05:09 If you update the others to Set... then suggest th
miu 2015/05/14 01:21:32 Done.
+
+ // Hard constraints.
Wez 2015/05/13 19:05:08 Where does |min_frame_size_| come from - it doesn'
miu 2015/05/14 01:21:32 Done.
+ const gfx::Size max_frame_size_;
+ const gfx::Size min_frame_size_;
+
+ // Selects the set of heuristics to use.
Wez 2015/05/13 19:05:08 nit: Selects -> Specifies
miu 2015/05/14 01:21:32 Done.
+ const media::ResolutionChangePolicy resolution_change_policy_;
+
+ // The capture frame resolution to use, ignoring the limitations imposed by
+ // the capability metric.
Wez 2015/05/13 19:05:09 This isn't very clear; naively I'd assume this mus
miu 2015/05/14 01:21:32 Done. Agreed, I like your naming better.
+ gfx::Size ideal_capture_size_;
+
+ // The last computed capture frame resolution.
+ gfx::Size capture_size_;
Wez 2015/05/13 19:05:08 nit: "The current computed capture frame resolutio
miu 2015/05/14 01:21:32 Done.
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_MEDIA_CAPTURE_RESOLUTION_EVALUATOR_H_

Powered by Google App Engine
This is Rietveld 408576698