| OLD | NEW |
| 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 output_freq_hz_(output_freq_hz), | 125 output_freq_hz_(output_freq_hz), |
| 126 exptected_output_channels_(exptected_output_channels) {} | 126 exptected_output_channels_(exptected_output_channels) {} |
| 127 | 127 |
| 128 AcmReceiveTestOldApi::~AcmReceiveTestOldApi() = default; | 128 AcmReceiveTestOldApi::~AcmReceiveTestOldApi() = default; |
| 129 | 129 |
| 130 void AcmReceiveTestOldApi::RegisterDefaultCodecs() { | 130 void AcmReceiveTestOldApi::RegisterDefaultCodecs() { |
| 131 CodecInst my_codec_param; | 131 CodecInst my_codec_param; |
| 132 for (int n = 0; n < acm_->NumberOfCodecs(); n++) { | 132 for (int n = 0; n < acm_->NumberOfCodecs(); n++) { |
| 133 ASSERT_EQ(0, acm_->Codec(n, &my_codec_param)) << "Failed to get codec."; | 133 ASSERT_EQ(0, acm_->Codec(n, &my_codec_param)) << "Failed to get codec."; |
| 134 if (ModifyAndUseThisCodec(&my_codec_param)) { | 134 if (ModifyAndUseThisCodec(&my_codec_param)) { |
| 135 ASSERT_EQ(0, acm_->RegisterReceiveCodec(my_codec_param)) | 135 ASSERT_EQ(true, |
| 136 acm_->RegisterReceiveCodec(my_codec_param.pltype, |
| 137 CodecInstToSdp(my_codec_param))) |
| 136 << "Couldn't register receive codec.\n"; | 138 << "Couldn't register receive codec.\n"; |
| 137 } | 139 } |
| 138 } | 140 } |
| 139 } | 141 } |
| 140 | 142 |
| 141 void AcmReceiveTestOldApi::RegisterNetEqTestCodecs() { | 143 void AcmReceiveTestOldApi::RegisterNetEqTestCodecs() { |
| 142 CodecInst my_codec_param; | 144 CodecInst my_codec_param; |
| 143 for (int n = 0; n < acm_->NumberOfCodecs(); n++) { | 145 for (int n = 0; n < acm_->NumberOfCodecs(); n++) { |
| 144 ASSERT_EQ(0, acm_->Codec(n, &my_codec_param)) << "Failed to get codec."; | 146 ASSERT_EQ(0, acm_->Codec(n, &my_codec_param)) << "Failed to get codec."; |
| 145 if (!ModifyAndUseThisCodec(&my_codec_param)) { | 147 if (!ModifyAndUseThisCodec(&my_codec_param)) { |
| 146 // Skip this codec. | 148 // Skip this codec. |
| 147 continue; | 149 continue; |
| 148 } | 150 } |
| 149 | 151 |
| 150 if (RemapPltypeAndUseThisCodec(my_codec_param.plname, | 152 if (RemapPltypeAndUseThisCodec(my_codec_param.plname, |
| 151 my_codec_param.plfreq, | 153 my_codec_param.plfreq, |
| 152 my_codec_param.channels, | 154 my_codec_param.channels, |
| 153 &my_codec_param.pltype)) { | 155 &my_codec_param.pltype)) { |
| 154 ASSERT_EQ(0, acm_->RegisterReceiveCodec(my_codec_param)) | 156 ASSERT_EQ(true, |
| 157 acm_->RegisterReceiveCodec(my_codec_param.pltype, |
| 158 CodecInstToSdp(my_codec_param))) |
| 155 << "Couldn't register receive codec.\n"; | 159 << "Couldn't register receive codec.\n"; |
| 156 } | 160 } |
| 157 } | 161 } |
| 158 } | 162 } |
| 159 | 163 |
| 160 int AcmReceiveTestOldApi::RegisterExternalReceiveCodec( | |
| 161 int rtp_payload_type, | |
| 162 AudioDecoder* external_decoder, | |
| 163 int sample_rate_hz, | |
| 164 int num_channels, | |
| 165 const std::string& name) { | |
| 166 return acm_->RegisterExternalReceiveCodec(rtp_payload_type, external_decoder, | |
| 167 sample_rate_hz, num_channels, name); | |
| 168 } | |
| 169 | |
| 170 void AcmReceiveTestOldApi::Run() { | 164 void AcmReceiveTestOldApi::Run() { |
| 171 for (std::unique_ptr<Packet> packet(packet_source_->NextPacket()); packet; | 165 for (std::unique_ptr<Packet> packet(packet_source_->NextPacket()); packet; |
| 172 packet = packet_source_->NextPacket()) { | 166 packet = packet_source_->NextPacket()) { |
| 173 // Pull audio until time to insert packet. | 167 // Pull audio until time to insert packet. |
| 174 while (clock_.TimeInMilliseconds() < packet->time_ms()) { | 168 while (clock_.TimeInMilliseconds() < packet->time_ms()) { |
| 175 AudioFrame output_frame; | 169 AudioFrame output_frame; |
| 176 bool muted; | 170 bool muted; |
| 177 EXPECT_EQ(0, | 171 EXPECT_EQ(0, |
| 178 acm_->PlayoutData10Ms(output_freq_hz_, &output_frame, &muted)); | 172 acm_->PlayoutData10Ms(output_freq_hz_, &output_frame, &muted)); |
| 179 ASSERT_EQ(output_freq_hz_, output_frame.sample_rate_hz_); | 173 ASSERT_EQ(output_freq_hz_, output_frame.sample_rate_hz_); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 if (clock_.TimeInMilliseconds() >= last_toggle_time_ms_ + toggle_period_ms_) { | 227 if (clock_.TimeInMilliseconds() >= last_toggle_time_ms_ + toggle_period_ms_) { |
| 234 output_freq_hz_ = (output_freq_hz_ == output_freq_hz_1_) | 228 output_freq_hz_ = (output_freq_hz_ == output_freq_hz_1_) |
| 235 ? output_freq_hz_2_ | 229 ? output_freq_hz_2_ |
| 236 : output_freq_hz_1_; | 230 : output_freq_hz_1_; |
| 237 last_toggle_time_ms_ = clock_.TimeInMilliseconds(); | 231 last_toggle_time_ms_ = clock_.TimeInMilliseconds(); |
| 238 } | 232 } |
| 239 } | 233 } |
| 240 | 234 |
| 241 } // namespace test | 235 } // namespace test |
| 242 } // namespace webrtc | 236 } // namespace webrtc |
| OLD | NEW |