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

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

Issue 1878883003: Refactor: simplify interface of SenderRtcpSession and CastTransport. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 7 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/video_sender_unittest.cc ('k') | no next file » | 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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 }
OLDNEW
« no previous file with comments | « media/cast/sender/video_sender_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698