Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(267)

Side by Side Diff: media/cast/test/cast_benchmarks.cc

Issue 2133223003: Revert of Refactoring: Merge VideoSenderConfig and AudioSenderConfig. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/cast/sender/vp8_quantizer_parser_unittest.cc ('k') | media/cast/test/end2end_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 base::TimeDelta::FromMilliseconds(kTargetPlayoutDelayMs); 251 base::TimeDelta::FromMilliseconds(kTargetPlayoutDelayMs);
252 video_sender_config_.max_bitrate = 4000000; 252 video_sender_config_.max_bitrate = 4000000;
253 video_sender_config_.min_bitrate = 4000000; 253 video_sender_config_.min_bitrate = 4000000;
254 video_sender_config_.start_bitrate = 4000000; 254 video_sender_config_.start_bitrate = 4000000;
255 video_sender_config_.codec = video_codec; 255 video_sender_config_.codec = video_codec;
256 256
257 video_receiver_config_ = GetDefaultVideoReceiverConfig(); 257 video_receiver_config_ = GetDefaultVideoReceiverConfig();
258 video_receiver_config_.rtp_max_delay_ms = kTargetPlayoutDelayMs; 258 video_receiver_config_.rtp_max_delay_ms = kTargetPlayoutDelayMs;
259 video_receiver_config_.codec = video_codec; 259 video_receiver_config_.codec = video_codec;
260 260
261 DCHECK_GT(video_sender_config_.max_frame_rate, 0); 261 frame_duration_ = base::TimeDelta::FromSeconds(1) /
262 frame_duration_ = base::TimeDelta::FromSecondsD( 262 video_sender_config_.max_frame_rate;
263 1.0 / video_sender_config_.max_frame_rate);
264 } 263 }
265 264
266 void SetSenderClockSkew(double skew, base::TimeDelta offset) { 265 void SetSenderClockSkew(double skew, base::TimeDelta offset) {
267 testing_clock_sender_->SetSkew(skew, offset); 266 testing_clock_sender_->SetSkew(skew, offset);
268 task_runner_sender_->SetSkew(1.0 / skew); 267 task_runner_sender_->SetSkew(1.0 / skew);
269 } 268 }
270 269
271 void SetReceiverClockSkew(double skew, base::TimeDelta offset) { 270 void SetReceiverClockSkew(double skew, base::TimeDelta offset) {
272 testing_clock_receiver_->SetSkew(skew, offset); 271 testing_clock_receiver_->SetSkew(skew, offset);
273 task_runner_receiver_->SetSkew(1.0 / skew); 272 task_runner_receiver_->SetSkew(1.0 / skew);
274 } 273 }
275 274
276 void Create(const MeasuringPoint& p); 275 void Create(const MeasuringPoint& p);
277 276
278 void ReceivePacket(std::unique_ptr<Packet> packet) { 277 void ReceivePacket(std::unique_ptr<Packet> packet) {
279 cast_receiver_->ReceivePacket(std::move(packet)); 278 cast_receiver_->ReceivePacket(std::move(packet));
280 } 279 }
281 280
282 virtual ~RunOneBenchmark() { 281 virtual ~RunOneBenchmark() {
283 cast_sender_.reset(); 282 cast_sender_.reset();
284 cast_receiver_.reset(); 283 cast_receiver_.reset();
285 task_runner_->RunTasks(); 284 task_runner_->RunTasks();
286 } 285 }
287 286
288 base::TimeDelta VideoTimestamp(int frame_number) { 287 base::TimeDelta VideoTimestamp(int frame_number) {
289 return frame_number * base::TimeDelta::FromSecondsD( 288 return (frame_number * base::TimeDelta::FromSeconds(1)) /
290 1.0 / video_sender_config_.max_frame_rate); 289 video_sender_config_.max_frame_rate;
291 } 290 }
292 291
293 void SendFakeVideoFrame() { 292 void SendFakeVideoFrame() {
294 // NB: Blackframe with timestamp 293 // NB: Blackframe with timestamp
295 cast_sender_->video_frame_input()->InsertRawVideoFrame( 294 cast_sender_->video_frame_input()->InsertRawVideoFrame(
296 media::VideoFrame::CreateColorFrame(gfx::Size(2, 2), 295 media::VideoFrame::CreateColorFrame(gfx::Size(2, 2),
297 0x00, 0x80, 0x80, VideoTimestamp(frames_sent_)), 296 0x00, 0x80, 0x80, VideoTimestamp(frames_sent_)),
298 testing_clock_sender_->NowTicks()); 297 testing_clock_sender_->NowTicks());
299 frames_sent_++; 298 frames_sent_++;
300 } 299 }
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 403
405 bool SimpleGood() { 404 bool SimpleGood() {
406 return frames_lost() <= 1 && late_frames() <= 1 && 405 return frames_lost() <= 1 && late_frames() <= 1 &&
407 video_bandwidth() > desired_video_bitrate() * 0.8 && 406 video_bandwidth() > desired_video_bitrate() * 0.8 &&
408 video_bandwidth() < desired_video_bitrate() * 1.2; 407 video_bandwidth() < desired_video_bitrate() * 1.2;
409 } 408 }
410 409
411 private: 410 private:
412 FrameReceiverConfig audio_receiver_config_; 411 FrameReceiverConfig audio_receiver_config_;
413 FrameReceiverConfig video_receiver_config_; 412 FrameReceiverConfig video_receiver_config_;
414 FrameSenderConfig audio_sender_config_; 413 AudioSenderConfig audio_sender_config_;
415 FrameSenderConfig video_sender_config_; 414 VideoSenderConfig video_sender_config_;
416 415
417 base::TimeTicks start_time_; 416 base::TimeTicks start_time_;
418 417
419 // These run in "test time" 418 // These run in "test time"
420 base::SimpleTestTickClock testing_clock_; 419 base::SimpleTestTickClock testing_clock_;
421 scoped_refptr<FakeSingleThreadTaskRunner> task_runner_; 420 scoped_refptr<FakeSingleThreadTaskRunner> task_runner_;
422 421
423 // These run on the sender timeline. 422 // These run on the sender timeline.
424 test::SkewedTickClock* testing_clock_sender_; 423 test::SkewedTickClock* testing_clock_sender_;
425 scoped_refptr<test::SkewedSingleThreadTaskRunner> task_runner_sender_; 424 scoped_refptr<test::SkewedSingleThreadTaskRunner> task_runner_sender_;
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
728 media::cast::CastBenchmark benchmark; 727 media::cast::CastBenchmark benchmark;
729 if (getenv("PROFILE_FILE")) { 728 if (getenv("PROFILE_FILE")) {
730 std::string profile_file(getenv("PROFILE_FILE")); 729 std::string profile_file(getenv("PROFILE_FILE"));
731 base::debug::StartProfiling(profile_file); 730 base::debug::StartProfiling(profile_file);
732 benchmark.Run(); 731 benchmark.Run();
733 base::debug::StopProfiling(); 732 base::debug::StopProfiling();
734 } else { 733 } else {
735 benchmark.Run(); 734 benchmark.Run();
736 } 735 }
737 } 736 }
OLDNEW
« no previous file with comments | « media/cast/sender/vp8_quantizer_parser_unittest.cc ('k') | media/cast/test/end2end_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698