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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 testing_clock_.Advance( | 218 testing_clock_.Advance( |
219 base::TimeDelta::FromMilliseconds(kStartMillisecond)); | 219 base::TimeDelta::FromMilliseconds(kStartMillisecond)); |
220 } | 220 } |
221 | 221 |
222 void Configure(Codec video_codec, | 222 void Configure(Codec video_codec, |
223 Codec audio_codec, | 223 Codec audio_codec, |
224 int audio_sampling_frequency, | 224 int audio_sampling_frequency, |
225 int max_number_of_video_buffers_used) { | 225 int max_number_of_video_buffers_used) { |
226 audio_sender_config_.ssrc = 1; | 226 audio_sender_config_.ssrc = 1; |
227 audio_sender_config_.incoming_feedback_ssrc = 2; | 227 audio_sender_config_.incoming_feedback_ssrc = 2; |
228 audio_sender_config_.target_playout_delay = | 228 audio_sender_config_.max_playout_delay = |
229 base::TimeDelta::FromMilliseconds(kTargetPlayoutDelayMs); | 229 base::TimeDelta::FromMilliseconds(kTargetPlayoutDelayMs); |
230 audio_sender_config_.rtp_payload_type = 96; | 230 audio_sender_config_.rtp_payload_type = 96; |
231 audio_sender_config_.use_external_encoder = false; | 231 audio_sender_config_.use_external_encoder = false; |
232 audio_sender_config_.frequency = audio_sampling_frequency; | 232 audio_sender_config_.frequency = audio_sampling_frequency; |
233 audio_sender_config_.channels = kAudioChannels; | 233 audio_sender_config_.channels = kAudioChannels; |
234 audio_sender_config_.bitrate = kDefaultAudioEncoderBitrate; | 234 audio_sender_config_.bitrate = kDefaultAudioEncoderBitrate; |
235 audio_sender_config_.codec = audio_codec; | 235 audio_sender_config_.codec = audio_codec; |
236 | 236 |
237 audio_receiver_config_.feedback_ssrc = | 237 audio_receiver_config_.feedback_ssrc = |
238 audio_sender_config_.incoming_feedback_ssrc; | 238 audio_sender_config_.incoming_feedback_ssrc; |
239 audio_receiver_config_.incoming_ssrc = audio_sender_config_.ssrc; | 239 audio_receiver_config_.incoming_ssrc = audio_sender_config_.ssrc; |
240 audio_receiver_config_.rtp_payload_type = | 240 audio_receiver_config_.rtp_payload_type = |
241 audio_sender_config_.rtp_payload_type; | 241 audio_sender_config_.rtp_payload_type; |
242 audio_receiver_config_.frequency = audio_sender_config_.frequency; | 242 audio_receiver_config_.frequency = audio_sender_config_.frequency; |
243 audio_receiver_config_.channels = kAudioChannels; | 243 audio_receiver_config_.channels = kAudioChannels; |
244 audio_receiver_config_.max_frame_rate = 100; | 244 audio_receiver_config_.max_frame_rate = 100; |
245 audio_receiver_config_.codec = audio_sender_config_.codec; | 245 audio_receiver_config_.codec = audio_sender_config_.codec; |
246 audio_receiver_config_.rtp_max_delay_ms = kTargetPlayoutDelayMs; | 246 audio_receiver_config_.rtp_max_delay_ms = kTargetPlayoutDelayMs; |
247 | 247 |
248 video_sender_config_.ssrc = 3; | 248 video_sender_config_.ssrc = 3; |
249 video_sender_config_.incoming_feedback_ssrc = 4; | 249 video_sender_config_.incoming_feedback_ssrc = 4; |
250 video_sender_config_.target_playout_delay = | 250 video_sender_config_.max_playout_delay = |
251 base::TimeDelta::FromMilliseconds(kTargetPlayoutDelayMs); | 251 base::TimeDelta::FromMilliseconds(kTargetPlayoutDelayMs); |
252 video_sender_config_.rtp_payload_type = 97; | 252 video_sender_config_.rtp_payload_type = 97; |
253 video_sender_config_.use_external_encoder = false; | 253 video_sender_config_.use_external_encoder = false; |
254 video_sender_config_.width = kVideoHdWidth; | 254 video_sender_config_.width = kVideoHdWidth; |
255 video_sender_config_.height = kVideoHdHeight; | 255 video_sender_config_.height = kVideoHdHeight; |
256 #if 0 | 256 #if 0 |
257 video_sender_config_.max_bitrate = 10000000; // 10Mbit max | 257 video_sender_config_.max_bitrate = 10000000; // 10Mbit max |
258 video_sender_config_.min_bitrate = 1000000; // 1Mbit min | 258 video_sender_config_.min_bitrate = 1000000; // 1Mbit min |
259 video_sender_config_.start_bitrate = 1000000; // 1Mbit start | 259 video_sender_config_.start_bitrate = 1000000; // 1Mbit start |
260 #else | 260 #else |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
709 media::cast::CastBenchmark benchmark; | 709 media::cast::CastBenchmark benchmark; |
710 if (getenv("PROFILE_FILE")) { | 710 if (getenv("PROFILE_FILE")) { |
711 std::string profile_file(getenv("PROFILE_FILE")); | 711 std::string profile_file(getenv("PROFILE_FILE")); |
712 base::debug::StartProfiling(profile_file); | 712 base::debug::StartProfiling(profile_file); |
713 benchmark.Run(); | 713 benchmark.Run(); |
714 base::debug::StopProfiling(); | 714 base::debug::StopProfiling(); |
715 } else { | 715 } else { |
716 benchmark.Run(); | 716 benchmark.Run(); |
717 } | 717 } |
718 } | 718 } |
OLD | NEW |