OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_MEDIA_CAPTURE_CAPTURE_RESOLUTION_EVALUATOR_H_ |
| 6 #define CONTENT_BROWSER_MEDIA_CAPTURE_CAPTURE_RESOLUTION_EVALUATOR_H_ |
| 7 |
| 8 #include "content/common/content_export.h" |
| 9 #include "media/base/video_capture_types.h" |
| 10 #include "ui/gfx/geometry/size.h" |
| 11 |
| 12 namespace content { |
| 13 |
| 14 // Encapsulates the logic that determines the capture frame resolution based on: |
| 15 // 1. The configured maximum frame resolution and resolution change policy. |
| 16 // 2. The resolution of the source content. |
| 17 // 3. The current capabilities of the end-to-end system, in terms of data |
| 18 // volume. |
| 19 class CONTENT_EXPORT CaptureResolutionEvaluator { |
| 20 public: |
| 21 CaptureResolutionEvaluator( |
| 22 const gfx::Size& max_frame_size, |
| 23 media::ResolutionChangePolicy resolution_change_policy); |
| 24 ~CaptureResolutionEvaluator(); |
| 25 |
| 26 // Returns the current capture frame resolution to use. |
| 27 gfx::Size capture_size() const { |
| 28 return capture_size_; |
| 29 } |
| 30 |
| 31 // Updates the capture size based on a change in the resolution of the source |
| 32 // content. |
| 33 void UpdateForNewSourceSize(const gfx::Size& source_size); |
| 34 |
| 35 // Updates the capture size to one that satisfies the current capabilities of |
| 36 // the system, in terms of |num_pixels| per frame. |
| 37 void UpdateForNewCapabilityLimit(int num_pixels); |
| 38 |
| 39 private: |
| 40 // Called after any update that requires |capture_size_| be re-computed. |
| 41 void UpdateCaptureSize(); |
| 42 |
| 43 // Hard constraints. |
| 44 const gfx::Size max_frame_size_; |
| 45 const gfx::Size min_frame_size_; |
| 46 |
| 47 // Selects the set of heuristics to use. |
| 48 const media::ResolutionChangePolicy resolution_change_policy_; |
| 49 |
| 50 // The capture frame resolution to use, ignoring the limitations imposed by |
| 51 // the capability metric. |
| 52 gfx::Size ideal_capture_size_; |
| 53 |
| 54 // The last computed capture frame resolution. |
| 55 gfx::Size capture_size_; |
| 56 }; |
| 57 |
| 58 } // namespace content |
| 59 |
| 60 #endif // CONTENT_BROWSER_MEDIA_CAPTURE_RESOLUTION_EVALUATOR_H_ |
OLD | NEW |