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

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

Issue 655713003: Standardize usage of virtual/override/final in media/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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_encoder.h ('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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 public: 101 public:
102 // Takes ownership of |transport|. 102 // Takes ownership of |transport|.
103 void Init(CastTransportSender* transport, 103 void Init(CastTransportSender* transport,
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 void InitializeAudio(const CastTransportRtpConfig& config,
112 const CastTransportRtpConfig& config, 112 const RtcpCastMessageCallback& cast_message_cb,
113 const RtcpCastMessageCallback& cast_message_cb, 113 const RtcpRttCallback& rtt_cb) override {
114 const RtcpRttCallback& rtt_cb) override {
115 audio_ssrc_ = config.ssrc; 114 audio_ssrc_ = config.ssrc;
116 transport_->InitializeAudio(config, cast_message_cb, rtt_cb); 115 transport_->InitializeAudio(config, cast_message_cb, rtt_cb);
117 } 116 }
118 117
119 virtual void InitializeVideo( 118 void InitializeVideo(const CastTransportRtpConfig& config,
120 const CastTransportRtpConfig& config, 119 const RtcpCastMessageCallback& cast_message_cb,
121 const RtcpCastMessageCallback& cast_message_cb, 120 const RtcpRttCallback& rtt_cb) override {
122 const RtcpRttCallback& rtt_cb) override {
123 video_ssrc_ = config.ssrc; 121 video_ssrc_ = config.ssrc;
124 transport_->InitializeVideo(config, cast_message_cb, rtt_cb); 122 transport_->InitializeVideo(config, cast_message_cb, rtt_cb);
125 } 123 }
126 124
127 virtual void InsertFrame(uint32 ssrc, 125 void InsertFrame(uint32 ssrc, const EncodedFrame& frame) override {
128 const EncodedFrame& frame) override {
129 if (ssrc == audio_ssrc_) { 126 if (ssrc == audio_ssrc_) {
130 *encoded_audio_bytes_ += frame.data.size(); 127 *encoded_audio_bytes_ += frame.data.size();
131 } else if (ssrc == video_ssrc_) { 128 } else if (ssrc == video_ssrc_) {
132 *encoded_video_bytes_ += frame.data.size(); 129 *encoded_video_bytes_ += frame.data.size();
133 } 130 }
134 transport_->InsertFrame(ssrc, frame); 131 transport_->InsertFrame(ssrc, frame);
135 } 132 }
136 133
137 virtual void SendSenderReport( 134 void SendSenderReport(uint32 ssrc,
138 uint32 ssrc, 135 base::TimeTicks current_time,
139 base::TimeTicks current_time, 136 uint32 current_time_as_rtp_timestamp) override {
140 uint32 current_time_as_rtp_timestamp) override {
141 transport_->SendSenderReport(ssrc, 137 transport_->SendSenderReport(ssrc,
142 current_time, 138 current_time,
143 current_time_as_rtp_timestamp); 139 current_time_as_rtp_timestamp);
144 } 140 }
145 141
146 virtual void CancelSendingFrames( 142 void CancelSendingFrames(uint32 ssrc,
147 uint32 ssrc, 143 const std::vector<uint32>& frame_ids) override {
148 const std::vector<uint32>& frame_ids) override {
149 transport_->CancelSendingFrames(ssrc, frame_ids); 144 transport_->CancelSendingFrames(ssrc, frame_ids);
150 } 145 }
151 146
152 virtual void ResendFrameForKickstart(uint32 ssrc, 147 void ResendFrameForKickstart(uint32 ssrc, uint32 frame_id) override {
153 uint32 frame_id) override {
154 transport_->ResendFrameForKickstart(ssrc, frame_id); 148 transport_->ResendFrameForKickstart(ssrc, frame_id);
155 } 149 }
156 150
157 virtual PacketReceiverCallback PacketReceiverForTesting() override { 151 PacketReceiverCallback PacketReceiverForTesting() override {
158 return transport_->PacketReceiverForTesting(); 152 return transport_->PacketReceiverForTesting();
159 } 153 }
160 154
161 private: 155 private:
162 scoped_ptr<CastTransportSender> transport_; 156 scoped_ptr<CastTransportSender> transport_;
163 uint32 audio_ssrc_, video_ssrc_; 157 uint32 audio_ssrc_, video_ssrc_;
164 uint64* encoded_video_bytes_; 158 uint64* encoded_video_bytes_;
165 uint64* encoded_audio_bytes_; 159 uint64* encoded_audio_bytes_;
166 }; 160 };
167 161
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 media::cast::CastBenchmark benchmark; 703 media::cast::CastBenchmark benchmark;
710 if (getenv("PROFILE_FILE")) { 704 if (getenv("PROFILE_FILE")) {
711 std::string profile_file(getenv("PROFILE_FILE")); 705 std::string profile_file(getenv("PROFILE_FILE"));
712 base::debug::StartProfiling(profile_file); 706 base::debug::StartProfiling(profile_file);
713 benchmark.Run(); 707 benchmark.Run();
714 base::debug::StopProfiling(); 708 base::debug::StopProfiling();
715 } else { 709 } else {
716 benchmark.Run(); 710 benchmark.Run();
717 } 711 }
718 } 712 }
OLDNEW
« no previous file with comments | « media/cast/sender/vp8_encoder.h ('k') | media/cast/test/end2end_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698