Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 <deque> | 5 #include <deque> |
| 6 #include <stdlib.h> | 6 #include <stdlib.h> |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | |
| 8 #include "media/base/video_frame.h" | 9 #include "media/base/video_frame.h" |
| 9 #include "remoting/base/base_mock_objects.h" | 10 #include "remoting/base/base_mock_objects.h" |
| 10 #include "remoting/base/codec_test.h" | 11 #include "remoting/base/codec_test.h" |
| 11 #include "remoting/base/decoder.h" | 12 #include "remoting/base/decoder.h" |
| 12 #include "remoting/base/encoder.h" | 13 #include "remoting/base/encoder.h" |
| 13 #include "remoting/base/util.h" | 14 #include "remoting/base/util.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 15 #include "ui/gfx/rect.h" | |
| 16 | 16 |
| 17 static const int kWidth = 320; | 17 static const int kWidth = 320; |
| 18 static const int kHeight = 240; | 18 static const int kHeight = 240; |
| 19 static const int kBytesPerPixel = 4; | 19 static const int kBytesPerPixel = 4; |
| 20 | 20 |
| 21 // Some sample rects for testing. | 21 // Some sample rects for testing. |
| 22 static const gfx::Rect kTestRects[] = { | 22 static const SkIRect kTestRects[] = { |
| 23 gfx::Rect(0, 0, kWidth, kHeight), | 23 SkIRect::MakeXYWH(0, 0, kWidth, kHeight), |
| 24 gfx::Rect(0, 0, kWidth / 2, kHeight / 2), | 24 SkIRect::MakeXYWH(0, 0, kWidth / 2, kHeight / 2), |
| 25 gfx::Rect(kWidth / 2, kHeight / 2, kWidth / 2, kHeight / 2), | 25 SkIRect::MakeXYWH(kWidth / 2, kHeight / 2, kWidth / 2, kHeight / 2), |
| 26 gfx::Rect(16, 16, 16, 16), | 26 SkIRect::MakeXYWH(16, 16, 16, 16), |
| 27 gfx::Rect(128, 64, 32, 32), | 27 SkIRect::MakeXYWH(128, 64, 32, 32), |
| 28 }; | 28 }; |
| 29 | 29 |
| 30 namespace remoting { | 30 namespace remoting { |
| 31 | 31 |
| 32 // A class to test the message output of the encoder. | 32 // A class to test the message output of the encoder. |
| 33 class EncoderMessageTester { | 33 class EncoderMessageTester { |
| 34 public: | 34 public: |
| 35 EncoderMessageTester() | 35 EncoderMessageTester() |
| 36 : begin_rect_(0), | 36 : begin_rect_(0), |
| 37 rect_data_(0), | 37 rect_data_(0), |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 51 } | 51 } |
| 52 | 52 |
| 53 // Test that we received the correct packet. | 53 // Test that we received the correct packet. |
| 54 void ReceivedPacket(VideoPacket* packet) { | 54 void ReceivedPacket(VideoPacket* packet) { |
| 55 if (state_ == kWaitingForBeginRect) { | 55 if (state_ == kWaitingForBeginRect) { |
| 56 EXPECT_TRUE((packet->flags() & VideoPacket::FIRST_PACKET) != 0); | 56 EXPECT_TRUE((packet->flags() & VideoPacket::FIRST_PACKET) != 0); |
| 57 state_ = kWaitingForRectData; | 57 state_ = kWaitingForRectData; |
| 58 ++begin_rect_; | 58 ++begin_rect_; |
| 59 | 59 |
| 60 if (strict_) { | 60 if (strict_) { |
| 61 gfx::Rect rect = rects_.front(); | 61 SkIRect rect = rects_.front(); |
| 62 rects_.pop_front(); | 62 rects_.pop_front(); |
| 63 EXPECT_EQ(rect.x(), packet->format().x()); | 63 EXPECT_EQ(rect.fLeft, packet->format().x()); |
| 64 EXPECT_EQ(rect.y(), packet->format().y()); | 64 EXPECT_EQ(rect.fTop, packet->format().y()); |
| 65 EXPECT_EQ(rect.width(), packet->format().width()); | 65 EXPECT_EQ(rect.width(), packet->format().width()); |
| 66 EXPECT_EQ(rect.height(), packet->format().height()); | 66 EXPECT_EQ(rect.height(), packet->format().height()); |
| 67 } | 67 } |
| 68 } else { | 68 } else { |
| 69 EXPECT_FALSE((packet->flags() & VideoPacket::FIRST_PACKET) != 0); | 69 EXPECT_FALSE((packet->flags() & VideoPacket::FIRST_PACKET) != 0); |
| 70 } | 70 } |
| 71 | 71 |
| 72 if (state_ == kWaitingForRectData) { | 72 if (state_ == kWaitingForRectData) { |
| 73 if (packet->has_data()) { | 73 if (packet->has_data()) { |
| 74 ++rect_data_; | 74 ++rect_data_; |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 86 // LAST_PARTITION must always be marked with LAST_PACKET. | 86 // LAST_PARTITION must always be marked with LAST_PACKET. |
| 87 EXPECT_TRUE((packet->flags() & VideoPacket::LAST_PACKET) != 0); | 87 EXPECT_TRUE((packet->flags() & VideoPacket::LAST_PACKET) != 0); |
| 88 } | 88 } |
| 89 } | 89 } |
| 90 } | 90 } |
| 91 | 91 |
| 92 void set_strict(bool strict) { | 92 void set_strict(bool strict) { |
| 93 strict_ = strict; | 93 strict_ = strict; |
| 94 } | 94 } |
| 95 | 95 |
| 96 void AddRects(const gfx::Rect* rects, int count) { | 96 void AddRects(const SkIRect* rects, int count) { |
| 97 rects_.insert(rects_.begin() + rects_.size(), rects, rects + count); | 97 rects_.insert(rects_.begin() + rects_.size(), rects, rects + count); |
| 98 added_rects_ += count; | 98 added_rects_ += count; |
| 99 } | 99 } |
| 100 | 100 |
| 101 private: | 101 private: |
| 102 enum State { | 102 enum State { |
| 103 kWaitingForBeginRect, | 103 kWaitingForBeginRect, |
| 104 kWaitingForRectData, | 104 kWaitingForRectData, |
| 105 }; | 105 }; |
| 106 | 106 |
| 107 int begin_rect_; | 107 int begin_rect_; |
| 108 int rect_data_; | 108 int rect_data_; |
| 109 int end_rect_; | 109 int end_rect_; |
| 110 int added_rects_; | 110 int added_rects_; |
| 111 State state_; | 111 State state_; |
| 112 bool strict_; | 112 bool strict_; |
| 113 | 113 |
| 114 std::deque<gfx::Rect> rects_; | 114 std::deque<SkIRect> rects_; |
| 115 | 115 |
| 116 DISALLOW_COPY_AND_ASSIGN(EncoderMessageTester); | 116 DISALLOW_COPY_AND_ASSIGN(EncoderMessageTester); |
| 117 }; | 117 }; |
| 118 | 118 |
| 119 class DecoderTester { | 119 class DecoderTester { |
| 120 public: | 120 public: |
| 121 DecoderTester(Decoder* decoder) | 121 DecoderTester(Decoder* decoder) |
| 122 : strict_(false), | 122 : strict_(false), |
| 123 decoder_(decoder) { | 123 decoder_(decoder) { |
| 124 frame_ = media::VideoFrame::CreateFrame(media::VideoFrame::RGB32, | 124 frame_ = media::VideoFrame::CreateFrame(media::VideoFrame::RGB32, |
| 125 kWidth, kHeight, | 125 kWidth, kHeight, |
| 126 base::TimeDelta(), | 126 base::TimeDelta(), |
| 127 base::TimeDelta()); | 127 base::TimeDelta()); |
| 128 EXPECT_TRUE(frame_.get()); | 128 EXPECT_TRUE(frame_.get()); |
| 129 decoder_->Initialize(frame_); | 129 decoder_->Initialize(frame_); |
| 130 } | 130 } |
| 131 | 131 |
| 132 void Reset() { | 132 void Reset() { |
| 133 rects_.clear(); | 133 rects_.clear(); |
| 134 update_rects_.clear(); | 134 update_rects_.clear(); |
| 135 } | 135 } |
| 136 | 136 |
| 137 void ReceivedPacket(VideoPacket* packet) { | 137 void ReceivedPacket(VideoPacket* packet) { |
| 138 Decoder::DecodeResult result = decoder_->DecodePacket(packet); | 138 Decoder::DecodeResult result = decoder_->DecodePacket(packet); |
| 139 | 139 |
| 140 ASSERT_NE(Decoder::DECODE_ERROR, result); | 140 ASSERT_NE(Decoder::DECODE_ERROR, result); |
| 141 | 141 |
| 142 if (result == Decoder::DECODE_DONE) { | 142 if (result == Decoder::DECODE_DONE) { |
| 143 decoder_->GetUpdatedRects(&update_rects_); | 143 decoder_->GetUpdatedRects(&update_rects_); |
|
Wez
2011/08/08 20:49:34
Shouldn't this change to GetUpdatedRegion()?
dmac
2011/08/10 20:30:36
I didn't want to switch over the decoder on this C
| |
| 144 } | 144 } |
| 145 } | 145 } |
| 146 | 146 |
| 147 void set_strict(bool strict) { | 147 void set_strict(bool strict) { |
| 148 strict_ = strict; | 148 strict_ = strict; |
| 149 } | 149 } |
| 150 | 150 |
| 151 void set_capture_data(scoped_refptr<CaptureData> data) { | 151 void set_capture_data(scoped_refptr<CaptureData> data) { |
| 152 capture_data_ = data; | 152 capture_data_ = data; |
| 153 } | 153 } |
| 154 | 154 |
| 155 void AddRects(const gfx::Rect* rects, int count) { | 155 void AddRects(const SkIRect* rects, int count) { |
| 156 rects_.insert(rects_.begin() + rects_.size(), rects, rects + count); | 156 rects_.insert(rects_.begin() + rects_.size(), rects, rects + count); |
| 157 } | 157 } |
| 158 | 158 |
| 159 void VerifyResults() { | 159 void VerifyResults() { |
| 160 if (!strict_) | 160 if (!strict_) |
| 161 return; | 161 return; |
| 162 | 162 |
| 163 ASSERT_TRUE(capture_data_.get()); | 163 ASSERT_TRUE(capture_data_.get()); |
| 164 | 164 |
| 165 // Test the content of the update rect. | 165 // Test the content of the update rect. |
| 166 ASSERT_EQ(rects_.size(), update_rects_.size()); | 166 ASSERT_EQ(rects_.size(), update_rects_.size()); |
| 167 for (size_t i = 0; i < update_rects_.size(); ++i) { | 167 for (size_t i = 0; i < update_rects_.size(); ++i) { |
| 168 gfx::Rect rect = rects_[i]; | 168 SkIRect &r = rects_[i]; |
| 169 gfx::Rect rect(r.fLeft, r.fTop, r.width(), r.height()); | |
| 169 EXPECT_EQ(rect, update_rects_[i]); | 170 EXPECT_EQ(rect, update_rects_[i]); |
| 170 | 171 |
| 171 EXPECT_EQ(frame_->stride(0), capture_data_->data_planes().strides[0]); | 172 EXPECT_EQ(frame_->stride(0), capture_data_->data_planes().strides[0]); |
| 172 const int stride = frame_->stride(0); | 173 const int stride = frame_->stride(0); |
| 173 const int offset = stride * update_rects_[i].y() + | 174 const int offset = stride * update_rects_[i].y() + |
| 174 kBytesPerPixel * update_rects_[i].x(); | 175 kBytesPerPixel * update_rects_[i].x(); |
| 175 const uint8* original = capture_data_->data_planes().data[0] + offset; | 176 const uint8* original = capture_data_->data_planes().data[0] + offset; |
| 176 const uint8* decoded = frame_->data(0) + offset; | 177 const uint8* decoded = frame_->data(0) + offset; |
| 177 const int row_size = kBytesPerPixel * update_rects_[i].width(); | 178 const int row_size = kBytesPerPixel * update_rects_[i].width(); |
| 178 for (int y = 0; y < update_rects_[i].height(); ++y) { | 179 for (int y = 0; y < update_rects_[i].height(); ++y) { |
| 179 EXPECT_EQ(0, memcmp(original, decoded, row_size)) | 180 EXPECT_EQ(0, memcmp(original, decoded, row_size)) |
| 180 << "Row " << y << " is different"; | 181 << "Row " << y << " is different"; |
| 181 original += stride; | 182 original += stride; |
| 182 decoded += stride; | 183 decoded += stride; |
| 183 } | 184 } |
| 184 } | 185 } |
| 185 } | 186 } |
| 186 | 187 |
| 187 private: | 188 private: |
| 188 bool strict_; | 189 bool strict_; |
| 189 std::deque<gfx::Rect> rects_; | 190 std::deque<SkIRect> rects_; |
| 190 UpdatedRects update_rects_; | 191 UpdatedRects update_rects_; |
| 191 Decoder* decoder_; | 192 Decoder* decoder_; |
| 192 scoped_refptr<media::VideoFrame> frame_; | 193 scoped_refptr<media::VideoFrame> frame_; |
| 193 scoped_refptr<CaptureData> capture_data_; | 194 scoped_refptr<CaptureData> capture_data_; |
| 194 | 195 |
| 195 DISALLOW_COPY_AND_ASSIGN(DecoderTester); | 196 DISALLOW_COPY_AND_ASSIGN(DecoderTester); |
| 196 }; | 197 }; |
| 197 | 198 |
| 198 // The EncoderTester provides a hook for retrieving the data, and passing the | 199 // The EncoderTester provides a hook for retrieving the data, and passing the |
| 199 // message to other subprograms for validaton. | 200 // message to other subprograms for validaton. |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 214 message_tester_->ReceivedPacket(packet); | 215 message_tester_->ReceivedPacket(packet); |
| 215 | 216 |
| 216 // Send the message to the DecoderTester. | 217 // Send the message to the DecoderTester. |
| 217 if (decoder_tester_) { | 218 if (decoder_tester_) { |
| 218 decoder_tester_->ReceivedPacket(packet); | 219 decoder_tester_->ReceivedPacket(packet); |
| 219 } | 220 } |
| 220 | 221 |
| 221 delete packet; | 222 delete packet; |
| 222 } | 223 } |
| 223 | 224 |
| 224 void AddRects(const gfx::Rect* rects, int count) { | 225 void AddRects(const SkIRect* rects, int count) { |
| 225 message_tester_->AddRects(rects, count); | 226 message_tester_->AddRects(rects, count); |
| 226 } | 227 } |
| 227 | 228 |
| 228 void set_decoder_tester(DecoderTester* decoder_tester) { | 229 void set_decoder_tester(DecoderTester* decoder_tester) { |
| 229 decoder_tester_ = decoder_tester; | 230 decoder_tester_ = decoder_tester; |
| 230 } | 231 } |
| 231 | 232 |
| 232 private: | 233 private: |
| 233 EncoderMessageTester* message_tester_; | 234 EncoderMessageTester* message_tester_; |
| 234 DecoderTester* decoder_tester_; | 235 DecoderTester* decoder_tester_; |
| 235 int data_available_; | 236 int data_available_; |
| 236 | 237 |
| 237 DISALLOW_COPY_AND_ASSIGN(EncoderTester); | 238 DISALLOW_COPY_AND_ASSIGN(EncoderTester); |
| 238 }; | 239 }; |
| 239 | 240 |
| 240 scoped_refptr<CaptureData> PrepareEncodeData(media::VideoFrame::Format format, | 241 scoped_refptr<CaptureData> PrepareEncodeData(media::VideoFrame::Format format, |
| 241 uint8** memory) { | 242 uint8** memory) { |
|
Wez
2011/08/08 20:49:34
nit: Making this a scoped_array<uint8>* seems clea
dmac
2011/08/10 20:30:36
http://crbug.com/92086
| |
| 242 // TODO(hclam): Support also YUV format. | 243 // TODO(hclam): Support also YUV format. |
| 243 CHECK_EQ(format, media::VideoFrame::RGB32); | 244 CHECK_EQ(format, media::VideoFrame::RGB32); |
| 244 int size = kWidth * kHeight * kBytesPerPixel; | 245 int size = kWidth * kHeight * kBytesPerPixel; |
| 245 | 246 |
| 246 *memory = new uint8[size]; | 247 *memory = new uint8[size]; |
| 247 srand(0); | 248 srand(0); |
| 248 for (int i = 0; i < size; ++i) { | 249 for (int i = 0; i < size; ++i) { |
| 249 (*memory)[i] = rand() % 256; | 250 (*memory)[i] = rand() % 256; |
| 250 } | 251 } |
| 251 | 252 |
| 252 DataPlanes planes; | 253 DataPlanes planes; |
| 253 memset(planes.data, 0, sizeof(planes.data)); | 254 memset(planes.data, 0, sizeof(planes.data)); |
| 254 memset(planes.strides, 0, sizeof(planes.strides)); | 255 memset(planes.strides, 0, sizeof(planes.strides)); |
| 255 planes.data[0] = *memory; | 256 planes.data[0] = *memory; |
| 256 planes.strides[0] = kWidth * kBytesPerPixel; | 257 planes.strides[0] = kWidth * kBytesPerPixel; |
| 257 | 258 |
| 258 scoped_refptr<CaptureData> data = | 259 scoped_refptr<CaptureData> data = |
| 259 new CaptureData(planes, gfx::Size(kWidth, kHeight), format); | 260 new CaptureData(planes, gfx::Size(kWidth, kHeight), format); |
| 260 return data; | 261 return data; |
| 261 } | 262 } |
| 262 | 263 |
| 263 static void TestEncodingRects(Encoder* encoder, | 264 static void TestEncodingRects(Encoder* encoder, |
| 264 EncoderTester* tester, | 265 EncoderTester* tester, |
| 265 scoped_refptr<CaptureData> data, | 266 scoped_refptr<CaptureData> data, |
| 266 const gfx::Rect* rects, int count) { | 267 const SkIRect* rects, int count) { |
| 267 data->mutable_dirty_rects().clear(); | 268 data->mutable_dirty_region().setEmpty(); |
| 268 for (int i = 0; i < count; ++i) { | 269 for (int i = 0; i < count; ++i) { |
| 269 data->mutable_dirty_rects().insert(rects[i]); | 270 data->mutable_dirty_region().op(rects[i], SkRegion::kUnion_Op); |
| 270 } | 271 } |
| 271 tester->AddRects(rects, count); | 272 tester->AddRects(rects, count); |
| 272 | 273 |
| 273 encoder->Encode(data, true, | 274 encoder->Encode(data, true, |
| 274 NewCallback(tester, &EncoderTester::DataAvailable)); | 275 NewCallback(tester, &EncoderTester::DataAvailable)); |
| 275 } | 276 } |
| 276 | 277 |
| 277 void TestEncoder(Encoder* encoder, bool strict) { | 278 void TestEncoder(Encoder* encoder, bool strict) { |
| 278 EncoderMessageTester message_tester; | 279 EncoderMessageTester message_tester; |
| 279 message_tester.set_strict(strict); | 280 message_tester.set_strict(strict); |
| 280 | 281 |
| 281 EncoderTester tester(&message_tester); | 282 EncoderTester tester(&message_tester); |
| 282 | 283 |
| 283 uint8* memory; | 284 uint8* memory; |
| 284 scoped_refptr<CaptureData> data = | 285 scoped_refptr<CaptureData> data = |
| 285 PrepareEncodeData(media::VideoFrame::RGB32, &memory); | 286 PrepareEncodeData(media::VideoFrame::RGB32, &memory); |
| 287 scoped_array<uint8> memory_wrapper(memory); | |
| 286 | 288 |
| 287 TestEncodingRects(encoder, &tester, data, kTestRects, 1); | 289 TestEncodingRects(encoder, &tester, data, kTestRects, 1); |
| 288 TestEncodingRects(encoder, &tester, data, kTestRects + 1, 1); | 290 TestEncodingRects(encoder, &tester, data, kTestRects + 1, 1); |
| 289 TestEncodingRects(encoder, &tester, data, kTestRects + 2, 1); | 291 TestEncodingRects(encoder, &tester, data, kTestRects + 2, 1); |
| 290 TestEncodingRects(encoder, &tester, data, kTestRects + 3, 2); | 292 TestEncodingRects(encoder, &tester, data, kTestRects + 3, 2); |
| 291 delete [] memory; | |
| 292 } | 293 } |
| 293 | 294 |
| 294 static void TestEncodingRects(Encoder* encoder, | 295 static void TestEncodingRects(Encoder* encoder, |
| 295 EncoderTester* encoder_tester, | 296 EncoderTester* encoder_tester, |
| 296 DecoderTester* decoder_tester, | 297 DecoderTester* decoder_tester, |
| 297 scoped_refptr<CaptureData> data, | 298 scoped_refptr<CaptureData> data, |
| 298 const gfx::Rect* rects, int count) { | 299 const SkIRect* rects, int count) { |
| 299 data->mutable_dirty_rects().clear(); | 300 data->mutable_dirty_region().setEmpty(); |
| 300 for (int i = 0; i < count; ++i) { | 301 for (int i = 0; i < count; ++i) { |
| 301 data->mutable_dirty_rects().insert(rects[i]); | 302 data->mutable_dirty_region().op(rects[i], SkRegion::kUnion_Op); |
| 302 } | 303 } |
| 303 encoder_tester->AddRects(rects, count); | 304 encoder_tester->AddRects(rects, count); |
| 304 decoder_tester->AddRects(rects, count); | 305 decoder_tester->AddRects(rects, count); |
| 305 | 306 |
| 306 // Generate random data for the updated rects. | 307 // Generate random data for the updated rects. |
| 307 srand(0); | 308 srand(0); |
| 308 for (int i = 0; i < count; ++i) { | 309 for (int i = 0; i < count; ++i) { |
| 309 const gfx::Rect rect = rects[i]; | 310 const SkIRect& rect = rects[i]; |
| 310 const int bytes_per_pixel = GetBytesPerPixel(data->pixel_format()); | 311 const int bytes_per_pixel = GetBytesPerPixel(data->pixel_format()); |
| 311 const int row_size = bytes_per_pixel * rect.width(); | 312 const int row_size = bytes_per_pixel * rect.width(); |
| 312 uint8* memory = data->data_planes().data[0] + | 313 uint8* memory = data->data_planes().data[0] + |
| 313 data->data_planes().strides[0] * rect.y() + | 314 data->data_planes().strides[0] * rect.fTop + |
| 314 bytes_per_pixel * rect.x(); | 315 bytes_per_pixel * rect.fLeft; |
| 315 for (int y = 0; y < rect.height(); ++y) { | 316 for (int y = 0; y < rect.height(); ++y) { |
| 316 for (int x = 0; x < row_size; ++x) | 317 for (int x = 0; x < row_size; ++x) |
| 317 memory[x] = rand() % 256; | 318 memory[x] = rand() % 256; |
| 318 memory += data->data_planes().strides[0]; | 319 memory += data->data_planes().strides[0]; |
| 319 } | 320 } |
| 320 } | 321 } |
| 321 | 322 |
| 322 encoder->Encode(data, true, | 323 encoder->Encode(data, true, |
| 323 NewCallback(encoder_tester, &EncoderTester::DataAvailable)); | 324 NewCallback(encoder_tester, &EncoderTester::DataAvailable)); |
| 324 decoder_tester->VerifyResults(); | 325 decoder_tester->VerifyResults(); |
| 325 decoder_tester->Reset(); | 326 decoder_tester->Reset(); |
| 326 } | 327 } |
| 327 | 328 |
| 328 void TestEncoderDecoder(Encoder* encoder, Decoder* decoder, bool strict) { | 329 void TestEncoderDecoder(Encoder* encoder, Decoder* decoder, bool strict) { |
| 329 EncoderMessageTester message_tester; | 330 EncoderMessageTester message_tester; |
| 330 message_tester.set_strict(strict); | 331 message_tester.set_strict(strict); |
| 331 | 332 |
| 332 EncoderTester encoder_tester(&message_tester); | 333 EncoderTester encoder_tester(&message_tester); |
| 333 | 334 |
| 334 uint8* memory; | 335 uint8* memory; |
| 335 scoped_refptr<CaptureData> data = | 336 scoped_refptr<CaptureData> data = |
| 336 PrepareEncodeData(media::VideoFrame::RGB32, &memory); | 337 PrepareEncodeData(media::VideoFrame::RGB32, &memory); |
| 338 scoped_array<uint8> memory_wrapper(memory); | |
| 339 | |
| 337 DecoderTester decoder_tester(decoder); | 340 DecoderTester decoder_tester(decoder); |
| 338 decoder_tester.set_strict(strict); | 341 decoder_tester.set_strict(strict); |
| 339 decoder_tester.set_capture_data(data); | 342 decoder_tester.set_capture_data(data); |
| 340 encoder_tester.set_decoder_tester(&decoder_tester); | 343 encoder_tester.set_decoder_tester(&decoder_tester); |
| 341 | 344 |
| 342 TestEncodingRects(encoder, &encoder_tester, &decoder_tester, data, | 345 TestEncodingRects(encoder, &encoder_tester, &decoder_tester, data, |
| 343 kTestRects, 1); | 346 kTestRects, 1); |
| 344 TestEncodingRects(encoder, &encoder_tester, &decoder_tester, data, | 347 TestEncodingRects(encoder, &encoder_tester, &decoder_tester, data, |
| 345 kTestRects + 1, 1); | 348 kTestRects + 1, 1); |
| 346 TestEncodingRects(encoder, &encoder_tester, &decoder_tester, data, | 349 TestEncodingRects(encoder, &encoder_tester, &decoder_tester, data, |
| 347 kTestRects + 2, 1); | 350 kTestRects + 2, 1); |
| 348 TestEncodingRects(encoder, &encoder_tester, &decoder_tester, data, | 351 TestEncodingRects(encoder, &encoder_tester, &decoder_tester, data, |
| 349 kTestRects + 3, 2); | 352 kTestRects + 3, 2); |
| 350 delete [] memory; | |
| 351 } | 353 } |
| 352 | 354 |
| 353 } // namespace remoting | 355 } // namespace remoting |
| 354 | 356 |
| 355 DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::DecoderTester); | 357 DISABLE_RUNNABLE_METHOD_REFCOUNT(remoting::DecoderTester); |
| OLD | NEW |