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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 void Init(CastTransportSender* transport, | 89 void Init(CastTransportSender* transport, |
90 uint64_t* encoded_video_bytes, | 90 uint64_t* encoded_video_bytes, |
91 uint64_t* encoded_audio_bytes) { | 91 uint64_t* encoded_audio_bytes) { |
92 transport_.reset(transport); | 92 transport_.reset(transport); |
93 encoded_video_bytes_ = encoded_video_bytes; | 93 encoded_video_bytes_ = encoded_video_bytes; |
94 encoded_audio_bytes_ = encoded_audio_bytes; | 94 encoded_audio_bytes_ = encoded_audio_bytes; |
95 } | 95 } |
96 | 96 |
97 void InitializeAudio(const CastTransportRtpConfig& config, | 97 void InitializeAudio(const CastTransportRtpConfig& config, |
98 const RtcpCastMessageCallback& cast_message_cb, | 98 const RtcpCastMessageCallback& cast_message_cb, |
99 const RtcpRttCallback& rtt_cb) final { | 99 const RtcpRttCallback& rtt_cb, |
| 100 const RtcpPliCallback& key_frame_cb) final { |
100 audio_ssrc_ = config.ssrc; | 101 audio_ssrc_ = config.ssrc; |
101 transport_->InitializeAudio(config, cast_message_cb, rtt_cb); | 102 transport_->InitializeAudio(config, cast_message_cb, rtt_cb, key_frame_cb); |
102 } | 103 } |
103 | 104 |
104 void InitializeVideo(const CastTransportRtpConfig& config, | 105 void InitializeVideo(const CastTransportRtpConfig& config, |
105 const RtcpCastMessageCallback& cast_message_cb, | 106 const RtcpCastMessageCallback& cast_message_cb, |
106 const RtcpRttCallback& rtt_cb) final { | 107 const RtcpRttCallback& rtt_cb, |
| 108 const RtcpPliCallback& key_frame_cb) final { |
107 video_ssrc_ = config.ssrc; | 109 video_ssrc_ = config.ssrc; |
108 transport_->InitializeVideo(config, cast_message_cb, rtt_cb); | 110 transport_->InitializeVideo(config, cast_message_cb, rtt_cb, key_frame_cb); |
109 } | 111 } |
110 | 112 |
111 void InsertFrame(uint32_t ssrc, const EncodedFrame& frame) final { | 113 void InsertFrame(uint32_t ssrc, const EncodedFrame& frame) final { |
112 if (ssrc == audio_ssrc_) { | 114 if (ssrc == audio_ssrc_) { |
113 *encoded_audio_bytes_ += frame.data.size(); | 115 *encoded_audio_bytes_ += frame.data.size(); |
114 } else if (ssrc == video_ssrc_) { | 116 } else if (ssrc == video_ssrc_) { |
115 *encoded_video_bytes_ += frame.data.size(); | 117 *encoded_video_bytes_ += frame.data.size(); |
116 } | 118 } |
117 transport_->InsertFrame(ssrc, frame); | 119 transport_->InsertFrame(ssrc, frame); |
118 } | 120 } |
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
718 media::cast::CastBenchmark benchmark; | 720 media::cast::CastBenchmark benchmark; |
719 if (getenv("PROFILE_FILE")) { | 721 if (getenv("PROFILE_FILE")) { |
720 std::string profile_file(getenv("PROFILE_FILE")); | 722 std::string profile_file(getenv("PROFILE_FILE")); |
721 base::debug::StartProfiling(profile_file); | 723 base::debug::StartProfiling(profile_file); |
722 benchmark.Run(); | 724 benchmark.Run(); |
723 base::debug::StopProfiling(); | 725 base::debug::StopProfiling(); |
724 } else { | 726 } else { |
725 benchmark.Run(); | 727 benchmark.Run(); |
726 } | 728 } |
727 } | 729 } |
OLD | NEW |