OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "remoting/capturer/video_frame_capturer_fake.h" | 5 #include "remoting/capturer/video_frame_capturer_fake.h" |
6 | 6 |
7 #include "base/time.h" | 7 #include "base/time.h" |
8 #include "remoting/capturer/capture_data.h" | 8 #include "remoting/capturer/capture_data.h" |
9 | 9 |
10 namespace remoting { | 10 namespace remoting { |
11 | 11 |
12 // VideoFrameCapturerFake generates a white picture of size kWidth x kHeight | 12 // VideoFrameCapturerFake generates a white picture of size kWidth x kHeight |
13 // with a rectangle of size kBoxWidth x kBoxHeight. The rectangle moves kSpeed | 13 // with a rectangle of size kBoxWidth x kBoxHeight. The rectangle moves kSpeed |
14 // pixels per frame along both axes, and bounces off the sides of the screen. | 14 // pixels per frame along both axes, and bounces off the sides of the screen. |
15 static const int kWidth = VideoFrameCapturerFake::kWidth; | 15 static const int kWidth = 800; |
16 static const int kHeight = VideoFrameCapturerFake::kHeight; | 16 static const int kHeight = 600; |
17 static const int kBoxWidth = 140; | 17 static const int kBoxWidth = 140; |
18 static const int kBoxHeight = 140; | 18 static const int kBoxHeight = 140; |
19 static const int kSpeed = 20; | 19 static const int kSpeed = 20; |
20 | 20 |
21 COMPILE_ASSERT(kBoxWidth < kWidth && kBoxHeight < kHeight, bad_box_size); | 21 COMPILE_ASSERT(kBoxWidth < kWidth && kBoxHeight < kHeight, bad_box_size); |
22 COMPILE_ASSERT((kBoxWidth % kSpeed == 0) && (kWidth % kSpeed == 0) && | 22 COMPILE_ASSERT((kBoxWidth % kSpeed == 0) && (kWidth % kSpeed == 0) && |
23 (kBoxHeight % kSpeed == 0) && (kHeight % kSpeed == 0), | 23 (kBoxHeight % kSpeed == 0) && (kHeight % kSpeed == 0), |
24 sizes_must_be_multiple_of_kSpeed); | 24 sizes_must_be_multiple_of_kSpeed); |
25 | 25 |
26 VideoFrameCapturerFake::VideoFrameCapturerFake() | 26 VideoFrameCapturerFake::VideoFrameCapturerFake() |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 bytes_per_row_ = size_.width() * CaptureData::kBytesPerPixel; | 108 bytes_per_row_ = size_.width() * CaptureData::kBytesPerPixel; |
109 | 109 |
110 // Create memory for the buffers. | 110 // Create memory for the buffers. |
111 int buffer_size = size_.height() * bytes_per_row_; | 111 int buffer_size = size_.height() * bytes_per_row_; |
112 for (int i = 0; i < kNumBuffers; i++) { | 112 for (int i = 0; i < kNumBuffers; i++) { |
113 buffers_[i].reset(new uint8[buffer_size]); | 113 buffers_[i].reset(new uint8[buffer_size]); |
114 } | 114 } |
115 } | 115 } |
116 | 116 |
117 } // namespace remoting | 117 } // namespace remoting |
OLD | NEW |