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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 frames_sent_(0) { | 211 frames_sent_(0) { |
212 testing_clock_.Advance( | 212 testing_clock_.Advance( |
213 base::TimeDelta::FromMilliseconds(kStartMillisecond)); | 213 base::TimeDelta::FromMilliseconds(kStartMillisecond)); |
214 } | 214 } |
215 | 215 |
216 void Configure(Codec video_codec, | 216 void Configure(Codec video_codec, |
217 Codec audio_codec, | 217 Codec audio_codec, |
218 int audio_sampling_frequency, | 218 int audio_sampling_frequency, |
219 int max_number_of_video_buffers_used) { | 219 int max_number_of_video_buffers_used) { |
220 audio_sender_config_.ssrc = 1; | 220 audio_sender_config_.ssrc = 1; |
221 audio_sender_config_.incoming_feedback_ssrc = 2; | 221 audio_sender_config_.receiver_ssrc = 2; |
222 audio_sender_config_.max_playout_delay = | 222 audio_sender_config_.max_playout_delay = |
223 base::TimeDelta::FromMilliseconds(kTargetPlayoutDelayMs); | 223 base::TimeDelta::FromMilliseconds(kTargetPlayoutDelayMs); |
224 audio_sender_config_.rtp_payload_type = 96; | 224 audio_sender_config_.rtp_payload_type = 96; |
225 audio_sender_config_.use_external_encoder = false; | 225 audio_sender_config_.use_external_encoder = false; |
226 audio_sender_config_.frequency = audio_sampling_frequency; | 226 audio_sender_config_.frequency = audio_sampling_frequency; |
227 audio_sender_config_.channels = kAudioChannels; | 227 audio_sender_config_.channels = kAudioChannels; |
228 audio_sender_config_.bitrate = kDefaultAudioEncoderBitrate; | 228 audio_sender_config_.bitrate = kDefaultAudioEncoderBitrate; |
229 audio_sender_config_.codec = audio_codec; | 229 audio_sender_config_.codec = audio_codec; |
230 | 230 |
231 audio_receiver_config_.feedback_ssrc = | 231 audio_receiver_config_.feedback_ssrc = |
232 audio_sender_config_.incoming_feedback_ssrc; | 232 audio_sender_config_.receiver_ssrc; |
233 audio_receiver_config_.incoming_ssrc = audio_sender_config_.ssrc; | 233 audio_receiver_config_.incoming_ssrc = audio_sender_config_.ssrc; |
234 audio_receiver_config_.rtp_payload_type = | 234 audio_receiver_config_.rtp_payload_type = |
235 audio_sender_config_.rtp_payload_type; | 235 audio_sender_config_.rtp_payload_type; |
236 audio_receiver_config_.frequency = audio_sender_config_.frequency; | 236 audio_receiver_config_.frequency = audio_sender_config_.frequency; |
237 audio_receiver_config_.channels = kAudioChannels; | 237 audio_receiver_config_.channels = kAudioChannels; |
238 audio_receiver_config_.max_frame_rate = 100; | 238 audio_receiver_config_.max_frame_rate = 100; |
239 audio_receiver_config_.codec = audio_sender_config_.codec; | 239 audio_receiver_config_.codec = audio_sender_config_.codec; |
240 audio_receiver_config_.rtp_max_delay_ms = kTargetPlayoutDelayMs; | 240 audio_receiver_config_.rtp_max_delay_ms = kTargetPlayoutDelayMs; |
241 | 241 |
242 video_sender_config_.ssrc = 3; | 242 video_sender_config_.ssrc = 3; |
243 video_sender_config_.incoming_feedback_ssrc = 4; | 243 video_sender_config_.receiver_ssrc = 4; |
244 video_sender_config_.max_playout_delay = | 244 video_sender_config_.max_playout_delay = |
245 base::TimeDelta::FromMilliseconds(kTargetPlayoutDelayMs); | 245 base::TimeDelta::FromMilliseconds(kTargetPlayoutDelayMs); |
246 video_sender_config_.rtp_payload_type = 97; | 246 video_sender_config_.rtp_payload_type = 97; |
247 video_sender_config_.use_external_encoder = false; | 247 video_sender_config_.use_external_encoder = false; |
248 video_sender_config_.width = kVideoHdWidth; | 248 video_sender_config_.width = kVideoHdWidth; |
249 video_sender_config_.height = kVideoHdHeight; | 249 video_sender_config_.height = kVideoHdHeight; |
250 #if 0 | 250 #if 0 |
251 video_sender_config_.max_bitrate = 10000000; // 10Mbit max | 251 video_sender_config_.max_bitrate = 10000000; // 10Mbit max |
252 video_sender_config_.min_bitrate = 1000000; // 1Mbit min | 252 video_sender_config_.min_bitrate = 1000000; // 1Mbit min |
253 video_sender_config_.start_bitrate = 1000000; // 1Mbit start | 253 video_sender_config_.start_bitrate = 1000000; // 1Mbit start |
254 #else | 254 #else |
255 video_sender_config_.max_bitrate = 4000000; // 4Mbit all the time | 255 video_sender_config_.max_bitrate = 4000000; // 4Mbit all the time |
256 video_sender_config_.min_bitrate = 4000000; | 256 video_sender_config_.min_bitrate = 4000000; |
257 video_sender_config_.start_bitrate = 4000000; | 257 video_sender_config_.start_bitrate = 4000000; |
258 #endif | 258 #endif |
259 video_sender_config_.max_qp = 56; | 259 video_sender_config_.max_qp = 56; |
260 video_sender_config_.min_qp = 4; | 260 video_sender_config_.min_qp = 4; |
261 video_sender_config_.max_frame_rate = 30; | 261 video_sender_config_.max_frame_rate = 30; |
262 video_sender_config_.max_number_of_video_buffers_used = | 262 video_sender_config_.max_number_of_video_buffers_used = |
263 max_number_of_video_buffers_used; | 263 max_number_of_video_buffers_used; |
264 video_sender_config_.codec = video_codec; | 264 video_sender_config_.codec = video_codec; |
265 | 265 |
266 video_receiver_config_.feedback_ssrc = | 266 video_receiver_config_.feedback_ssrc = |
267 video_sender_config_.incoming_feedback_ssrc; | 267 video_sender_config_.receiver_ssrc; |
268 video_receiver_config_.incoming_ssrc = video_sender_config_.ssrc; | 268 video_receiver_config_.incoming_ssrc = video_sender_config_.ssrc; |
269 video_receiver_config_.rtp_payload_type = | 269 video_receiver_config_.rtp_payload_type = |
270 video_sender_config_.rtp_payload_type; | 270 video_sender_config_.rtp_payload_type; |
271 video_receiver_config_.codec = video_sender_config_.codec; | 271 video_receiver_config_.codec = video_sender_config_.codec; |
272 video_receiver_config_.frequency = kVideoFrequency; | 272 video_receiver_config_.frequency = kVideoFrequency; |
273 video_receiver_config_.channels = 1; | 273 video_receiver_config_.channels = 1; |
274 video_receiver_config_.max_frame_rate = 100; | 274 video_receiver_config_.max_frame_rate = 100; |
275 video_receiver_config_.rtp_max_delay_ms = kTargetPlayoutDelayMs; | 275 video_receiver_config_.rtp_max_delay_ms = kTargetPlayoutDelayMs; |
276 } | 276 } |
277 | 277 |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
703 media::cast::CastBenchmark benchmark; | 703 media::cast::CastBenchmark benchmark; |
704 if (getenv("PROFILE_FILE")) { | 704 if (getenv("PROFILE_FILE")) { |
705 std::string profile_file(getenv("PROFILE_FILE")); | 705 std::string profile_file(getenv("PROFILE_FILE")); |
706 base::debug::StartProfiling(profile_file); | 706 base::debug::StartProfiling(profile_file); |
707 benchmark.Run(); | 707 benchmark.Run(); |
708 base::debug::StopProfiling(); | 708 base::debug::StopProfiling(); |
709 } else { | 709 } else { |
710 benchmark.Run(); | 710 benchmark.Run(); |
711 } | 711 } |
712 } | 712 } |
OLD | NEW |