| 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 uint64* encoded_video_bytes, | 104 uint64* encoded_video_bytes, |
| 105 uint64* encoded_audio_bytes) { | 105 uint64* encoded_audio_bytes) { |
| 106 transport_.reset(transport); | 106 transport_.reset(transport); |
| 107 encoded_video_bytes_ = encoded_video_bytes; | 107 encoded_video_bytes_ = encoded_video_bytes; |
| 108 encoded_audio_bytes_ = encoded_audio_bytes; | 108 encoded_audio_bytes_ = encoded_audio_bytes; |
| 109 } | 109 } |
| 110 | 110 |
| 111 virtual void InitializeAudio( | 111 virtual void InitializeAudio( |
| 112 const CastTransportRtpConfig& config, | 112 const CastTransportRtpConfig& config, |
| 113 const RtcpCastMessageCallback& cast_message_cb, | 113 const RtcpCastMessageCallback& cast_message_cb, |
| 114 const RtcpRttCallback& rtt_cb) OVERRIDE { | 114 const RtcpRttCallback& rtt_cb) override { |
| 115 audio_ssrc_ = config.ssrc; | 115 audio_ssrc_ = config.ssrc; |
| 116 transport_->InitializeAudio(config, cast_message_cb, rtt_cb); | 116 transport_->InitializeAudio(config, cast_message_cb, rtt_cb); |
| 117 } | 117 } |
| 118 | 118 |
| 119 virtual void InitializeVideo( | 119 virtual void InitializeVideo( |
| 120 const CastTransportRtpConfig& config, | 120 const CastTransportRtpConfig& config, |
| 121 const RtcpCastMessageCallback& cast_message_cb, | 121 const RtcpCastMessageCallback& cast_message_cb, |
| 122 const RtcpRttCallback& rtt_cb) OVERRIDE { | 122 const RtcpRttCallback& rtt_cb) override { |
| 123 video_ssrc_ = config.ssrc; | 123 video_ssrc_ = config.ssrc; |
| 124 transport_->InitializeVideo(config, cast_message_cb, rtt_cb); | 124 transport_->InitializeVideo(config, cast_message_cb, rtt_cb); |
| 125 } | 125 } |
| 126 | 126 |
| 127 virtual void InsertFrame(uint32 ssrc, | 127 virtual void InsertFrame(uint32 ssrc, |
| 128 const EncodedFrame& frame) OVERRIDE { | 128 const EncodedFrame& frame) override { |
| 129 if (ssrc == audio_ssrc_) { | 129 if (ssrc == audio_ssrc_) { |
| 130 *encoded_audio_bytes_ += frame.data.size(); | 130 *encoded_audio_bytes_ += frame.data.size(); |
| 131 } else if (ssrc == video_ssrc_) { | 131 } else if (ssrc == video_ssrc_) { |
| 132 *encoded_video_bytes_ += frame.data.size(); | 132 *encoded_video_bytes_ += frame.data.size(); |
| 133 } | 133 } |
| 134 transport_->InsertFrame(ssrc, frame); | 134 transport_->InsertFrame(ssrc, frame); |
| 135 } | 135 } |
| 136 | 136 |
| 137 virtual void SendSenderReport( | 137 virtual void SendSenderReport( |
| 138 uint32 ssrc, | 138 uint32 ssrc, |
| 139 base::TimeTicks current_time, | 139 base::TimeTicks current_time, |
| 140 uint32 current_time_as_rtp_timestamp) OVERRIDE { | 140 uint32 current_time_as_rtp_timestamp) override { |
| 141 transport_->SendSenderReport(ssrc, | 141 transport_->SendSenderReport(ssrc, |
| 142 current_time, | 142 current_time, |
| 143 current_time_as_rtp_timestamp); | 143 current_time_as_rtp_timestamp); |
| 144 } | 144 } |
| 145 | 145 |
| 146 virtual void CancelSendingFrames( | 146 virtual void CancelSendingFrames( |
| 147 uint32 ssrc, | 147 uint32 ssrc, |
| 148 const std::vector<uint32>& frame_ids) OVERRIDE { | 148 const std::vector<uint32>& frame_ids) override { |
| 149 transport_->CancelSendingFrames(ssrc, frame_ids); | 149 transport_->CancelSendingFrames(ssrc, frame_ids); |
| 150 } | 150 } |
| 151 | 151 |
| 152 virtual void ResendFrameForKickstart(uint32 ssrc, | 152 virtual void ResendFrameForKickstart(uint32 ssrc, |
| 153 uint32 frame_id) OVERRIDE { | 153 uint32 frame_id) override { |
| 154 transport_->ResendFrameForKickstart(ssrc, frame_id); | 154 transport_->ResendFrameForKickstart(ssrc, frame_id); |
| 155 } | 155 } |
| 156 | 156 |
| 157 virtual PacketReceiverCallback PacketReceiverForTesting() OVERRIDE { | 157 virtual PacketReceiverCallback PacketReceiverForTesting() override { |
| 158 return transport_->PacketReceiverForTesting(); | 158 return transport_->PacketReceiverForTesting(); |
| 159 } | 159 } |
| 160 | 160 |
| 161 private: | 161 private: |
| 162 scoped_ptr<CastTransportSender> transport_; | 162 scoped_ptr<CastTransportSender> transport_; |
| 163 uint32 audio_ssrc_, video_ssrc_; | 163 uint32 audio_ssrc_, video_ssrc_; |
| 164 uint64* encoded_video_bytes_; | 164 uint64* encoded_video_bytes_; |
| 165 uint64* encoded_audio_bytes_; | 165 uint64* encoded_audio_bytes_; |
| 166 }; | 166 }; |
| 167 | 167 |
| (...skipping 541 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 |