| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 // This test generate synthetic data. For audio it's a sinusoid waveform with | 5 // This test generate synthetic data. For audio it's a sinusoid waveform with |
| 6 // frequency kSoundFrequency and different amplitudes. For video it's a pattern | 6 // frequency kSoundFrequency and different amplitudes. For video it's a pattern |
| 7 // that is shifting by one pixel per frame, each pixels neighbors right and down | 7 // that is shifting by one pixel per frame, each pixels neighbors right and down |
| 8 // is this pixels value +1, since the pixel value is 8 bit it will wrap | 8 // is this pixels value +1, since the pixel value is 8 bit it will wrap |
| 9 // frequently within the image. Visually this will create diagonally color bands | 9 // frequently within the image. Visually this will create diagonally color bands |
| 10 // that moves across the screen | 10 // that moves across the screen |
| 11 | 11 |
| 12 #include <math.h> | 12 #include <math.h> |
| 13 #include <stddef.h> | 13 #include <stddef.h> |
| 14 #include <stdint.h> | 14 #include <stdint.h> |
| 15 | 15 |
| 16 #include <algorithm> | 16 #include <algorithm> |
| 17 #include <functional> | 17 #include <functional> |
| 18 #include <list> | 18 #include <list> |
| 19 #include <map> | 19 #include <map> |
| 20 #include <utility> | 20 #include <utility> |
| 21 | 21 |
| 22 #include "base/bind.h" | 22 #include "base/bind.h" |
| 23 #include "base/bind_helpers.h" | 23 #include "base/bind_helpers.h" |
| 24 #include "base/strings/string_number_conversions.h" | 24 #include "base/strings/string_number_conversions.h" |
| 25 #include "base/sys_byteorder.h" | 25 #include "base/sys_byteorder.h" |
| 26 #include "base/test/simple_test_tick_clock.h" | 26 #include "base/test/simple_test_tick_clock.h" |
| 27 #include "base/time/tick_clock.h" | 27 #include "base/time/tick_clock.h" |
| 28 #include "media/base/audio_bus.h" | 28 #include "media/base/audio_bus.h" |
| 29 #include "media/base/fake_single_thread_task_runner.h" |
| 29 #include "media/base/video_frame.h" | 30 #include "media/base/video_frame.h" |
| 30 #include "media/cast/cast_config.h" | 31 #include "media/cast/cast_config.h" |
| 31 #include "media/cast/cast_environment.h" | 32 #include "media/cast/cast_environment.h" |
| 32 #include "media/cast/cast_receiver.h" | 33 #include "media/cast/cast_receiver.h" |
| 33 #include "media/cast/cast_sender.h" | 34 #include "media/cast/cast_sender.h" |
| 34 #include "media/cast/logging/simple_event_subscriber.h" | 35 #include "media/cast/logging/simple_event_subscriber.h" |
| 35 #include "media/cast/net/cast_transport_config.h" | 36 #include "media/cast/net/cast_transport_config.h" |
| 36 #include "media/cast/net/cast_transport_defines.h" | 37 #include "media/cast/net/cast_transport_defines.h" |
| 37 #include "media/cast/net/cast_transport_sender.h" | 38 #include "media/cast/net/cast_transport_sender.h" |
| 38 #include "media/cast/net/cast_transport_sender_impl.h" | 39 #include "media/cast/net/cast_transport_sender_impl.h" |
| 39 #include "media/cast/test/fake_single_thread_task_runner.h" | |
| 40 #include "media/cast/test/skewed_single_thread_task_runner.h" | 40 #include "media/cast/test/skewed_single_thread_task_runner.h" |
| 41 #include "media/cast/test/skewed_tick_clock.h" | 41 #include "media/cast/test/skewed_tick_clock.h" |
| 42 #include "media/cast/test/utility/audio_utility.h" | 42 #include "media/cast/test/utility/audio_utility.h" |
| 43 #include "media/cast/test/utility/default_config.h" | 43 #include "media/cast/test/utility/default_config.h" |
| 44 #include "media/cast/test/utility/udp_proxy.h" | 44 #include "media/cast/test/utility/udp_proxy.h" |
| 45 #include "media/cast/test/utility/video_utility.h" | 45 #include "media/cast/test/utility/video_utility.h" |
| 46 #include "testing/gtest/include/gtest/gtest.h" | 46 #include "testing/gtest/include/gtest/gtest.h" |
| 47 | 47 |
| 48 namespace media { | 48 namespace media { |
| 49 namespace cast { | 49 namespace cast { |
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 // send those through the sender and receiver and analyzes the result. | 397 // send those through the sender and receiver and analyzes the result. |
| 398 class End2EndTest : public ::testing::Test { | 398 class End2EndTest : public ::testing::Test { |
| 399 public: | 399 public: |
| 400 void ReceivePacket(scoped_ptr<media::cast::Packet> packet) { | 400 void ReceivePacket(scoped_ptr<media::cast::Packet> packet) { |
| 401 cast_receiver_->ReceivePacket(std::move(packet)); | 401 cast_receiver_->ReceivePacket(std::move(packet)); |
| 402 }; | 402 }; |
| 403 | 403 |
| 404 protected: | 404 protected: |
| 405 End2EndTest() | 405 End2EndTest() |
| 406 : start_time_(), | 406 : start_time_(), |
| 407 task_runner_(new test::FakeSingleThreadTaskRunner(&testing_clock_)), | 407 task_runner_(new FakeSingleThreadTaskRunner(&testing_clock_)), |
| 408 testing_clock_sender_(new test::SkewedTickClock(&testing_clock_)), | 408 testing_clock_sender_(new test::SkewedTickClock(&testing_clock_)), |
| 409 task_runner_sender_( | 409 task_runner_sender_( |
| 410 new test::SkewedSingleThreadTaskRunner(task_runner_)), | 410 new test::SkewedSingleThreadTaskRunner(task_runner_)), |
| 411 testing_clock_receiver_(new test::SkewedTickClock(&testing_clock_)), | 411 testing_clock_receiver_(new test::SkewedTickClock(&testing_clock_)), |
| 412 task_runner_receiver_( | 412 task_runner_receiver_( |
| 413 new test::SkewedSingleThreadTaskRunner(task_runner_)), | 413 new test::SkewedSingleThreadTaskRunner(task_runner_)), |
| 414 cast_environment_sender_(new CastEnvironment( | 414 cast_environment_sender_(new CastEnvironment( |
| 415 scoped_ptr<base::TickClock>(testing_clock_sender_), | 415 scoped_ptr<base::TickClock>(testing_clock_sender_), |
| 416 task_runner_sender_, | 416 task_runner_sender_, |
| 417 task_runner_sender_, | 417 task_runner_sender_, |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 833 | 833 |
| 834 FrameReceiverConfig audio_receiver_config_; | 834 FrameReceiverConfig audio_receiver_config_; |
| 835 FrameReceiverConfig video_receiver_config_; | 835 FrameReceiverConfig video_receiver_config_; |
| 836 AudioSenderConfig audio_sender_config_; | 836 AudioSenderConfig audio_sender_config_; |
| 837 VideoSenderConfig video_sender_config_; | 837 VideoSenderConfig video_sender_config_; |
| 838 | 838 |
| 839 base::TimeTicks start_time_; | 839 base::TimeTicks start_time_; |
| 840 | 840 |
| 841 // These run in "test time" | 841 // These run in "test time" |
| 842 base::SimpleTestTickClock testing_clock_; | 842 base::SimpleTestTickClock testing_clock_; |
| 843 scoped_refptr<test::FakeSingleThreadTaskRunner> task_runner_; | 843 scoped_refptr<FakeSingleThreadTaskRunner> task_runner_; |
| 844 | 844 |
| 845 // These run on the sender timeline. | 845 // These run on the sender timeline. |
| 846 test::SkewedTickClock* testing_clock_sender_; | 846 test::SkewedTickClock* testing_clock_sender_; |
| 847 scoped_refptr<test::SkewedSingleThreadTaskRunner> task_runner_sender_; | 847 scoped_refptr<test::SkewedSingleThreadTaskRunner> task_runner_sender_; |
| 848 | 848 |
| 849 // These run on the receiver timeline. | 849 // These run on the receiver timeline. |
| 850 test::SkewedTickClock* testing_clock_receiver_; | 850 test::SkewedTickClock* testing_clock_receiver_; |
| 851 scoped_refptr<test::SkewedSingleThreadTaskRunner> task_runner_receiver_; | 851 scoped_refptr<test::SkewedSingleThreadTaskRunner> task_runner_receiver_; |
| 852 base::TimeDelta min_video_playout_delta_; | 852 base::TimeDelta min_video_playout_delta_; |
| 853 base::TimeDelta max_video_playout_delta_; | 853 base::TimeDelta max_video_playout_delta_; |
| (...skipping 416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1270 EXPECT_EQ(0u, jump); | 1270 EXPECT_EQ(0u, jump); |
| 1271 jump = i; | 1271 jump = i; |
| 1272 } | 1272 } |
| 1273 } | 1273 } |
| 1274 EXPECT_GT(jump, 49u); | 1274 EXPECT_GT(jump, 49u); |
| 1275 EXPECT_LT(jump, 120u); | 1275 EXPECT_LT(jump, 120u); |
| 1276 } | 1276 } |
| 1277 | 1277 |
| 1278 } // namespace cast | 1278 } // namespace cast |
| 1279 } // namespace media | 1279 } // namespace media |
| OLD | NEW |