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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 // Takes ownership of |transport|. | 90 // Takes ownership of |transport|. |
91 void Init(CastTransport* transport, | 91 void Init(CastTransport* transport, |
92 uint64_t* encoded_video_bytes, | 92 uint64_t* encoded_video_bytes, |
93 uint64_t* encoded_audio_bytes) { | 93 uint64_t* encoded_audio_bytes) { |
94 transport_.reset(transport); | 94 transport_.reset(transport); |
95 encoded_video_bytes_ = encoded_video_bytes; | 95 encoded_video_bytes_ = encoded_video_bytes; |
96 encoded_audio_bytes_ = encoded_audio_bytes; | 96 encoded_audio_bytes_ = encoded_audio_bytes; |
97 } | 97 } |
98 | 98 |
99 void InitializeAudio(const CastTransportRtpConfig& config, | 99 void InitializeAudio(const CastTransportRtpConfig& config, |
100 const RtcpCastMessageCallback& cast_message_cb, | 100 std::unique_ptr<RtcpObserver> rtcp_observer) final { |
101 const RtcpRttCallback& rtt_cb, | |
102 const RtcpPliCallback& key_frame_cb) final { | |
103 audio_ssrc_ = config.ssrc; | 101 audio_ssrc_ = config.ssrc; |
104 transport_->InitializeAudio(config, cast_message_cb, rtt_cb, key_frame_cb); | 102 transport_->InitializeAudio(config, std::move(rtcp_observer)); |
105 } | 103 } |
106 | 104 |
107 void InitializeVideo(const CastTransportRtpConfig& config, | 105 void InitializeVideo(const CastTransportRtpConfig& config, |
108 const RtcpCastMessageCallback& cast_message_cb, | 106 std::unique_ptr<RtcpObserver> rtcp_observer) final { |
109 const RtcpRttCallback& rtt_cb, | |
110 const RtcpPliCallback& key_frame_cb) final { | |
111 video_ssrc_ = config.ssrc; | 107 video_ssrc_ = config.ssrc; |
112 transport_->InitializeVideo(config, cast_message_cb, rtt_cb, key_frame_cb); | 108 transport_->InitializeVideo(config, std::move(rtcp_observer)); |
113 } | 109 } |
114 | 110 |
115 void InsertFrame(uint32_t ssrc, const EncodedFrame& frame) final { | 111 void InsertFrame(uint32_t ssrc, const EncodedFrame& frame) final { |
116 if (ssrc == audio_ssrc_) { | 112 if (ssrc == audio_ssrc_) { |
117 *encoded_audio_bytes_ += frame.data.size(); | 113 *encoded_audio_bytes_ += frame.data.size(); |
118 } else if (ssrc == video_ssrc_) { | 114 } else if (ssrc == video_ssrc_) { |
119 *encoded_video_bytes_ += frame.data.size(); | 115 *encoded_video_bytes_ += frame.data.size(); |
120 } | 116 } |
121 transport_->InsertFrame(ssrc, frame); | 117 transport_->InsertFrame(ssrc, frame); |
122 } | 118 } |
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
733 media::cast::CastBenchmark benchmark; | 729 media::cast::CastBenchmark benchmark; |
734 if (getenv("PROFILE_FILE")) { | 730 if (getenv("PROFILE_FILE")) { |
735 std::string profile_file(getenv("PROFILE_FILE")); | 731 std::string profile_file(getenv("PROFILE_FILE")); |
736 base::debug::StartProfiling(profile_file); | 732 base::debug::StartProfiling(profile_file); |
737 benchmark.Run(); | 733 benchmark.Run(); |
738 base::debug::StopProfiling(); | 734 base::debug::StopProfiling(); |
739 } else { | 735 } else { |
740 benchmark.Run(); | 736 benchmark.Run(); |
741 } | 737 } |
742 } | 738 } |
OLD | NEW |