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 MEDIA_CAPTURE_CONTENT_CAPTURE_RESOLUTION_CHOOSER_H_ | 5 #ifndef MEDIA_CAPTURE_CONTENT_CAPTURE_RESOLUTION_CHOOSER_H_ |
6 #define MEDIA_CAPTURE_CONTENT_CAPTURE_RESOLUTION_CHOOSER_H_ | 6 #define MEDIA_CAPTURE_CONTENT_CAPTURE_RESOLUTION_CHOOSER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
| 10 #include "media/base/media_export.h" |
10 #include "media/base/video_capture_types.h" | 11 #include "media/base/video_capture_types.h" |
11 #include "media/capture/capture_export.h" | |
12 #include "ui/gfx/geometry/size.h" | 12 #include "ui/gfx/geometry/size.h" |
13 | 13 |
14 namespace media { | 14 namespace media { |
15 | 15 |
16 // Encapsulates the logic that determines the capture frame resolution based on: | 16 // Encapsulates the logic that determines the capture frame resolution based on: |
17 // 1. The configured maximum frame resolution and resolution change policy. | 17 // 1. The configured maximum frame resolution and resolution change policy. |
18 // 2. Changes to resolution of the source content. | 18 // 2. Changes to resolution of the source content. |
19 // 3. Changes to the (externally-computed) target data volume, provided in | 19 // 3. Changes to the (externally-computed) target data volume, provided in |
20 // terms of the number of pixels in the frame. | 20 // terms of the number of pixels in the frame. |
21 // | 21 // |
22 // CaptureResolutionChooser always computes capture sizes less than the maximum | 22 // CaptureResolutionChooser always computes capture sizes less than the maximum |
23 // frame size, and adheres to the configured resolution change policy. Within | 23 // frame size, and adheres to the configured resolution change policy. Within |
24 // those hard limits, the capture size is computed to be as close to the | 24 // those hard limits, the capture size is computed to be as close to the |
25 // targeted frame area as possible. | 25 // targeted frame area as possible. |
26 // | 26 // |
27 // In variable-resolution use cases, the capture sizes are "snapped" to a small | 27 // In variable-resolution use cases, the capture sizes are "snapped" to a small |
28 // (i.e., usually less than a dozen) set of possibilities. This is to prevent | 28 // (i.e., usually less than a dozen) set of possibilities. This is to prevent |
29 // the end-to-end system from having to deal with rapidly-changing video frame | 29 // the end-to-end system from having to deal with rapidly-changing video frame |
30 // resolutions that results from providing a fine-grained range of values. The | 30 // resolutions that results from providing a fine-grained range of values. The |
31 // possibile snapped frame sizes are computed relative to the resolution of the | 31 // possibile snapped frame sizes are computed relative to the resolution of the |
32 // source content: They are the same or smaller in size, and are of the same | 32 // source content: They are the same or smaller in size, and are of the same |
33 // aspect ratio. | 33 // aspect ratio. |
34 class CAPTURE_EXPORT CaptureResolutionChooser { | 34 class MEDIA_EXPORT CaptureResolutionChooser { |
35 public: | 35 public: |
36 // media::ResolutionChangePolicy determines whether the variable frame | 36 // media::ResolutionChangePolicy determines whether the variable frame |
37 // resolutions being computed must adhere to a fixed aspect ratio or not, or | 37 // resolutions being computed must adhere to a fixed aspect ratio or not, or |
38 // that there must only be a single fixed resolution. | 38 // that there must only be a single fixed resolution. |
39 CaptureResolutionChooser(const gfx::Size& max_frame_size, | 39 CaptureResolutionChooser(const gfx::Size& max_frame_size, |
40 ResolutionChangePolicy resolution_change_policy); | 40 ResolutionChangePolicy resolution_change_policy); |
41 ~CaptureResolutionChooser(); | 41 ~CaptureResolutionChooser(); |
42 | 42 |
43 // Returns the current capture frame resolution to use. | 43 // Returns the current capture frame resolution to use. |
44 gfx::Size capture_size() const { return capture_size_; } | 44 gfx::Size capture_size() const { return capture_size_; } |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 | 82 |
83 // Cache of the set of possible values |capture_size_| can have, in order from | 83 // Cache of the set of possible values |capture_size_| can have, in order from |
84 // smallest to largest. This is recomputed whenever UpdateSnappedFrameSizes() | 84 // smallest to largest. This is recomputed whenever UpdateSnappedFrameSizes() |
85 // is called. | 85 // is called. |
86 std::vector<gfx::Size> snapped_sizes_; | 86 std::vector<gfx::Size> snapped_sizes_; |
87 }; | 87 }; |
88 | 88 |
89 } // namespace media | 89 } // namespace media |
90 | 90 |
91 #endif // MEDIA_CAPTURE_CONTENT_CAPTURE_RESOLUTION_CHOOSER_H_ | 91 #endif // MEDIA_CAPTURE_CONTENT_CAPTURE_RESOLUTION_CHOOSER_H_ |
OLD | NEW |