OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 program benchmarks the theoretical throughput of the cast library. | 5 // This program benchmarks the theoretical throughput of the cast library. |
6 // It runs using a fake clock, simulated network and fake codecs. This allows | 6 // It runs using a fake clock, simulated network and fake codecs. This allows |
7 // tests to run much faster than real time. | 7 // tests to run much faster than real time. |
8 // To run the program, run: | 8 // To run the program, run: |
9 // $ ./out/Release/cast_benchmarks | tee benchmarkoutput.asc | 9 // $ ./out/Release/cast_benchmarks | tee benchmarkoutput.asc |
10 // This may take a while, when it is done, you can view the data with | 10 // This may take a while, when it is done, you can view the data with |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 #include "media/cast/test/utility/video_utility.h" | 62 #include "media/cast/test/utility/video_utility.h" |
63 #include "testing/gtest/include/gtest/gtest.h" | 63 #include "testing/gtest/include/gtest/gtest.h" |
64 | 64 |
65 namespace media { | 65 namespace media { |
66 namespace cast { | 66 namespace cast { |
67 | 67 |
68 namespace { | 68 namespace { |
69 | 69 |
70 static const int64 kStartMillisecond = INT64_C(1245); | 70 static const int64 kStartMillisecond = INT64_C(1245); |
71 static const int kAudioChannels = 2; | 71 static const int kAudioChannels = 2; |
72 static const int kVideoHdWidth = 1280; | |
73 static const int kVideoHdHeight = 720; | |
74 static const int kTargetPlayoutDelayMs = 300; | 72 static const int kTargetPlayoutDelayMs = 300; |
75 | 73 |
76 // The tests are commonly implemented with |kFrameTimerMs| RunTask function; | 74 // The tests are commonly implemented with |kFrameTimerMs| RunTask function; |
77 // a normal video is 30 fps hence the 33 ms between frames. | 75 // a normal video is 30 fps hence the 33 ms between frames. |
78 static const int kFrameTimerMs = 33; | 76 static const int kFrameTimerMs = 33; |
79 | 77 |
80 void UpdateCastTransportStatus(CastTransportStatus status) { | 78 void UpdateCastTransportStatus(CastTransportStatus status) { |
81 bool result = (status == TRANSPORT_AUDIO_INITIALIZED || | 79 bool result = (status == TRANSPORT_AUDIO_INITIALIZED || |
82 status == TRANSPORT_VIDEO_INITIALIZED); | 80 status == TRANSPORT_VIDEO_INITIALIZED); |
83 EXPECT_TRUE(result); | 81 EXPECT_TRUE(result); |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 audio_receiver_config_.target_frame_rate = 100; | 257 audio_receiver_config_.target_frame_rate = 100; |
260 audio_receiver_config_.codec = audio_sender_config_.codec; | 258 audio_receiver_config_.codec = audio_sender_config_.codec; |
261 audio_receiver_config_.rtp_max_delay_ms = kTargetPlayoutDelayMs; | 259 audio_receiver_config_.rtp_max_delay_ms = kTargetPlayoutDelayMs; |
262 | 260 |
263 video_sender_config_.ssrc = 3; | 261 video_sender_config_.ssrc = 3; |
264 video_sender_config_.receiver_ssrc = 4; | 262 video_sender_config_.receiver_ssrc = 4; |
265 video_sender_config_.max_playout_delay = | 263 video_sender_config_.max_playout_delay = |
266 base::TimeDelta::FromMilliseconds(kTargetPlayoutDelayMs); | 264 base::TimeDelta::FromMilliseconds(kTargetPlayoutDelayMs); |
267 video_sender_config_.rtp_payload_type = 97; | 265 video_sender_config_.rtp_payload_type = 97; |
268 video_sender_config_.use_external_encoder = false; | 266 video_sender_config_.use_external_encoder = false; |
269 video_sender_config_.width = kVideoHdWidth; | |
270 video_sender_config_.height = kVideoHdHeight; | |
271 #if 0 | 267 #if 0 |
272 video_sender_config_.max_bitrate = 10000000; // 10Mbit max | 268 video_sender_config_.max_bitrate = 10000000; // 10Mbit max |
273 video_sender_config_.min_bitrate = 1000000; // 1Mbit min | 269 video_sender_config_.min_bitrate = 1000000; // 1Mbit min |
274 video_sender_config_.start_bitrate = 1000000; // 1Mbit start | 270 video_sender_config_.start_bitrate = 1000000; // 1Mbit start |
275 #else | 271 #else |
276 video_sender_config_.max_bitrate = 4000000; // 4Mbit all the time | 272 video_sender_config_.max_bitrate = 4000000; // 4Mbit all the time |
277 video_sender_config_.min_bitrate = 4000000; | 273 video_sender_config_.min_bitrate = 4000000; |
278 video_sender_config_.start_bitrate = 4000000; | 274 video_sender_config_.start_bitrate = 4000000; |
279 #endif | 275 #endif |
280 video_sender_config_.max_qp = 56; | 276 video_sender_config_.max_qp = 56; |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 media::cast::CastBenchmark benchmark; | 752 media::cast::CastBenchmark benchmark; |
757 if (getenv("PROFILE_FILE")) { | 753 if (getenv("PROFILE_FILE")) { |
758 std::string profile_file(getenv("PROFILE_FILE")); | 754 std::string profile_file(getenv("PROFILE_FILE")); |
759 base::debug::StartProfiling(profile_file); | 755 base::debug::StartProfiling(profile_file); |
760 benchmark.Run(); | 756 benchmark.Run(); |
761 base::debug::StopProfiling(); | 757 base::debug::StopProfiling(); |
762 } else { | 758 } else { |
763 benchmark.Run(); | 759 benchmark.Run(); |
764 } | 760 } |
765 } | 761 } |
OLD | NEW |