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

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

Issue 1312493004: Add support for external decoders in ACM (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@isac-lock-2
Patch Set: Created 5 years, 4 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
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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 if (RemapPltypeAndUseThisCodec(my_codec_param.plname, 136 if (RemapPltypeAndUseThisCodec(my_codec_param.plname,
137 my_codec_param.plfreq, 137 my_codec_param.plfreq,
138 my_codec_param.channels, 138 my_codec_param.channels,
139 &my_codec_param.pltype)) { 139 &my_codec_param.pltype)) {
140 ASSERT_EQ(0, acm_->RegisterReceiveCodec(my_codec_param)) 140 ASSERT_EQ(0, acm_->RegisterReceiveCodec(my_codec_param))
141 << "Couldn't register receive codec.\n"; 141 << "Couldn't register receive codec.\n";
142 } 142 }
143 } 143 }
144 } 144 }
145 145
146 int AcmReceiveTestOldApi::RegisterExternalReceiveCodec(
147 int rtp_payload_type,
148 AudioDecoder* external_decoder,
149 int sample_rate_hz,
150 int num_channels) {
151 return acm_->RegisterExternalReceiveCodec(rtp_payload_type, external_decoder,
152 sample_rate_hz, num_channels);
153 }
154
146 void AcmReceiveTestOldApi::Run() { 155 void AcmReceiveTestOldApi::Run() {
147 for (rtc::scoped_ptr<Packet> packet(packet_source_->NextPacket()); packet; 156 for (rtc::scoped_ptr<Packet> packet(packet_source_->NextPacket()); packet;
148 packet.reset(packet_source_->NextPacket())) { 157 packet.reset(packet_source_->NextPacket())) {
149 // Pull audio until time to insert packet. 158 // Pull audio until time to insert packet.
150 while (clock_.TimeInMilliseconds() < packet->time_ms()) { 159 while (clock_.TimeInMilliseconds() < packet->time_ms()) {
151 AudioFrame output_frame; 160 AudioFrame output_frame;
152 EXPECT_EQ(0, acm_->PlayoutData10Ms(output_freq_hz_, &output_frame)); 161 EXPECT_EQ(0, acm_->PlayoutData10Ms(output_freq_hz_, &output_frame));
153 EXPECT_EQ(output_freq_hz_, output_frame.sample_rate_hz_); 162 EXPECT_EQ(output_freq_hz_, output_frame.sample_rate_hz_);
154 const int samples_per_block = output_freq_hz_ * 10 / 1000; 163 const int samples_per_block = output_freq_hz_ * 10 / 1000;
155 EXPECT_EQ(samples_per_block, output_frame.samples_per_channel_); 164 EXPECT_EQ(samples_per_block, output_frame.samples_per_channel_);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 if (clock_.TimeInMilliseconds() >= last_toggle_time_ms_ + toggle_period_ms_) { 214 if (clock_.TimeInMilliseconds() >= last_toggle_time_ms_ + toggle_period_ms_) {
206 output_freq_hz_ = (output_freq_hz_ == output_freq_hz_1_) 215 output_freq_hz_ = (output_freq_hz_ == output_freq_hz_1_)
207 ? output_freq_hz_2_ 216 ? output_freq_hz_2_
208 : output_freq_hz_1_; 217 : output_freq_hz_1_;
209 last_toggle_time_ms_ = clock_.TimeInMilliseconds(); 218 last_toggle_time_ms_ = clock_.TimeInMilliseconds();
210 } 219 }
211 } 220 }
212 221
213 } // namespace test 222 } // namespace test
214 } // namespace webrtc 223 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/main/acm2/acm_receive_test_oldapi.h ('k') | webrtc/modules/audio_coding/main/acm2/acm_receiver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698