OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/test/test_video_renderer.h" | 5 #include "remoting/test/test_video_renderer.h" |
6 | 6 |
| 7 #include <stdint.h> |
| 8 |
7 #include <cmath> | 9 #include <cmath> |
8 | 10 |
| 11 #include "base/macros.h" |
9 #include "base/memory/scoped_vector.h" | 12 #include "base/memory/scoped_vector.h" |
10 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
11 #include "base/run_loop.h" | 14 #include "base/run_loop.h" |
12 #include "base/thread_task_runner_handle.h" | 15 #include "base/thread_task_runner_handle.h" |
13 #include "base/timer/timer.h" | 16 #include "base/timer/timer.h" |
14 #include "remoting/codec/video_encoder.h" | 17 #include "remoting/codec/video_encoder.h" |
15 #include "remoting/codec/video_encoder_verbatim.h" | 18 #include "remoting/codec/video_encoder_verbatim.h" |
16 #include "remoting/codec/video_encoder_vpx.h" | 19 #include "remoting/codec/video_encoder_vpx.h" |
17 #include "remoting/proto/video.pb.h" | 20 #include "remoting/proto/video.pb.h" |
18 #include "remoting/test/rgb_value.h" | 21 #include "remoting/test/rgb_value.h" |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 new webrtc::BasicDesktopFrame(screen_size)); | 339 new webrtc::BasicDesktopFrame(screen_size)); |
337 frame->mutable_updated_region()->SetRect( | 340 frame->mutable_updated_region()->SetRect( |
338 webrtc::DesktopRect::MakeSize(screen_size)); | 341 webrtc::DesktopRect::MakeSize(screen_size)); |
339 FillFrameWithGradient(frame.get()); | 342 FillFrameWithGradient(frame.get()); |
340 return frame.Pass(); | 343 return frame.Pass(); |
341 } | 344 } |
342 | 345 |
343 void TestVideoRendererTest::FillFrameWithGradient( | 346 void TestVideoRendererTest::FillFrameWithGradient( |
344 webrtc::DesktopFrame* frame) const { | 347 webrtc::DesktopFrame* frame) const { |
345 for (int y = 0; y < frame->size().height(); ++y) { | 348 for (int y = 0; y < frame->size().height(); ++y) { |
346 uint8* p = frame->data() + y * frame->stride(); | 349 uint8_t* p = frame->data() + y * frame->stride(); |
347 for (int x = 0; x < frame->size().width(); ++x) { | 350 for (int x = 0; x < frame->size().width(); ++x) { |
348 *p++ = (255.0 * x) / frame->size().width(); | 351 *p++ = (255.0 * x) / frame->size().width(); |
349 *p++ = (164.0 * y) / frame->size().height(); | 352 *p++ = (164.0 * y) / frame->size().height(); |
350 *p++ = (82.0 * (x + y)) / | 353 *p++ = (82.0 * (x + y)) / |
351 (frame->size().width() + frame->size().height()); | 354 (frame->size().width() + frame->size().height()); |
352 *p++ = 0; | 355 *p++ = 0; |
353 } | 356 } |
354 } | 357 } |
355 } | 358 } |
356 | 359 |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 TEST_F(TestVideoRendererTest, VerifyImagePatternNotMatchForVERBATIM) { | 504 TEST_F(TestVideoRendererTest, VerifyImagePatternNotMatchForVERBATIM) { |
502 encoder_.reset(new VideoEncoderVerbatim()); | 505 encoder_.reset(new VideoEncoderVerbatim()); |
503 test_video_renderer_->SetCodecForDecoding( | 506 test_video_renderer_->SetCodecForDecoding( |
504 protocol::ChannelConfig::Codec::CODEC_VERBATIM); | 507 protocol::ChannelConfig::Codec::CODEC_VERBATIM); |
505 TestImagePatternMatch(kDefaultScreenWidthPx, kDefaultScreenHeightPx, | 508 TestImagePatternMatch(kDefaultScreenWidthPx, kDefaultScreenHeightPx, |
506 kDefaultExpectedRect, false); | 509 kDefaultExpectedRect, false); |
507 } | 510 } |
508 | 511 |
509 } // namespace test | 512 } // namespace test |
510 } // namespace remoting | 513 } // namespace remoting |
OLD | NEW |