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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 | 157 |
156 void AddRtcpEvents( | 158 void AddRtcpEvents( |
157 const ReceiverRtcpEventSubscriber::RtcpEvents& rtcp_events) final { | 159 const ReceiverRtcpEventSubscriber::RtcpEvents& rtcp_events) final { |
158 transport_->AddRtcpEvents(rtcp_events); | 160 transport_->AddRtcpEvents(rtcp_events); |
159 } | 161 } |
160 | 162 |
161 void AddRtpReceiverReport(const RtcpReportBlock& rtp_report_block) final { | 163 void AddRtpReceiverReport(const RtcpReportBlock& rtp_report_block) final { |
162 transport_->AddRtpReceiverReport(rtp_report_block); | 164 transport_->AddRtpReceiverReport(rtp_report_block); |
163 } | 165 } |
164 | 166 |
| 167 void AddPli(const RtcpPliMessage& pli_message) final { |
| 168 transport_->AddPli(pli_message); |
| 169 } |
| 170 |
165 void SendRtcpFromRtpReceiver() final { | 171 void SendRtcpFromRtpReceiver() final { |
166 transport_->SendRtcpFromRtpReceiver(); | 172 transport_->SendRtcpFromRtpReceiver(); |
167 } | 173 } |
168 | 174 |
169 void SetOptions(const base::DictionaryValue& options) final {} | 175 void SetOptions(const base::DictionaryValue& options) final {} |
170 | 176 |
171 private: | 177 private: |
172 scoped_ptr<CastTransportSender> transport_; | 178 scoped_ptr<CastTransportSender> transport_; |
173 uint32_t audio_ssrc_, video_ssrc_; | 179 uint32_t audio_ssrc_, video_ssrc_; |
174 uint64_t* encoded_video_bytes_; | 180 uint64_t* encoded_video_bytes_; |
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
725 media::cast::CastBenchmark benchmark; | 731 media::cast::CastBenchmark benchmark; |
726 if (getenv("PROFILE_FILE")) { | 732 if (getenv("PROFILE_FILE")) { |
727 std::string profile_file(getenv("PROFILE_FILE")); | 733 std::string profile_file(getenv("PROFILE_FILE")); |
728 base::debug::StartProfiling(profile_file); | 734 base::debug::StartProfiling(profile_file); |
729 benchmark.Run(); | 735 benchmark.Run(); |
730 base::debug::StopProfiling(); | 736 base::debug::StopProfiling(); |
731 } else { | 737 } else { |
732 benchmark.Run(); | 738 benchmark.Run(); |
733 } | 739 } |
734 } | 740 } |
OLD | NEW |