| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_BROWSER_MEDIA_CAPTURE_CAPTURE_RESOLUTION_CHOOSER_H_ | 5 #ifndef MEDIA_CAPTURE_CAPTURE_RESOLUTION_CHOOSER_H_ |
| 6 #define CONTENT_BROWSER_MEDIA_CAPTURE_CAPTURE_RESOLUTION_CHOOSER_H_ | 6 #define MEDIA_CAPTURE_CAPTURE_RESOLUTION_CHOOSER_H_ |
| 7 | 7 |
| 8 #include "content/common/content_export.h" | 8 #include "media/base/media_export.h" |
| 9 #include "media/base/video_capture_types.h" | 9 #include "media/base/video_capture_types.h" |
| 10 #include "ui/gfx/geometry/size.h" | 10 #include "ui/gfx/geometry/size.h" |
| 11 | 11 |
| 12 namespace content { | 12 namespace media { |
| 13 | 13 |
| 14 // Encapsulates the logic that determines the capture frame resolution based on: | 14 // Encapsulates the logic that determines the capture frame resolution based on: |
| 15 // 1. The configured maximum frame resolution and resolution change policy. | 15 // 1. The configured maximum frame resolution and resolution change policy. |
| 16 // 2. The resolution of the source content. | 16 // 2. The resolution of the source content. |
| 17 // 3. The current capabilities of the end-to-end system, in terms of the | 17 // 3. The current capabilities of the end-to-end system, in terms of the |
| 18 // maximum number of pixels per frame. | 18 // maximum number of pixels per frame. |
| 19 class CONTENT_EXPORT CaptureResolutionChooser { | 19 class MEDIA_EXPORT CaptureResolutionChooser { |
| 20 public: | 20 public: |
| 21 // media::ResolutionChangePolicy determines whether the variable frame | 21 // media::ResolutionChangePolicy determines whether the variable frame |
| 22 // resolutions being computed must adhere to a fixed aspect ratio or not, or | 22 // resolutions being computed must adhere to a fixed aspect ratio or not, or |
| 23 // that there must only be a single fixed resolution. | 23 // that there must only be a single fixed resolution. |
| 24 CaptureResolutionChooser( | 24 CaptureResolutionChooser( |
| 25 const gfx::Size& max_frame_size, | 25 const gfx::Size& max_frame_size, |
| 26 media::ResolutionChangePolicy resolution_change_policy); | 26 ResolutionChangePolicy resolution_change_policy); |
| 27 ~CaptureResolutionChooser(); | 27 ~CaptureResolutionChooser(); |
| 28 | 28 |
| 29 // Returns the current capture frame resolution to use. | 29 // Returns the current capture frame resolution to use. |
| 30 gfx::Size capture_size() const { | 30 gfx::Size capture_size() const { |
| 31 return capture_size_; | 31 return capture_size_; |
| 32 } | 32 } |
| 33 | 33 |
| 34 // Updates the capture size based on a change in the resolution of the source | 34 // Updates the capture size based on a change in the resolution of the source |
| 35 // content. | 35 // content. |
| 36 void SetSourceSize(const gfx::Size& source_size); | 36 void SetSourceSize(const gfx::Size& source_size); |
| 37 | 37 |
| 38 private: | 38 private: |
| 39 // Called after any update that requires |capture_size_| be re-computed. | 39 // Called after any update that requires |capture_size_| be re-computed. |
| 40 void RecomputeCaptureSize(); | 40 void RecomputeCaptureSize(); |
| 41 | 41 |
| 42 // Hard constraints. | 42 // Hard constraints. |
| 43 const gfx::Size max_frame_size_; | 43 const gfx::Size max_frame_size_; |
| 44 const gfx::Size min_frame_size_; // Computed from the ctor arguments. | 44 const gfx::Size min_frame_size_; // Computed from the ctor arguments. |
| 45 | 45 |
| 46 // Specifies the set of heuristics to use. | 46 // Specifies the set of heuristics to use. |
| 47 const media::ResolutionChangePolicy resolution_change_policy_; | 47 const ResolutionChangePolicy resolution_change_policy_; |
| 48 | 48 |
| 49 // The capture frame resolution to use, ignoring the limitations imposed by | 49 // The capture frame resolution to use, ignoring the limitations imposed by |
| 50 // the capability metric. | 50 // the capability metric. |
| 51 gfx::Size constrained_size_; | 51 gfx::Size constrained_size_; |
| 52 | 52 |
| 53 // The current computed capture frame resolution. | 53 // The current computed capture frame resolution. |
| 54 gfx::Size capture_size_; | 54 gfx::Size capture_size_; |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 } // namespace content | 57 } // namespace media |
| 58 | 58 |
| 59 #endif // CONTENT_BROWSER_MEDIA_CAPTURE_RESOLUTION_CHOOSER_H_ | 59 #endif // MEDIA_CAPTURE_RESOLUTION_CHOOSER_H_ |
| OLD | NEW |