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

Side by Side Diff: webrtc/modules/audio_coding/acm2/acm_receive_test_oldapi.cc

Issue 2005873002: Let PacketSource::NextPacket() return an std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: rebase Created 4 years, 6 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 | « no previous file | webrtc/modules/audio_coding/acm2/acm_send_test_oldapi.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 AudioDecoder* external_decoder, 147 AudioDecoder* external_decoder,
148 int sample_rate_hz, 148 int sample_rate_hz,
149 int num_channels, 149 int num_channels,
150 const std::string& name) { 150 const std::string& name) {
151 return acm_->RegisterExternalReceiveCodec(rtp_payload_type, external_decoder, 151 return acm_->RegisterExternalReceiveCodec(rtp_payload_type, external_decoder,
152 sample_rate_hz, num_channels, name); 152 sample_rate_hz, num_channels, name);
153 } 153 }
154 154
155 void AcmReceiveTestOldApi::Run() { 155 void AcmReceiveTestOldApi::Run() {
156 for (std::unique_ptr<Packet> packet(packet_source_->NextPacket()); packet; 156 for (std::unique_ptr<Packet> packet(packet_source_->NextPacket()); packet;
157 packet.reset(packet_source_->NextPacket())) { 157 packet = packet_source_->NextPacket()) {
158 // Pull audio until time to insert packet. 158 // Pull audio until time to insert packet.
159 while (clock_.TimeInMilliseconds() < packet->time_ms()) { 159 while (clock_.TimeInMilliseconds() < packet->time_ms()) {
160 AudioFrame output_frame; 160 AudioFrame output_frame;
161 bool muted; 161 bool muted;
162 EXPECT_EQ(0, 162 EXPECT_EQ(0,
163 acm_->PlayoutData10Ms(output_freq_hz_, &output_frame, &muted)); 163 acm_->PlayoutData10Ms(output_freq_hz_, &output_frame, &muted));
164 ASSERT_EQ(output_freq_hz_, output_frame.sample_rate_hz_); 164 ASSERT_EQ(output_freq_hz_, output_frame.sample_rate_hz_);
165 ASSERT_FALSE(muted); 165 ASSERT_FALSE(muted);
166 const size_t samples_per_block = 166 const size_t samples_per_block =
167 static_cast<size_t>(output_freq_hz_ * 10 / 1000); 167 static_cast<size_t>(output_freq_hz_ * 10 / 1000);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 if (clock_.TimeInMilliseconds() >= last_toggle_time_ms_ + toggle_period_ms_) { 218 if (clock_.TimeInMilliseconds() >= last_toggle_time_ms_ + toggle_period_ms_) {
219 output_freq_hz_ = (output_freq_hz_ == output_freq_hz_1_) 219 output_freq_hz_ = (output_freq_hz_ == output_freq_hz_1_)
220 ? output_freq_hz_2_ 220 ? output_freq_hz_2_
221 : output_freq_hz_1_; 221 : output_freq_hz_1_;
222 last_toggle_time_ms_ = clock_.TimeInMilliseconds(); 222 last_toggle_time_ms_ = clock_.TimeInMilliseconds();
223 } 223 }
224 } 224 }
225 225
226 } // namespace test 226 } // namespace test
227 } // namespace webrtc 227 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/audio_coding/acm2/acm_send_test_oldapi.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698