| Index: media/capture/capture_resolution_chooser.cc
|
| diff --git a/content/browser/media/capture/capture_resolution_chooser.cc b/media/capture/capture_resolution_chooser.cc
|
| similarity index 78%
|
| rename from content/browser/media/capture/capture_resolution_chooser.cc
|
| rename to media/capture/capture_resolution_chooser.cc
|
| index 698882ab8d2ab7b776629ff21fa8242063c50c1d..ff2ee9d8c5a9f4fa52ef72cab981cf3c615f2be9 100644
|
| --- a/content/browser/media/capture/capture_resolution_chooser.cc
|
| +++ b/media/capture/capture_resolution_chooser.cc
|
| @@ -2,12 +2,12 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "content/browser/media/capture/capture_resolution_chooser.h"
|
| +#include "media/capture/capture_resolution_chooser.h"
|
|
|
| #include "media/base/limits.h"
|
| #include "media/base/video_util.h"
|
|
|
| -namespace content {
|
| +namespace media {
|
|
|
| namespace {
|
|
|
| @@ -15,11 +15,11 @@ namespace {
|
| // |resolution_change_policy|.
|
| gfx::Size ComputeMinimumCaptureSize(
|
| const gfx::Size& max_frame_size,
|
| - media::ResolutionChangePolicy resolution_change_policy) {
|
| + ResolutionChangePolicy resolution_change_policy) {
|
| switch (resolution_change_policy) {
|
| - case media::RESOLUTION_POLICY_FIXED_RESOLUTION:
|
| + case RESOLUTION_POLICY_FIXED_RESOLUTION:
|
| return max_frame_size;
|
| - case media::RESOLUTION_POLICY_FIXED_ASPECT_RATIO: {
|
| + case RESOLUTION_POLICY_FIXED_ASPECT_RATIO: {
|
| // TODO(miu): This is a place-holder until "min constraints" are plumbed-
|
| // in from the MediaStream framework. http://crbug.com/473336
|
| const int kMinLines = 180;
|
| @@ -28,13 +28,13 @@ gfx::Size ComputeMinimumCaptureSize(
|
| const gfx::Size result(
|
| kMinLines * max_frame_size.width() / max_frame_size.height(),
|
| kMinLines);
|
| - if (result.width() <= 0 || result.width() > media::limits::kMaxDimension)
|
| + if (result.width() <= 0 || result.width() > limits::kMaxDimension)
|
| return max_frame_size;
|
| return result;
|
| }
|
| - case media::RESOLUTION_POLICY_ANY_WITHIN_LIMIT:
|
| + case RESOLUTION_POLICY_ANY_WITHIN_LIMIT:
|
| return gfx::Size(1, 1);
|
| - case media::RESOLUTION_POLICY_LAST:
|
| + case RESOLUTION_POLICY_LAST:
|
| break;
|
| }
|
| NOTREACHED();
|
| @@ -48,12 +48,12 @@ gfx::Size ComputeBoundedCaptureSize(const gfx::Size& size,
|
| const gfx::Size& min_size,
|
| const gfx::Size& max_size) {
|
| if (size.width() > max_size.width() || size.height() > max_size.height()) {
|
| - gfx::Size result = media::ScaleSizeToFitWithinTarget(size, max_size);
|
| + gfx::Size result = ScaleSizeToFitWithinTarget(size, max_size);
|
| result.SetToMax(min_size);
|
| return result;
|
| } else if (size.width() < min_size.width() ||
|
| size.height() < min_size.height()) {
|
| - gfx::Size result = media::ScaleSizeToEncompassTarget(size, min_size);
|
| + gfx::Size result = ScaleSizeToEncompassTarget(size, min_size);
|
| result.SetToMin(max_size);
|
| return result;
|
| } else {
|
| @@ -65,7 +65,7 @@ gfx::Size ComputeBoundedCaptureSize(const gfx::Size& size,
|
|
|
| CaptureResolutionChooser::CaptureResolutionChooser(
|
| const gfx::Size& max_frame_size,
|
| - media::ResolutionChangePolicy resolution_change_policy)
|
| + ResolutionChangePolicy resolution_change_policy)
|
| : max_frame_size_(max_frame_size),
|
| min_frame_size_(ComputeMinimumCaptureSize(max_frame_size,
|
| resolution_change_policy)),
|
| @@ -86,26 +86,26 @@ void CaptureResolutionChooser::SetSourceSize(const gfx::Size& source_size) {
|
| return;
|
|
|
| switch (resolution_change_policy_) {
|
| - case media::RESOLUTION_POLICY_FIXED_RESOLUTION:
|
| + case RESOLUTION_POLICY_FIXED_RESOLUTION:
|
| // Source size changes do not affect the frame resolution. Frame
|
| // resolution is always fixed to |max_frame_size_|.
|
| break;
|
|
|
| - case media::RESOLUTION_POLICY_FIXED_ASPECT_RATIO:
|
| + case RESOLUTION_POLICY_FIXED_ASPECT_RATIO:
|
| constrained_size_ = ComputeBoundedCaptureSize(
|
| - media::PadToMatchAspectRatio(source_size, max_frame_size_),
|
| + PadToMatchAspectRatio(source_size, max_frame_size_),
|
| min_frame_size_,
|
| max_frame_size_);
|
| RecomputeCaptureSize();
|
| break;
|
|
|
| - case media::RESOLUTION_POLICY_ANY_WITHIN_LIMIT:
|
| + case RESOLUTION_POLICY_ANY_WITHIN_LIMIT:
|
| constrained_size_ = ComputeBoundedCaptureSize(
|
| source_size, min_frame_size_, max_frame_size_);
|
| RecomputeCaptureSize();
|
| break;
|
|
|
| - case media::RESOLUTION_POLICY_LAST:
|
| + case RESOLUTION_POLICY_LAST:
|
| NOTREACHED();
|
| }
|
| }
|
| @@ -117,4 +117,4 @@ void CaptureResolutionChooser::RecomputeCaptureSize() {
|
| capture_size_ = constrained_size_;
|
| }
|
|
|
| -} // namespace content
|
| +} // namespace media
|
|
|