Commit f16ea406 authored by Erik Chen's avatar Erik Chen Committed by Commit Bot

Rename LameCaptureOverlayChromeOS to SlowCaptureOverlayChromeOS.

This CL is a refactor with no intended behavior change.

Change-Id: I0673487c7bc3a7f4f895c03cff16ef982c8e8cba
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2252621
Auto-Submit: Erik Chen <erikchen@chromium.org>
Commit-Queue: Wez <wez@chromium.org>
Reviewed-by: default avatarWez <wez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#779954}
parent a697b4fc
...@@ -2164,10 +2164,10 @@ jumbo_source_set("browser") { ...@@ -2164,10 +2164,10 @@ jumbo_source_set("browser") {
} }
if (is_chromeos) { if (is_chromeos) {
sources += [ sources += [
"media/capture/lame_capture_overlay_chromeos.cc", "media/capture/slow_capture_overlay_chromeos.cc",
"media/capture/lame_capture_overlay_chromeos.h", "media/capture/slow_capture_overlay_chromeos.h",
"media/capture/lame_window_capturer_chromeos.cc", "media/capture/slow_window_capturer_chromeos.cc",
"media/capture/lame_window_capturer_chromeos.h", "media/capture/slow_window_capturer_chromeos.h",
] ]
} }
if (is_mac) { if (is_mac) {
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#include "ui/aura/window_occlusion_tracker.h" #include "ui/aura/window_occlusion_tracker.h"
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
#include "content/browser/media/capture/lame_window_capturer_chromeos.h" #include "content/browser/media/capture/slow_window_capturer_chromeos.h"
#endif #endif
namespace content { namespace content {
...@@ -81,7 +81,7 @@ class AuraWindowVideoCaptureDevice::WindowTracker ...@@ -81,7 +81,7 @@ class AuraWindowVideoCaptureDevice::WindowTracker
target_window_ = DesktopMediaID::GetNativeWindowById(source_id); target_window_ = DesktopMediaID::GetNativeWindowById(source_id);
if (target_window_ && if (target_window_ &&
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
// See class comments for LameWindowCapturerChromeOS. // See class comments for SlowWindowCapturerChromeOS.
(source_id.type == DesktopMediaID::TYPE_WINDOW || (source_id.type == DesktopMediaID::TYPE_WINDOW ||
target_window_->GetFrameSinkId().is_valid()) && target_window_->GetFrameSinkId().is_valid()) &&
#else #else
...@@ -175,7 +175,7 @@ void AuraWindowVideoCaptureDevice::CreateCapturer( ...@@ -175,7 +175,7 @@ void AuraWindowVideoCaptureDevice::CreateCapturer(
VLOG(1) << "AuraWindowVideoCaptureDevice is using the LAME " VLOG(1) << "AuraWindowVideoCaptureDevice is using the LAME "
"capturer. :("; "capturer. :(";
mojo::MakeSelfOwnedReceiver( mojo::MakeSelfOwnedReceiver(
std::make_unique<LameWindowCapturerChromeOS>( std::make_unique<SlowWindowCapturerChromeOS>(
tracker->target_window()), tracker->target_window()),
std::move(receiver)); std::move(receiver));
} else { } else {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "content/browser/media/capture/lame_capture_overlay_chromeos.h" #include "content/browser/media/capture/slow_capture_overlay_chromeos.h"
#include <algorithm> #include <algorithm>
#include <cmath> #include <cmath>
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
#include "base/bind.h" #include "base/bind.h"
#include "base/numerics/ranges.h" #include "base/numerics/ranges.h"
#include "base/numerics/safe_conversions.h" #include "base/numerics/safe_conversions.h"
#include "content/browser/media/capture/lame_window_capturer_chromeos.h" #include "content/browser/media/capture/slow_window_capturer_chromeos.h"
#include "media/base/video_frame.h" #include "media/base/video_frame.h"
#include "skia/ext/image_operations.h" #include "skia/ext/image_operations.h"
#include "third_party/skia/include/core/SkColor.h" #include "third_party/skia/include/core/SkColor.h"
...@@ -19,9 +19,9 @@ ...@@ -19,9 +19,9 @@
namespace content { namespace content {
LameCaptureOverlayChromeOS::Owner::~Owner() = default; SlowCaptureOverlayChromeOS::Owner::~Owner() = default;
LameCaptureOverlayChromeOS::LameCaptureOverlayChromeOS( SlowCaptureOverlayChromeOS::SlowCaptureOverlayChromeOS(
Owner* owner, Owner* owner,
mojo::PendingReceiver<viz::mojom::FrameSinkVideoCaptureOverlay> receiver) mojo::PendingReceiver<viz::mojom::FrameSinkVideoCaptureOverlay> receiver)
: receiver_(this, std::move(receiver)) { : receiver_(this, std::move(receiver)) {
...@@ -31,11 +31,11 @@ LameCaptureOverlayChromeOS::LameCaptureOverlayChromeOS( ...@@ -31,11 +31,11 @@ LameCaptureOverlayChromeOS::LameCaptureOverlayChromeOS(
} }
} }
LameCaptureOverlayChromeOS::~LameCaptureOverlayChromeOS() { SlowCaptureOverlayChromeOS::~SlowCaptureOverlayChromeOS() {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
} }
void LameCaptureOverlayChromeOS::SetImageAndBounds(const SkBitmap& image, void SlowCaptureOverlayChromeOS::SetImageAndBounds(const SkBitmap& image,
const gfx::RectF& bounds) { const gfx::RectF& bounds) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
...@@ -44,7 +44,7 @@ void LameCaptureOverlayChromeOS::SetImageAndBounds(const SkBitmap& image, ...@@ -44,7 +44,7 @@ void LameCaptureOverlayChromeOS::SetImageAndBounds(const SkBitmap& image,
cached_scaled_image_.reset(); cached_scaled_image_.reset();
} }
void LameCaptureOverlayChromeOS::SetBounds(const gfx::RectF& bounds) { void SlowCaptureOverlayChromeOS::SetBounds(const gfx::RectF& bounds) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
if (bounds != bounds_) { if (bounds != bounds_) {
...@@ -89,8 +89,8 @@ inline int alpha_blend(int alpha, int src, int dst) { ...@@ -89,8 +89,8 @@ inline int alpha_blend(int alpha, int src, int dst) {
} // namespace } // namespace
LameCaptureOverlayChromeOS::OnceRenderer SlowCaptureOverlayChromeOS::OnceRenderer
LameCaptureOverlayChromeOS::MakeRenderer(const gfx::Rect& region_in_frame) { SlowCaptureOverlayChromeOS::MakeRenderer(const gfx::Rect& region_in_frame) {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
if (bounds_.IsEmpty() || image_.drawsNothing()) { if (bounds_.IsEmpty() || image_.drawsNothing()) {
...@@ -122,7 +122,7 @@ LameCaptureOverlayChromeOS::MakeRenderer(const gfx::Rect& region_in_frame) { ...@@ -122,7 +122,7 @@ LameCaptureOverlayChromeOS::MakeRenderer(const gfx::Rect& region_in_frame) {
// The following binds all state required to render the overlay on a // The following binds all state required to render the overlay on a
// VideoFrame at a later time. This callback does not require // VideoFrame at a later time. This callback does not require
// LameCaptureOverlayChromeOS to outlive it. // SlowCaptureOverlayChromeOS to outlive it.
return base::BindOnce( return base::BindOnce(
[](const SkBitmap& image, const gfx::Point& position, [](const SkBitmap& image, const gfx::Point& position,
const gfx::Rect& rect, media::VideoFrame* frame) { const gfx::Rect& rect, media::VideoFrame* frame) {
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef CONTENT_BROWSER_MEDIA_CAPTURE_LAME_CAPTURE_OVERLAY_CHROMEOS_H_ #ifndef CONTENT_BROWSER_MEDIA_CAPTURE_SLOW_CAPTURE_OVERLAY_CHROMEOS_H_
#define CONTENT_BROWSER_MEDIA_CAPTURE_LAME_CAPTURE_OVERLAY_CHROMEOS_H_ #define CONTENT_BROWSER_MEDIA_CAPTURE_SLOW_CAPTURE_OVERLAY_CHROMEOS_H_
#include "base/callback.h" #include "base/callback.h"
#include "base/macros.h" #include "base/macros.h"
...@@ -23,7 +23,7 @@ namespace content { ...@@ -23,7 +23,7 @@ namespace content {
// A minimal FrameSinkVideoCaptureOverlay implementation for aura::Window video // A minimal FrameSinkVideoCaptureOverlay implementation for aura::Window video
// capture on ChromeOS (i.e., not desktop capture, and not WebContents capture). // capture on ChromeOS (i.e., not desktop capture, and not WebContents capture).
// See class comments for LameWindowCapturerChromeOS for further details on why // See class comments for SlowWindowCapturerChromeOS for further details on why
// this exists and why this placeholder is needed for now. // this exists and why this placeholder is needed for now.
// //
// The implementation here is a hodgepodge of code borrowed from // The implementation here is a hodgepodge of code borrowed from
...@@ -35,16 +35,16 @@ namespace content { ...@@ -35,16 +35,16 @@ namespace content {
// renderer. // renderer.
// //
// TODO(crbug/806366): The goal is to remove this code by 2019. // TODO(crbug/806366): The goal is to remove this code by 2019.
class CONTENT_EXPORT LameCaptureOverlayChromeOS class CONTENT_EXPORT SlowCaptureOverlayChromeOS
: public viz::mojom::FrameSinkVideoCaptureOverlay { : public viz::mojom::FrameSinkVideoCaptureOverlay {
public: public:
// Implemented by LameWindowCapturerChromeOS. // Implemented by SlowWindowCapturerChromeOS.
class CONTENT_EXPORT Owner { class CONTENT_EXPORT Owner {
public: public:
// Called to notify that the |overlay| has lost its mojo binding. The owner // Called to notify that the |overlay| has lost its mojo binding. The owner
// will usually delete it during this method call. // will usually delete it during this method call.
virtual void OnOverlayConnectionLost( virtual void OnOverlayConnectionLost(
LameCaptureOverlayChromeOS* overlay) = 0; SlowCaptureOverlayChromeOS* overlay) = 0;
protected: protected:
virtual ~Owner(); virtual ~Owner();
...@@ -53,10 +53,10 @@ class CONTENT_EXPORT LameCaptureOverlayChromeOS ...@@ -53,10 +53,10 @@ class CONTENT_EXPORT LameCaptureOverlayChromeOS
// A OnceCallback that, when run, renders the overlay on a VideoFrame. // A OnceCallback that, when run, renders the overlay on a VideoFrame.
using OnceRenderer = base::OnceCallback<void(media::VideoFrame*)>; using OnceRenderer = base::OnceCallback<void(media::VideoFrame*)>;
LameCaptureOverlayChromeOS( SlowCaptureOverlayChromeOS(
Owner* owner, Owner* owner,
mojo::PendingReceiver<viz::mojom::FrameSinkVideoCaptureOverlay> receiver); mojo::PendingReceiver<viz::mojom::FrameSinkVideoCaptureOverlay> receiver);
~LameCaptureOverlayChromeOS() final; ~SlowCaptureOverlayChromeOS() final;
// viz::mojom::FrameSinkVideoCaptureOverlay implementation. // viz::mojom::FrameSinkVideoCaptureOverlay implementation.
void SetImageAndBounds(const SkBitmap& image, const gfx::RectF& bounds) final; void SetImageAndBounds(const SkBitmap& image, const gfx::RectF& bounds) final;
...@@ -81,9 +81,9 @@ class CONTENT_EXPORT LameCaptureOverlayChromeOS ...@@ -81,9 +81,9 @@ class CONTENT_EXPORT LameCaptureOverlayChromeOS
// bitmap size changes. // bitmap size changes.
SkBitmap cached_scaled_image_; SkBitmap cached_scaled_image_;
DISALLOW_COPY_AND_ASSIGN(LameCaptureOverlayChromeOS); DISALLOW_COPY_AND_ASSIGN(SlowCaptureOverlayChromeOS);
}; };
} // namespace content } // namespace content
#endif // CONTENT_BROWSER_MEDIA_CAPTURE_LAME_CAPTURE_OVERLAY_CHROMEOS_H_ #endif // CONTENT_BROWSER_MEDIA_CAPTURE_SLOW_CAPTURE_OVERLAY_CHROMEOS_H_
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "content/browser/media/capture/lame_capture_overlay_chromeos.h" #include "content/browser/media/capture/slow_capture_overlay_chromeos.h"
#include <stdint.h> #include <stdint.h>
...@@ -27,7 +27,7 @@ constexpr gfx::Size kFrameSize = gfx::Size(320, 200); ...@@ -27,7 +27,7 @@ constexpr gfx::Size kFrameSize = gfx::Size(320, 200);
constexpr gfx::Rect kContentRegion = gfx::Rect(kFrameSize); constexpr gfx::Rect kContentRegion = gfx::Rect(kFrameSize);
constexpr gfx::RectF kSpanOfEntireFrame = gfx::RectF(0.0f, 0.0f, 1.0f, 1.0f); constexpr gfx::RectF kSpanOfEntireFrame = gfx::RectF(0.0f, 0.0f, 1.0f, 1.0f);
class LameCaptureOverlayChromeOSTest : public testing::Test { class SlowCaptureOverlayChromeOSTest : public testing::Test {
public: public:
void RunUntilIdle() { env_.RunUntilIdle(); } void RunUntilIdle() { env_.RunUntilIdle(); }
...@@ -68,9 +68,9 @@ class LameCaptureOverlayChromeOSTest : public testing::Test { ...@@ -68,9 +68,9 @@ class LameCaptureOverlayChromeOSTest : public testing::Test {
base::test::TaskEnvironment env_; base::test::TaskEnvironment env_;
}; };
TEST_F(LameCaptureOverlayChromeOSTest, UnsetImageNotRenderedOnFrame) { TEST_F(SlowCaptureOverlayChromeOSTest, UnsetImageNotRenderedOnFrame) {
mojo::Remote<viz::mojom::FrameSinkVideoCaptureOverlay> overlay_remote; mojo::Remote<viz::mojom::FrameSinkVideoCaptureOverlay> overlay_remote;
LameCaptureOverlayChromeOS overlay( SlowCaptureOverlayChromeOS overlay(
nullptr, overlay_remote.BindNewPipeAndPassReceiver()); nullptr, overlay_remote.BindNewPipeAndPassReceiver());
// Bounds set, but no image. → Should not render anything. // Bounds set, but no image. → Should not render anything.
...@@ -82,9 +82,9 @@ TEST_F(LameCaptureOverlayChromeOSTest, UnsetImageNotRenderedOnFrame) { ...@@ -82,9 +82,9 @@ TEST_F(LameCaptureOverlayChromeOSTest, UnsetImageNotRenderedOnFrame) {
EXPECT_TRUE(overlay.MakeRenderer(kContentRegion)); EXPECT_TRUE(overlay.MakeRenderer(kContentRegion));
} }
TEST_F(LameCaptureOverlayChromeOSTest, HiddenImageNotRenderedOnFrame) { TEST_F(SlowCaptureOverlayChromeOSTest, HiddenImageNotRenderedOnFrame) {
mojo::Remote<viz::mojom::FrameSinkVideoCaptureOverlay> overlay_remote; mojo::Remote<viz::mojom::FrameSinkVideoCaptureOverlay> overlay_remote;
LameCaptureOverlayChromeOS overlay( SlowCaptureOverlayChromeOS overlay(
nullptr, overlay_remote.BindNewPipeAndPassReceiver()); nullptr, overlay_remote.BindNewPipeAndPassReceiver());
// Both image and bounds set. → Should render something. // Both image and bounds set. → Should render something.
...@@ -96,9 +96,9 @@ TEST_F(LameCaptureOverlayChromeOSTest, HiddenImageNotRenderedOnFrame) { ...@@ -96,9 +96,9 @@ TEST_F(LameCaptureOverlayChromeOSTest, HiddenImageNotRenderedOnFrame) {
EXPECT_FALSE(overlay.MakeRenderer(kContentRegion)); EXPECT_FALSE(overlay.MakeRenderer(kContentRegion));
} }
TEST_F(LameCaptureOverlayChromeOSTest, OutOfBoundsOverlayNotRenderedOnFrame) { TEST_F(SlowCaptureOverlayChromeOSTest, OutOfBoundsOverlayNotRenderedOnFrame) {
mojo::Remote<viz::mojom::FrameSinkVideoCaptureOverlay> overlay_remote; mojo::Remote<viz::mojom::FrameSinkVideoCaptureOverlay> overlay_remote;
LameCaptureOverlayChromeOS overlay( SlowCaptureOverlayChromeOS overlay(
nullptr, overlay_remote.BindNewPipeAndPassReceiver()); nullptr, overlay_remote.BindNewPipeAndPassReceiver());
// Both image and bounds set. → Should render something. // Both image and bounds set. → Should render something.
...@@ -110,9 +110,9 @@ TEST_F(LameCaptureOverlayChromeOSTest, OutOfBoundsOverlayNotRenderedOnFrame) { ...@@ -110,9 +110,9 @@ TEST_F(LameCaptureOverlayChromeOSTest, OutOfBoundsOverlayNotRenderedOnFrame) {
EXPECT_FALSE(overlay.MakeRenderer(kContentRegion)); EXPECT_FALSE(overlay.MakeRenderer(kContentRegion));
} }
TEST_F(LameCaptureOverlayChromeOSTest, ImageRenderedOnFrame) { TEST_F(SlowCaptureOverlayChromeOSTest, ImageRenderedOnFrame) {
mojo::Remote<viz::mojom::FrameSinkVideoCaptureOverlay> overlay_remote; mojo::Remote<viz::mojom::FrameSinkVideoCaptureOverlay> overlay_remote;
LameCaptureOverlayChromeOS overlay( SlowCaptureOverlayChromeOS overlay(
nullptr, overlay_remote.BindNewPipeAndPassReceiver()); nullptr, overlay_remote.BindNewPipeAndPassReceiver());
// Create blank black frame. No non-zero pixels should be present. // Create blank black frame. No non-zero pixels should be present.
...@@ -156,16 +156,16 @@ TEST_F(LameCaptureOverlayChromeOSTest, ImageRenderedOnFrame) { ...@@ -156,16 +156,16 @@ TEST_F(LameCaptureOverlayChromeOSTest, ImageRenderedOnFrame) {
} }
} }
TEST_F(LameCaptureOverlayChromeOSTest, ReportsLostMojoConnection) { TEST_F(SlowCaptureOverlayChromeOSTest, ReportsLostMojoConnection) {
class MockOwner : public LameCaptureOverlayChromeOS::Owner { class MockOwner : public SlowCaptureOverlayChromeOS::Owner {
public: public:
~MockOwner() final = default; ~MockOwner() final = default;
MOCK_METHOD1(OnOverlayConnectionLost, MOCK_METHOD1(OnOverlayConnectionLost,
void(LameCaptureOverlayChromeOS* overlay)); void(SlowCaptureOverlayChromeOS* overlay));
} mock_owner; } mock_owner;
mojo::Remote<viz::mojom::FrameSinkVideoCaptureOverlay> overlay_remote; mojo::Remote<viz::mojom::FrameSinkVideoCaptureOverlay> overlay_remote;
LameCaptureOverlayChromeOS overlay( SlowCaptureOverlayChromeOS overlay(
&mock_owner, overlay_remote.BindNewPipeAndPassReceiver()); &mock_owner, overlay_remote.BindNewPipeAndPassReceiver());
ASSERT_TRUE(overlay_remote); ASSERT_TRUE(overlay_remote);
RunUntilIdle(); // Propagate mojo tasks. RunUntilIdle(); // Propagate mojo tasks.
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#include "content/browser/media/capture/lame_window_capturer_chromeos.h" #include "content/browser/media/capture/slow_window_capturer_chromeos.h"
#include <algorithm> #include <algorithm>
...@@ -31,22 +31,22 @@ gfx::Size AdjustSizeForI420Format(const gfx::Size& raw_size) { ...@@ -31,22 +31,22 @@ gfx::Size AdjustSizeForI420Format(const gfx::Size& raw_size) {
} // namespace } // namespace
// static // static
constexpr base::TimeDelta LameWindowCapturerChromeOS::kAbsoluteMinCapturePeriod; constexpr base::TimeDelta SlowWindowCapturerChromeOS::kAbsoluteMinCapturePeriod;
LameWindowCapturerChromeOS::LameWindowCapturerChromeOS(aura::Window* target) SlowWindowCapturerChromeOS::SlowWindowCapturerChromeOS(aura::Window* target)
: target_(target), copy_request_source_(base::UnguessableToken::Create()) { : target_(target), copy_request_source_(base::UnguessableToken::Create()) {
if (target_) { if (target_) {
target_->AddObserver(this); target_->AddObserver(this);
} }
} }
LameWindowCapturerChromeOS::~LameWindowCapturerChromeOS() { SlowWindowCapturerChromeOS::~SlowWindowCapturerChromeOS() {
if (target_) { if (target_) {
target_->RemoveObserver(this); target_->RemoveObserver(this);
} }
} }
void LameWindowCapturerChromeOS::SetFormat(media::VideoPixelFormat format, void SlowWindowCapturerChromeOS::SetFormat(media::VideoPixelFormat format,
const gfx::ColorSpace& color_space) { const gfx::ColorSpace& color_space) {
if (format != media::PIXEL_FORMAT_I420) { if (format != media::PIXEL_FORMAT_I420) {
LOG(DFATAL) << "Invalid pixel format: Only I420 is supported."; LOG(DFATAL) << "Invalid pixel format: Only I420 is supported.";
...@@ -57,7 +57,7 @@ void LameWindowCapturerChromeOS::SetFormat(media::VideoPixelFormat format, ...@@ -57,7 +57,7 @@ void LameWindowCapturerChromeOS::SetFormat(media::VideoPixelFormat format,
} }
} }
void LameWindowCapturerChromeOS::SetMinCapturePeriod( void SlowWindowCapturerChromeOS::SetMinCapturePeriod(
base::TimeDelta min_capture_period) { base::TimeDelta min_capture_period) {
capture_period_ = std::max(min_capture_period, kAbsoluteMinCapturePeriod); capture_period_ = std::max(min_capture_period, kAbsoluteMinCapturePeriod);
...@@ -65,14 +65,14 @@ void LameWindowCapturerChromeOS::SetMinCapturePeriod( ...@@ -65,14 +65,14 @@ void LameWindowCapturerChromeOS::SetMinCapturePeriod(
// re-start with the new capture period. // re-start with the new capture period.
if (timer_.IsRunning()) { if (timer_.IsRunning()) {
timer_.Start(FROM_HERE, capture_period_, this, timer_.Start(FROM_HERE, capture_period_, this,
&LameWindowCapturerChromeOS::CaptureNextFrame); &SlowWindowCapturerChromeOS::CaptureNextFrame);
} }
} }
void LameWindowCapturerChromeOS::SetMinSizeChangePeriod( void SlowWindowCapturerChromeOS::SetMinSizeChangePeriod(
base::TimeDelta min_period) {} base::TimeDelta min_period) {}
void LameWindowCapturerChromeOS::SetResolutionConstraints( void SlowWindowCapturerChromeOS::SetResolutionConstraints(
const gfx::Size& min_size, const gfx::Size& min_size,
const gfx::Size& max_size, const gfx::Size& max_size,
bool use_fixed_aspect_ratio) { bool use_fixed_aspect_ratio) {
...@@ -95,17 +95,17 @@ void LameWindowCapturerChromeOS::SetResolutionConstraints( ...@@ -95,17 +95,17 @@ void LameWindowCapturerChromeOS::SetResolutionConstraints(
in_flight_count_ = 0; in_flight_count_ = 0;
} }
void LameWindowCapturerChromeOS::SetAutoThrottlingEnabled(bool enabled) { void SlowWindowCapturerChromeOS::SetAutoThrottlingEnabled(bool enabled) {
NOTIMPLEMENTED(); NOTIMPLEMENTED();
} }
void LameWindowCapturerChromeOS::ChangeTarget( void SlowWindowCapturerChromeOS::ChangeTarget(
const base::Optional<viz::FrameSinkId>& frame_sink_id) { const base::Optional<viz::FrameSinkId>& frame_sink_id) {
// The LameWindowCapturerChromeOS does not capture from compositor frame // The SlowWindowCapturerChromeOS does not capture from compositor frame
// sinks. // sinks.
} }
void LameWindowCapturerChromeOS::Start( void SlowWindowCapturerChromeOS::Start(
mojo::PendingRemote<viz::mojom::FrameSinkVideoConsumer> consumer) { mojo::PendingRemote<viz::mojom::FrameSinkVideoConsumer> consumer) {
DCHECK(consumer); DCHECK(consumer);
...@@ -115,13 +115,13 @@ void LameWindowCapturerChromeOS::Start( ...@@ -115,13 +115,13 @@ void LameWindowCapturerChromeOS::Start(
// In the future, if the connection to the consumer is lost before a call to // In the future, if the connection to the consumer is lost before a call to
// Stop(), make that call on its behalf. // Stop(), make that call on its behalf.
consumer_.set_disconnect_handler(base::BindOnce( consumer_.set_disconnect_handler(base::BindOnce(
&LameWindowCapturerChromeOS::Stop, base::Unretained(this))); &SlowWindowCapturerChromeOS::Stop, base::Unretained(this)));
timer_.Start(FROM_HERE, capture_period_, this, timer_.Start(FROM_HERE, capture_period_, this,
&LameWindowCapturerChromeOS::CaptureNextFrame); &SlowWindowCapturerChromeOS::CaptureNextFrame);
} }
void LameWindowCapturerChromeOS::Stop() { void SlowWindowCapturerChromeOS::Stop() {
// Stop the timer, cancel any in-flight frames, and clear the buffer pool. // Stop the timer, cancel any in-flight frames, and clear the buffer pool.
timer_.Stop(); timer_.Stop();
weak_factory_.InvalidateWeakPtrs(); weak_factory_.InvalidateWeakPtrs();
...@@ -134,24 +134,24 @@ void LameWindowCapturerChromeOS::Stop() { ...@@ -134,24 +134,24 @@ void LameWindowCapturerChromeOS::Stop() {
} }
} }
void LameWindowCapturerChromeOS::RequestRefreshFrame() { void SlowWindowCapturerChromeOS::RequestRefreshFrame() {
// This is ignored because the LameWindowCapturerChromeOS captures frames // This is ignored because the SlowWindowCapturerChromeOS captures frames
// continuously. // continuously.
} }
void LameWindowCapturerChromeOS::CreateOverlay( void SlowWindowCapturerChromeOS::CreateOverlay(
int32_t stacking_index, int32_t stacking_index,
mojo::PendingReceiver<viz::mojom::FrameSinkVideoCaptureOverlay> receiver) { mojo::PendingReceiver<viz::mojom::FrameSinkVideoCaptureOverlay> receiver) {
// LameWindowCapturerChromeOS only supports one overlay at a time. If one // SlowWindowCapturerChromeOS only supports one overlay at a time. If one
// already exists, the following will cause it to be dropped. // already exists, the following will cause it to be dropped.
overlay_ = overlay_ =
std::make_unique<LameCaptureOverlayChromeOS>(this, std::move(receiver)); std::make_unique<SlowCaptureOverlayChromeOS>(this, std::move(receiver));
} }
class LameWindowCapturerChromeOS::InFlightFrame class SlowWindowCapturerChromeOS::InFlightFrame
: public viz::mojom::FrameSinkVideoConsumerFrameCallbacks { : public viz::mojom::FrameSinkVideoConsumerFrameCallbacks {
public: public:
InFlightFrame(base::WeakPtr<LameWindowCapturerChromeOS> capturer, InFlightFrame(base::WeakPtr<SlowWindowCapturerChromeOS> capturer,
base::MappedReadOnlyRegion buffer) base::MappedReadOnlyRegion buffer)
: capturer_(std::move(capturer)), buffer_(std::move(buffer)) {} : capturer_(std::move(capturer)), buffer_(std::move(buffer)) {}
...@@ -169,7 +169,7 @@ class LameWindowCapturerChromeOS::InFlightFrame ...@@ -169,7 +169,7 @@ class LameWindowCapturerChromeOS::InFlightFrame
const gfx::Rect& content_rect() const { return content_rect_; } const gfx::Rect& content_rect() const { return content_rect_; }
void set_content_rect(const gfx::Rect& rect) { content_rect_ = rect; } void set_content_rect(const gfx::Rect& rect) { content_rect_ = rect; }
void set_overlay_renderer(LameCaptureOverlayChromeOS::OnceRenderer renderer) { void set_overlay_renderer(SlowCaptureOverlayChromeOS::OnceRenderer renderer) {
overlay_renderer_ = std::move(renderer); overlay_renderer_ = std::move(renderer);
} }
void RenderOptionalOverlay() { void RenderOptionalOverlay() {
...@@ -199,23 +199,23 @@ class LameWindowCapturerChromeOS::InFlightFrame ...@@ -199,23 +199,23 @@ class LameWindowCapturerChromeOS::InFlightFrame
void ProvideFeedback(double utilization) final {} void ProvideFeedback(double utilization) final {}
private: private:
base::WeakPtr<LameWindowCapturerChromeOS> capturer_; base::WeakPtr<SlowWindowCapturerChromeOS> capturer_;
base::MappedReadOnlyRegion buffer_; base::MappedReadOnlyRegion buffer_;
scoped_refptr<VideoFrame> video_frame_; scoped_refptr<VideoFrame> video_frame_;
gfx::Rect content_rect_; gfx::Rect content_rect_;
LameCaptureOverlayChromeOS::OnceRenderer overlay_renderer_; SlowCaptureOverlayChromeOS::OnceRenderer overlay_renderer_;
DISALLOW_COPY_AND_ASSIGN(InFlightFrame); DISALLOW_COPY_AND_ASSIGN(InFlightFrame);
}; };
void LameWindowCapturerChromeOS::OnOverlayConnectionLost( void SlowWindowCapturerChromeOS::OnOverlayConnectionLost(
LameCaptureOverlayChromeOS* overlay) { SlowCaptureOverlayChromeOS* overlay) {
if (overlay_.get() == overlay) { if (overlay_.get() == overlay) {
overlay_.reset(); overlay_.reset();
} }
} }
void LameWindowCapturerChromeOS::CaptureNextFrame() { void SlowWindowCapturerChromeOS::CaptureNextFrame() {
// If the maximum frame in-flight count has been reached, skip this frame. // If the maximum frame in-flight count has been reached, skip this frame.
if (in_flight_count_ >= kMaxFramesInFlight) { if (in_flight_count_ >= kMaxFramesInFlight) {
return; return;
...@@ -292,7 +292,7 @@ void LameWindowCapturerChromeOS::CaptureNextFrame() { ...@@ -292,7 +292,7 @@ void LameWindowCapturerChromeOS::CaptureNextFrame() {
auto request = std::make_unique<viz::CopyOutputRequest>( auto request = std::make_unique<viz::CopyOutputRequest>(
// Note: As of this writing, I420_PLANES is not supported external to VIZ. // Note: As of this writing, I420_PLANES is not supported external to VIZ.
viz::CopyOutputRequest::ResultFormat::RGBA_BITMAP, viz::CopyOutputRequest::ResultFormat::RGBA_BITMAP,
base::BindOnce(&LameWindowCapturerChromeOS::DidCopyFrame, base::BindOnce(&SlowWindowCapturerChromeOS::DidCopyFrame,
weak_factory_.GetWeakPtr(), std::move(in_flight_frame))); weak_factory_.GetWeakPtr(), std::move(in_flight_frame)));
request->set_source(copy_request_source_); request->set_source(copy_request_source_);
request->set_area(gfx::Rect(source_size)); request->set_area(gfx::Rect(source_size));
...@@ -303,7 +303,7 @@ void LameWindowCapturerChromeOS::CaptureNextFrame() { ...@@ -303,7 +303,7 @@ void LameWindowCapturerChromeOS::CaptureNextFrame() {
target_->layer()->RequestCopyOfOutput(std::move(request)); target_->layer()->RequestCopyOfOutput(std::move(request));
} }
void LameWindowCapturerChromeOS::DidCopyFrame( void SlowWindowCapturerChromeOS::DidCopyFrame(
std::unique_ptr<InFlightFrame> in_flight_frame, std::unique_ptr<InFlightFrame> in_flight_frame,
std::unique_ptr<viz::CopyOutputResult> result) { std::unique_ptr<viz::CopyOutputResult> result) {
// Populate the VideoFrame from the CopyOutputResult. // Populate the VideoFrame from the CopyOutputResult.
...@@ -337,7 +337,7 @@ void LameWindowCapturerChromeOS::DidCopyFrame( ...@@ -337,7 +337,7 @@ void LameWindowCapturerChromeOS::DidCopyFrame(
DeliverFrame(std::move(in_flight_frame)); DeliverFrame(std::move(in_flight_frame));
} }
void LameWindowCapturerChromeOS::DeliverFrame( void SlowWindowCapturerChromeOS::DeliverFrame(
std::unique_ptr<InFlightFrame> in_flight_frame) { std::unique_ptr<InFlightFrame> in_flight_frame) {
auto* const frame = in_flight_frame->video_frame(); auto* const frame = in_flight_frame->video_frame();
DCHECK(frame); DCHECK(frame);
...@@ -376,7 +376,7 @@ void LameWindowCapturerChromeOS::DeliverFrame( ...@@ -376,7 +376,7 @@ void LameWindowCapturerChromeOS::DeliverFrame(
std::move(callbacks)); std::move(callbacks));
} }
void LameWindowCapturerChromeOS::OnWindowDestroying(aura::Window* window) { void SlowWindowCapturerChromeOS::OnWindowDestroying(aura::Window* window) {
if (window == target_) { if (window == target_) {
target_->RemoveObserver(this); target_->RemoveObserver(this);
target_ = nullptr; target_ = nullptr;
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef CONTENT_BROWSER_MEDIA_CAPTURE_LAME_WINDOW_CAPTURER_CHROMEOS_H_ #ifndef CONTENT_BROWSER_MEDIA_CAPTURE_SLOW_WINDOW_CAPTURER_CHROMEOS_H_
#define CONTENT_BROWSER_MEDIA_CAPTURE_LAME_WINDOW_CAPTURER_CHROMEOS_H_ #define CONTENT_BROWSER_MEDIA_CAPTURE_SLOW_WINDOW_CAPTURER_CHROMEOS_H_
#include <memory> #include <memory>
#include <utility> #include <utility>
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#include "base/time/time.h" #include "base/time/time.h"
#include "base/timer/timer.h" #include "base/timer/timer.h"
#include "base/unguessable_token.h" #include "base/unguessable_token.h"
#include "content/browser/media/capture/lame_capture_overlay_chromeos.h" #include "content/browser/media/capture/slow_capture_overlay_chromeos.h"
#include "media/base/video_frame.h" #include "media/base/video_frame.h"
#include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/pending_remote.h" #include "mojo/public/cpp/bindings/pending_remote.h"
...@@ -50,12 +50,12 @@ namespace content { ...@@ -50,12 +50,12 @@ namespace content {
// running. // running.
// //
// TODO(crbug/806366): The goal is to remove this code by 2019. // TODO(crbug/806366): The goal is to remove this code by 2019.
class LameWindowCapturerChromeOS : public viz::mojom::FrameSinkVideoCapturer, class SlowWindowCapturerChromeOS : public viz::mojom::FrameSinkVideoCapturer,
public LameCaptureOverlayChromeOS::Owner, public SlowCaptureOverlayChromeOS::Owner,
public aura::WindowObserver { public aura::WindowObserver {
public: public:
explicit LameWindowCapturerChromeOS(aura::Window* target); explicit SlowWindowCapturerChromeOS(aura::Window* target);
~LameWindowCapturerChromeOS() final; ~SlowWindowCapturerChromeOS() final;
// viz::mojom::FrameSinkVideoCapturer implementation. // viz::mojom::FrameSinkVideoCapturer implementation.
void SetFormat(media::VideoPixelFormat format, void SetFormat(media::VideoPixelFormat format,
...@@ -83,8 +83,8 @@ class LameWindowCapturerChromeOS : public viz::mojom::FrameSinkVideoCapturer, ...@@ -83,8 +83,8 @@ class LameWindowCapturerChromeOS : public viz::mojom::FrameSinkVideoCapturer,
// returns the buffer back to the pool. // returns the buffer back to the pool.
class InFlightFrame; class InFlightFrame;
// LameWindowCapturerChromeOS::Owner implementation. // SlowWindowCapturerChromeOS::Owner implementation.
void OnOverlayConnectionLost(LameCaptureOverlayChromeOS* overlay) final; void OnOverlayConnectionLost(SlowCaptureOverlayChromeOS* overlay) final;
// Initiates capture of the next frame. This is called periodically by the // Initiates capture of the next frame. This is called periodically by the
// |timer_|. // |timer_|.
...@@ -134,11 +134,11 @@ class LameWindowCapturerChromeOS : public viz::mojom::FrameSinkVideoCapturer, ...@@ -134,11 +134,11 @@ class LameWindowCapturerChromeOS : public viz::mojom::FrameSinkVideoCapturer,
const base::UnguessableToken copy_request_source_; const base::UnguessableToken copy_request_source_;
// An optional overlay to be rendered over each captured video frame. // An optional overlay to be rendered over each captured video frame.
std::unique_ptr<LameCaptureOverlayChromeOS> overlay_; std::unique_ptr<SlowCaptureOverlayChromeOS> overlay_;
// Used for cancelling any outstanding activities' results, once Stop() is // Used for cancelling any outstanding activities' results, once Stop() is
// called and there is no longer a consumer to receive another frame. // called and there is no longer a consumer to receive another frame.
base::WeakPtrFactory<LameWindowCapturerChromeOS> weak_factory_{this}; base::WeakPtrFactory<SlowWindowCapturerChromeOS> weak_factory_{this};
// Enforce a very low maximum frame rate (5 FPS), due to the lack of // Enforce a very low maximum frame rate (5 FPS), due to the lack of
// design optimizations. See top-level class comments. // design optimizations. See top-level class comments.
...@@ -148,9 +148,9 @@ class LameWindowCapturerChromeOS : public viz::mojom::FrameSinkVideoCapturer, ...@@ -148,9 +148,9 @@ class LameWindowCapturerChromeOS : public viz::mojom::FrameSinkVideoCapturer,
// The maximum number of frames in-flight at any one time. // The maximum number of frames in-flight at any one time.
static constexpr int kMaxFramesInFlight = 3; static constexpr int kMaxFramesInFlight = 3;
DISALLOW_COPY_AND_ASSIGN(LameWindowCapturerChromeOS); DISALLOW_COPY_AND_ASSIGN(SlowWindowCapturerChromeOS);
}; };
} // namespace content } // namespace content
#endif // CONTENT_BROWSER_MEDIA_CAPTURE_LAME_WINDOW_CAPTURER_CHROMEOS_H_ #endif // CONTENT_BROWSER_MEDIA_CAPTURE_SLOW_WINDOW_CAPTURER_CHROMEOS_H_
...@@ -2262,7 +2262,7 @@ test("content_unittests") { ...@@ -2262,7 +2262,7 @@ test("content_unittests") {
] ]
if (is_chromeos) { if (is_chromeos) {
sources += [ sources += [
"../browser/media/capture/lame_capture_overlay_chromeos_unittest.cc", "../browser/media/capture/slow_capture_overlay_chromeos_unittest.cc",
] ]
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment