summaryrefslogtreecommitdiffstats
path: root/remoting
diff options
context:
space:
mode:
authorfischman@chromium.org <fischman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-11 00:17:16 +0000
committerfischman@chromium.org <fischman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-11 00:17:16 +0000
commitf402ba034d0a796bbb57655a3a0781922b6a8b16 (patch)
tree6291aabe2e9580fd61fcf4ea8cf56fb6411454f3 /remoting
parentc8c552d18c353fcea4ae92d815abd6549f4bb0f0 (diff)
downloadchromium_src-f402ba034d0a796bbb57655a3a0781922b6a8b16.zip
chromium_src-f402ba034d0a796bbb57655a3a0781922b6a8b16.tar.gz
chromium_src-f402ba034d0a796bbb57655a3a0781922b6a8b16.tar.bz2
Cull unnecessary media::VideoFrame::Formats from the enum.
This removes the easy ones: RGB555, RGB565, RGB24, RGBA, NV12, and ASCII. BUG=108306 TEST=videotestmatrix is still as happy as it was. Review URL: http://codereview.chromium.org/10024072 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@131682 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-rw-r--r--remoting/base/codec_test.cc3
-rw-r--r--remoting/base/encoder_row_based.cc3
-rw-r--r--remoting/base/util.cc21
-rw-r--r--remoting/base/util.h3
-rw-r--r--remoting/host/capturer_fake_ascii.cc86
-rw-r--r--remoting/host/capturer_fake_ascii.h61
-rw-r--r--remoting/remoting.gyp2
7 files changed, 8 insertions, 171 deletions
diff --git a/remoting/base/codec_test.cc b/remoting/base/codec_test.cc
index 5fd58ed..381fdf4 100644
--- a/remoting/base/codec_test.cc
+++ b/remoting/base/codec_test.cc
@@ -303,7 +303,8 @@ static void TestEncodeDecodeRects(Encoder* encoder,
// Generate random data for the updated region.
srand(0);
for (int i = 0; i < count; ++i) {
- const int bytes_per_pixel = GetBytesPerPixel(data->pixel_format());
+ CHECK_EQ(data->pixel_format(), media::VideoFrame::RGB32);
+ const int bytes_per_pixel = 4; // Because of RGB32 on previous line.
const int row_size = bytes_per_pixel * rects[i].width();
uint8* memory = data->data_planes().data[0] +
data->data_planes().strides[0] * rects[i].top() +
diff --git a/remoting/base/encoder_row_based.cc b/remoting/base/encoder_row_based.cc
index c84b38a..41d9e9e 100644
--- a/remoting/base/encoder_row_based.cc
+++ b/remoting/base/encoder_row_based.cc
@@ -80,8 +80,9 @@ void EncoderRowBased::Encode(
void EncoderRowBased::EncodeRect(const SkIRect& rect, bool last) {
CHECK(capture_data_->data_planes().data[0]);
+ CHECK_EQ(capture_data_->pixel_format(), media::VideoFrame::RGB32);
const int strides = capture_data_->data_planes().strides[0];
- const int bytes_per_pixel = GetBytesPerPixel(capture_data_->pixel_format());
+ const int bytes_per_pixel = 4;
const int row_size = bytes_per_pixel * rect.width();
compressor_->Reset();
diff --git a/remoting/base/util.cc b/remoting/base/util.cc
index 26886ca..b126f15 100644
--- a/remoting/base/util.cc
+++ b/remoting/base/util.cc
@@ -17,6 +17,8 @@ using media::VideoFrame;
namespace remoting {
+enum { kBytesPerPixelRGB32 = 4 };
+
// Do not write LOG messages in this routine since it is called from within
// our LOG message handler. Bad things will happen.
std::string GetTimestampString() {
@@ -28,24 +30,9 @@ std::string GetTimestampString() {
tex.hour, tex.minute, tex.second);
}
-int GetBytesPerPixel(VideoFrame::Format format) {
- // Note: The order is important here for performance. This is sorted from the
- // most common to the less common (PIXEL_FORMAT_ASCII is mostly used
- // just for testing).
- switch (format) {
- case VideoFrame::RGB24: return 3;
- case VideoFrame::RGB565: return 2;
- case VideoFrame::RGB32: return 4;
- case VideoFrame::ASCII: return 1;
- default:
- NOTREACHED() << "Pixel format not supported";
- return 0;
- }
-}
-
// Helper methods to calculate plane offset given the coordinates.
static int CalculateRGBOffset(int x, int y, int stride) {
- return stride * y + GetBytesPerPixel(media::VideoFrame::RGB32) * x;
+ return stride * y + kBytesPerPixelRGB32 * x;
}
static int CalculateYOffset(int x, int y, int stride) {
@@ -274,7 +261,7 @@ void CopyRGB32Rect(const uint8* source_buffer,
source_stride,
dest_buffer + dest_offset,
dest_stride,
- GetBytesPerPixel(media::VideoFrame::RGB32),
+ kBytesPerPixelRGB32,
SkIRect::MakeWH(dest_rect.width(), dest_rect.height()));
}
diff --git a/remoting/base/util.h b/remoting/base/util.h
index c4621cc..07b501b 100644
--- a/remoting/base/util.h
+++ b/remoting/base/util.h
@@ -15,9 +15,6 @@ namespace remoting {
// Return a string that contains the current date formatted as 'MMDD/HHMMSS:'.
std::string GetTimestampString();
-// TODO(sergeyu): Move these methods to media.
-int GetBytesPerPixel(media::VideoFrame::Format format);
-
// Convert and scale YUV to RGB32 on a specific rectangle. The source and
// destination buffers are assumed to contain only |source_buffer_rect| and
// |dest_buffer_rect| areas correspondingly. The scaling factor is determined
diff --git a/remoting/host/capturer_fake_ascii.cc b/remoting/host/capturer_fake_ascii.cc
deleted file mode 100644
index e0f5845..0000000
--- a/remoting/host/capturer_fake_ascii.cc
+++ /dev/null
@@ -1,86 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "remoting/host/capturer_fake_ascii.h"
-
-namespace remoting {
-
-static const int kWidth = 32;
-static const int kHeight = 20;
-static const int kBytesPerPixel = 1;
-
-CapturerFakeAscii::CapturerFakeAscii()
- : current_buffer_(0),
- pixel_format_(media::VideoFrame::ASCII) {
-}
-
-CapturerFakeAscii::~CapturerFakeAscii() {
-}
-
-void CapturerFakeAscii::ScreenConfigurationChanged() {
- width_ = kWidth;
- height_ = kHeight;
- bytes_per_row_ = width_ * kBytesPerPixel;
- pixel_format_ = media::VideoFrame::ASCII;
-
- // Create memory for the buffers.
- int buffer_size = height_ * bytes_per_row_;
- for (int i = 0; i < kNumBuffers; i++) {
- buffers_[i].reset(new uint8[buffer_size]);
- }
-}
-
-media::VideoFrame::Format CapturerFakeAscii::pixel_format() const {
- return pixel_format_;
-}
-
-void CapturerFakeAscii::ClearInvalidRegion() {
- helper_.ClearInvalidRegion();
-}
-
-void CapturerFakeAscii::InvalidateRegion(const SkRegion& invalid_region) {
- helper_.InvalidateRegion(invalid_region);
-}
-
-void CapturerFakeAscii::InvalidateScreen(const SkISize& size) {
- helper_.InvalidateScreen(size);
-}
-
-void CapturerFakeAscii::InvalidateFullScreen() {
- helper_.InvalidateFullScreen();
-}
-
-void CapturerFakeAscii::CaptureInvalidRegion(
- const CaptureCompletedCallback& callback) {
- GenerateImage();
- DataPlanes planes;
- planes.data[0] = buffers_[current_buffer_].get();
- current_buffer_ = (current_buffer_ + 1) % kNumBuffers;
- planes.strides[0] = bytes_per_row_;
- scoped_refptr<CaptureData> capture_data(new CaptureData(
- planes, SkISize::Make(width_, height_), pixel_format_));
-
- helper_.set_size_most_recent(capture_data->size());
-
- callback.Run(capture_data);
-}
-
-const SkISize& CapturerFakeAscii::size_most_recent() const {
- return helper_.size_most_recent();
-}
-
-void CapturerFakeAscii::GenerateImage() {
- for (int y = 0; y < height_; ++y) {
- uint8* row = buffers_[current_buffer_].get() + bytes_per_row_ * y;
- for (int x = 0; x < bytes_per_row_; ++x) {
- if (y == 0 || x == 0 || x == (width_ - 1) || y == (height_ - 1)) {
- row[x] = '*';
- } else {
- row[x] = ' ';
- }
- }
- }
-}
-
-} // namespace remoting
diff --git a/remoting/host/capturer_fake_ascii.h b/remoting/host/capturer_fake_ascii.h
deleted file mode 100644
index 5559197..0000000
--- a/remoting/host/capturer_fake_ascii.h
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef REMOTING_HOST_CAPTURER_FAKE_ASCII_H_
-#define REMOTING_HOST_CAPTURER_FAKE_ASCII_H_
-
-#include "base/memory/scoped_ptr.h"
-#include "remoting/host/capturer.h"
-#include "remoting/host/capturer_helper.h"
-
-namespace remoting {
-
-// A CapturerFakeAscii always outputs an image of 64x48 ASCII characters.
-// This image is artificially generated for testing purpose.
-//
-// CapturerFakeAscii is doubled buffered as required by Capturer. See
-// remoting/host/capturer.h.
-class CapturerFakeAscii : public Capturer {
- public:
- CapturerFakeAscii();
- virtual ~CapturerFakeAscii();
-
- // Capturer interface.
- virtual void ScreenConfigurationChanged() OVERRIDE;
- virtual media::VideoFrame::Format pixel_format() const OVERRIDE;
- virtual void ClearInvalidRegion() OVERRIDE;
- virtual void InvalidateRegion(const SkRegion& invalid_region) OVERRIDE;
- virtual void InvalidateScreen(const SkISize& size) OVERRIDE;
- virtual void InvalidateFullScreen() OVERRIDE;
- virtual void CaptureInvalidRegion(
- const CaptureCompletedCallback& callback) OVERRIDE;
- virtual const SkISize& size_most_recent() const OVERRIDE;
-
- private:
- // Generates an image in the front buffer.
- void GenerateImage();
-
- // The screen dimensions.
- int width_;
- int height_;
- int bytes_per_row_;
-
- CapturerHelper helper_;
-
- // We have two buffers for the screen images as required by Capturer.
- static const int kNumBuffers = 2;
- scoped_array<uint8> buffers_[kNumBuffers];
-
- // The current buffer with valid data for reading.
- int current_buffer_;
-
- // Format of pixels returned in buffer.
- media::VideoFrame::Format pixel_format_;
-
- DISALLOW_COPY_AND_ASSIGN(CapturerFakeAscii);
-};
-
-} // namespace remoting
-
-#endif // REMOTING_HOST_CAPTURER_FAKE_ASCII_H_
diff --git a/remoting/remoting.gyp b/remoting/remoting.gyp
index bb2d586..2fe3b4e 100644
--- a/remoting/remoting.gyp
+++ b/remoting/remoting.gyp
@@ -971,8 +971,6 @@
'../media/media.gyp:media',
],
'sources': [
- 'host/capturer_fake_ascii.cc',
- 'host/capturer_fake_ascii.h',
'host/continue_window.h',
'host/continue_window_mac.mm',
'host/continue_window_linux.cc',