| 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_CHOOSER_H_ | |
| 6 #define CONTENT_BROWSER_MEDIA_CAPTURE_CAPTURE_RESOLUTION_CHOOSER_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 the | |
| 18 // maximum number of pixels per frame. | |
| 19 class CONTENT_EXPORT CaptureResolutionChooser { | |
| 20 public: | |
| 21 // media::ResolutionChangePolicy determines whether the variable frame | |
| 22 // resolutions being computed must adhere to a fixed aspect ratio or not, or | |
| 23 // that there must only be a single fixed resolution. | |
| 24 CaptureResolutionChooser( | |
| 25 const gfx::Size& max_frame_size, | |
| 26 media::ResolutionChangePolicy resolution_change_policy); | |
| 27 ~CaptureResolutionChooser(); | |
| 28 | |
| 29 // Returns the current capture frame resolution to use. | |
| 30 gfx::Size capture_size() const { | |
| 31 return capture_size_; | |
| 32 } | |
| 33 | |
| 34 // Updates the capture size based on a change in the resolution of the source | |
| 35 // content. | |
| 36 void SetSourceSize(const gfx::Size& source_size); | |
| 37 | |
| 38 private: | |
| 39 // Called after any update that requires |capture_size_| be re-computed. | |
| 40 void RecomputeCaptureSize(); | |
| 41 | |
| 42 // Hard constraints. | |
| 43 const gfx::Size max_frame_size_; | |
| 44 const gfx::Size min_frame_size_; // Computed from the ctor arguments. | |
| 45 | |
| 46 // Specifies the set of heuristics to use. | |
| 47 const media::ResolutionChangePolicy resolution_change_policy_; | |
| 48 | |
| 49 // The capture frame resolution to use, ignoring the limitations imposed by | |
| 50 // the capability metric. | |
| 51 gfx::Size constrained_size_; | |
| 52 | |
| 53 // The current computed capture frame resolution. | |
| 54 gfx::Size capture_size_; | |
| 55 }; | |
| 56 | |
| 57 } // namespace content | |
| 58 | |
| 59 #endif // CONTENT_BROWSER_MEDIA_CAPTURE_RESOLUTION_CHOOSER_H_ | |
| OLD | NEW |