henrik.lundin | e8a77e3 | 2016-06-22 06:34:03 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 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 |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 11 | #include "modules/audio_coding/neteq/tools/neteq_test.h" |
henrik.lundin | e8a77e3 | 2016-06-22 06:34:03 -0700 | [diff] [blame] | 12 | |
Ivo Creusen | 2db46b0 | 2018-12-14 16:49:12 +0100 | [diff] [blame] | 13 | #include <iomanip> |
henrik.lundin | e8a77e3 | 2016-06-22 06:34:03 -0700 | [diff] [blame] | 14 | #include <iostream> |
| 15 | |
Ivo Creusen | 2db46b0 | 2018-12-14 16:49:12 +0100 | [diff] [blame] | 16 | #include "modules/rtp_rtcp/source/byte_io.h" |
Alessio Bazzica | 8f319a3 | 2019-07-24 16:47:02 +0000 | [diff] [blame^] | 17 | #include "system_wrappers/include/clock.h" |
henrik.lundin | e8a77e3 | 2016-06-22 06:34:03 -0700 | [diff] [blame] | 18 | |
| 19 | namespace webrtc { |
| 20 | namespace test { |
Ivo Creusen | 55de08e | 2018-09-03 11:49:27 +0200 | [diff] [blame] | 21 | namespace { |
| 22 | |
| 23 | absl::optional<Operations> ActionToOperations( |
| 24 | absl::optional<NetEqSimulator::Action> a) { |
| 25 | if (!a) { |
| 26 | return absl::nullopt; |
| 27 | } |
| 28 | switch (*a) { |
| 29 | case NetEqSimulator::Action::kAccelerate: |
| 30 | return absl::make_optional(kAccelerate); |
| 31 | case NetEqSimulator::Action::kExpand: |
| 32 | return absl::make_optional(kExpand); |
| 33 | case NetEqSimulator::Action::kNormal: |
| 34 | return absl::make_optional(kNormal); |
| 35 | case NetEqSimulator::Action::kPreemptiveExpand: |
| 36 | return absl::make_optional(kPreemptiveExpand); |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | } // namespace |
henrik.lundin | e8a77e3 | 2016-06-22 06:34:03 -0700 | [diff] [blame] | 41 | |
| 42 | void DefaultNetEqTestErrorCallback::OnInsertPacketError( |
henrik.lundin | e8a77e3 | 2016-06-22 06:34:03 -0700 | [diff] [blame] | 43 | const NetEqInput::PacketData& packet) { |
Henrik Lundin | c417d9e | 2017-06-14 12:29:03 +0200 | [diff] [blame] | 44 | std::cerr << "InsertPacket returned an error." << std::endl; |
henrik.lundin | 7a38fd2 | 2017-04-28 01:35:53 -0700 | [diff] [blame] | 45 | std::cerr << "Packet data: " << packet.ToString() << std::endl; |
henrik.lundin | e8a77e3 | 2016-06-22 06:34:03 -0700 | [diff] [blame] | 46 | FATAL(); |
| 47 | } |
| 48 | |
Henrik Lundin | c417d9e | 2017-06-14 12:29:03 +0200 | [diff] [blame] | 49 | void DefaultNetEqTestErrorCallback::OnGetAudioError() { |
| 50 | std::cerr << "GetAudio returned an error." << std::endl; |
henrik.lundin | e8a77e3 | 2016-06-22 06:34:03 -0700 | [diff] [blame] | 51 | FATAL(); |
| 52 | } |
| 53 | |
| 54 | NetEqTest::NetEqTest(const NetEq::Config& config, |
Niels Möller | 3f651d8 | 2018-12-19 15:06:17 +0100 | [diff] [blame] | 55 | rtc::scoped_refptr<AudioDecoderFactory> decoder_factory, |
henrik.lundin | e8a77e3 | 2016-06-22 06:34:03 -0700 | [diff] [blame] | 56 | const DecoderMap& codecs, |
Ivo Creusen | 2db46b0 | 2018-12-14 16:49:12 +0100 | [diff] [blame] | 57 | std::unique_ptr<std::ofstream> text_log, |
henrik.lundin | e8a77e3 | 2016-06-22 06:34:03 -0700 | [diff] [blame] | 58 | std::unique_ptr<NetEqInput> input, |
| 59 | std::unique_ptr<AudioSink> output, |
henrik.lundin | 02739d9 | 2017-05-04 06:09:06 -0700 | [diff] [blame] | 60 | Callbacks callbacks) |
Alessio Bazzica | 8f319a3 | 2019-07-24 16:47:02 +0000 | [diff] [blame^] | 61 | : clock_(0), |
| 62 | neteq_(NetEq::Create(config, &clock_, decoder_factory)), |
henrik.lundin | e8a77e3 | 2016-06-22 06:34:03 -0700 | [diff] [blame] | 63 | input_(std::move(input)), |
| 64 | output_(std::move(output)), |
henrik.lundin | 02739d9 | 2017-05-04 06:09:06 -0700 | [diff] [blame] | 65 | callbacks_(callbacks), |
Ivo Creusen | 2db46b0 | 2018-12-14 16:49:12 +0100 | [diff] [blame] | 66 | sample_rate_hz_(config.sample_rate_hz), |
| 67 | text_log_(std::move(text_log)) { |
henrik.lundin | e8a77e3 | 2016-06-22 06:34:03 -0700 | [diff] [blame] | 68 | RTC_CHECK(!config.enable_muted_state) |
| 69 | << "The code does not handle enable_muted_state"; |
| 70 | RegisterDecoders(codecs); |
henrik.lundin | e8a77e3 | 2016-06-22 06:34:03 -0700 | [diff] [blame] | 71 | } |
| 72 | |
Mirko Bonadei | 682aac5 | 2018-07-20 13:59:20 +0200 | [diff] [blame] | 73 | NetEqTest::~NetEqTest() = default; |
| 74 | |
henrik.lundin | e8a77e3 | 2016-06-22 06:34:03 -0700 | [diff] [blame] | 75 | int64_t NetEqTest::Run() { |
Ivo Creusen | 55de08e | 2018-09-03 11:49:27 +0200 | [diff] [blame] | 76 | int64_t simulation_time = 0; |
| 77 | SimulationStepResult step_result; |
| 78 | do { |
| 79 | step_result = RunToNextGetAudio(); |
| 80 | simulation_time += step_result.simulation_step_ms; |
| 81 | } while (!step_result.is_simulation_finished); |
| 82 | if (callbacks_.simulation_ended_callback) { |
| 83 | callbacks_.simulation_ended_callback->SimulationEnded(simulation_time); |
| 84 | } |
| 85 | return simulation_time; |
| 86 | } |
| 87 | |
| 88 | NetEqTest::SimulationStepResult NetEqTest::RunToNextGetAudio() { |
| 89 | SimulationStepResult result; |
henrik.lundin | e8a77e3 | 2016-06-22 06:34:03 -0700 | [diff] [blame] | 90 | const int64_t start_time_ms = *input_->NextEventTime(); |
| 91 | int64_t time_now_ms = start_time_ms; |
Ivo Creusen | 4384f53 | 2018-09-07 17:19:56 +0200 | [diff] [blame] | 92 | current_state_.packet_iat_ms.clear(); |
henrik.lundin | e8a77e3 | 2016-06-22 06:34:03 -0700 | [diff] [blame] | 93 | |
| 94 | while (!input_->ended()) { |
| 95 | // Advance time to next event. |
| 96 | RTC_DCHECK(input_->NextEventTime()); |
Alessio Bazzica | 8f319a3 | 2019-07-24 16:47:02 +0000 | [diff] [blame^] | 97 | clock_.AdvanceTimeMilliseconds(*input_->NextEventTime() - time_now_ms); |
henrik.lundin | e8a77e3 | 2016-06-22 06:34:03 -0700 | [diff] [blame] | 98 | time_now_ms = *input_->NextEventTime(); |
| 99 | // Check if it is time to insert packet. |
| 100 | if (input_->NextPacketTime() && time_now_ms >= *input_->NextPacketTime()) { |
| 101 | std::unique_ptr<NetEqInput::PacketData> packet_data = input_->PopPacket(); |
| 102 | RTC_CHECK(packet_data); |
Minyue Li | 1a80018 | 2018-09-12 12:52:48 +0200 | [diff] [blame] | 103 | const size_t payload_data_length = |
| 104 | packet_data->payload.size() - packet_data->header.paddingLength; |
| 105 | if (payload_data_length != 0) { |
| 106 | int error = neteq_->InsertPacket( |
| 107 | packet_data->header, |
| 108 | rtc::ArrayView<const uint8_t>(packet_data->payload), |
| 109 | static_cast<uint32_t>(packet_data->time_ms * sample_rate_hz_ / |
| 110 | 1000)); |
| 111 | if (error != NetEq::kOK && callbacks_.error_callback) { |
| 112 | callbacks_.error_callback->OnInsertPacketError(*packet_data); |
| 113 | } |
| 114 | if (callbacks_.post_insert_packet) { |
| 115 | callbacks_.post_insert_packet->AfterInsertPacket(*packet_data, |
| 116 | neteq_.get()); |
| 117 | } |
| 118 | } else { |
| 119 | neteq_->InsertEmptyPacket(packet_data->header); |
henrik.lundin | e8a77e3 | 2016-06-22 06:34:03 -0700 | [diff] [blame] | 120 | } |
Ivo Creusen | 4384f53 | 2018-09-07 17:19:56 +0200 | [diff] [blame] | 121 | if (last_packet_time_ms_) { |
| 122 | current_state_.packet_iat_ms.push_back(time_now_ms - |
| 123 | *last_packet_time_ms_); |
| 124 | } |
Ivo Creusen | 2db46b0 | 2018-12-14 16:49:12 +0100 | [diff] [blame] | 125 | if (text_log_) { |
| 126 | const auto ops_state = neteq_->GetOperationsAndState(); |
| 127 | const auto delta_wallclock = |
| 128 | last_packet_time_ms_ ? (time_now_ms - *last_packet_time_ms_) : -1; |
| 129 | const auto delta_timestamp = |
| 130 | last_packet_timestamp_ |
| 131 | ? (static_cast<int64_t>(packet_data->header.timestamp) - |
| 132 | *last_packet_timestamp_) * |
| 133 | 1000 / sample_rate_hz_ |
| 134 | : -1; |
| 135 | const auto packet_size_bytes = |
| 136 | packet_data->payload.size() == 12 |
| 137 | ? ByteReader<uint32_t>::ReadLittleEndian( |
| 138 | &packet_data->payload[8]) |
| 139 | : -1; |
| 140 | *text_log_ << "Packet - wallclock: " << std::setw(5) << time_now_ms |
| 141 | << ", delta wc: " << std::setw(4) << delta_wallclock |
Jakob Ivarsson | e98954c | 2019-02-06 15:37:50 +0100 | [diff] [blame] | 142 | << ", seq_no: " << packet_data->header.sequenceNumber |
Ivo Creusen | 2db46b0 | 2018-12-14 16:49:12 +0100 | [diff] [blame] | 143 | << ", timestamp: " << std::setw(10) |
| 144 | << packet_data->header.timestamp |
| 145 | << ", delta ts: " << std::setw(4) << delta_timestamp |
| 146 | << ", size: " << std::setw(5) << packet_size_bytes |
| 147 | << ", frame size: " << std::setw(3) |
| 148 | << ops_state.current_frame_size_ms |
| 149 | << ", buffer size: " << std::setw(4) |
| 150 | << ops_state.current_buffer_size_ms << std::endl; |
| 151 | } |
Ivo Creusen | 4384f53 | 2018-09-07 17:19:56 +0200 | [diff] [blame] | 152 | last_packet_time_ms_ = absl::make_optional<int>(time_now_ms); |
Ivo Creusen | 2db46b0 | 2018-12-14 16:49:12 +0100 | [diff] [blame] | 153 | last_packet_timestamp_ = |
| 154 | absl::make_optional<uint32_t>(packet_data->header.timestamp); |
henrik.lundin | e8a77e3 | 2016-06-22 06:34:03 -0700 | [diff] [blame] | 155 | } |
| 156 | |
| 157 | // Check if it is time to get output audio. |
| 158 | if (input_->NextOutputEventTime() && |
| 159 | time_now_ms >= *input_->NextOutputEventTime()) { |
henrik.lundin | 02739d9 | 2017-05-04 06:09:06 -0700 | [diff] [blame] | 160 | if (callbacks_.get_audio_callback) { |
| 161 | callbacks_.get_audio_callback->BeforeGetAudio(neteq_.get()); |
| 162 | } |
henrik.lundin | e8a77e3 | 2016-06-22 06:34:03 -0700 | [diff] [blame] | 163 | AudioFrame out_frame; |
| 164 | bool muted; |
Ivo Creusen | 55de08e | 2018-09-03 11:49:27 +0200 | [diff] [blame] | 165 | int error = neteq_->GetAudio(&out_frame, &muted, |
| 166 | ActionToOperations(next_action_)); |
| 167 | next_action_ = absl::nullopt; |
henrik.lundin | e8a77e3 | 2016-06-22 06:34:03 -0700 | [diff] [blame] | 168 | RTC_CHECK(!muted) << "The code does not handle enable_muted_state"; |
| 169 | if (error != NetEq::kOK) { |
henrik.lundin | 02739d9 | 2017-05-04 06:09:06 -0700 | [diff] [blame] | 170 | if (callbacks_.error_callback) { |
Henrik Lundin | c417d9e | 2017-06-14 12:29:03 +0200 | [diff] [blame] | 171 | callbacks_.error_callback->OnGetAudioError(); |
henrik.lundin | e8a77e3 | 2016-06-22 06:34:03 -0700 | [diff] [blame] | 172 | } |
| 173 | } else { |
| 174 | sample_rate_hz_ = out_frame.sample_rate_hz_; |
| 175 | } |
henrik.lundin | 02739d9 | 2017-05-04 06:09:06 -0700 | [diff] [blame] | 176 | if (callbacks_.get_audio_callback) { |
| 177 | callbacks_.get_audio_callback->AfterGetAudio(time_now_ms, out_frame, |
| 178 | muted, neteq_.get()); |
| 179 | } |
henrik.lundin | e8a77e3 | 2016-06-22 06:34:03 -0700 | [diff] [blame] | 180 | |
| 181 | if (output_) { |
| 182 | RTC_CHECK(output_->WriteArray( |
yujo | 36b1a5f | 2017-06-12 12:45:32 -0700 | [diff] [blame] | 183 | out_frame.data(), |
henrik.lundin | e8a77e3 | 2016-06-22 06:34:03 -0700 | [diff] [blame] | 184 | out_frame.samples_per_channel_ * out_frame.num_channels_)); |
| 185 | } |
| 186 | |
| 187 | input_->AdvanceOutputEvent(); |
Henrik Lundin | 9be7745 | 2018-09-10 12:53:27 +0200 | [diff] [blame] | 188 | result.simulation_step_ms = |
| 189 | input_->NextEventTime().value_or(time_now_ms) - start_time_ms; |
Ivo Creusen | d1c2f78 | 2018-09-13 14:39:55 +0200 | [diff] [blame] | 190 | const auto operations_state = neteq_->GetOperationsAndState(); |
| 191 | current_state_.current_delay_ms = operations_state.current_buffer_size_ms; |
Ivo Creusen | dc6d553 | 2018-09-27 11:43:42 +0200 | [diff] [blame] | 192 | current_state_.packet_size_ms = operations_state.current_frame_size_ms; |
| 193 | current_state_.next_packet_available = |
| 194 | operations_state.next_packet_available; |
| 195 | current_state_.packet_buffer_flushed = |
| 196 | operations_state.packet_buffer_flushes > |
| 197 | prev_ops_state_.packet_buffer_flushes; |
Ivo Creusen | d1c2f78 | 2018-09-13 14:39:55 +0200 | [diff] [blame] | 198 | // TODO(ivoc): Add more accurate reporting by tracking the origin of |
| 199 | // samples in the sync buffer. |
| 200 | result.action_times_ms[Action::kExpand] = 0; |
| 201 | result.action_times_ms[Action::kAccelerate] = 0; |
| 202 | result.action_times_ms[Action::kPreemptiveExpand] = 0; |
| 203 | result.action_times_ms[Action::kNormal] = 0; |
| 204 | |
| 205 | if (out_frame.speech_type_ == AudioFrame::SpeechType::kPLC || |
| 206 | out_frame.speech_type_ == AudioFrame::SpeechType::kPLCCNG) { |
| 207 | // Consider the whole frame to be the result of expansion. |
| 208 | result.action_times_ms[Action::kExpand] = 10; |
| 209 | } else if (operations_state.accelerate_samples - |
| 210 | prev_ops_state_.accelerate_samples > |
| 211 | 0) { |
| 212 | // Consider the whole frame to be the result of acceleration. |
| 213 | result.action_times_ms[Action::kAccelerate] = 10; |
| 214 | } else if (operations_state.preemptive_samples - |
| 215 | prev_ops_state_.preemptive_samples > |
| 216 | 0) { |
| 217 | // Consider the whole frame to be the result of preemptive expansion. |
| 218 | result.action_times_ms[Action::kPreemptiveExpand] = 10; |
| 219 | } else { |
| 220 | // Consider the whole frame to be the result of normal playout. |
| 221 | result.action_times_ms[Action::kNormal] = 10; |
| 222 | } |
Ivo Creusen | 2db46b0 | 2018-12-14 16:49:12 +0100 | [diff] [blame] | 223 | auto lifetime_stats = LifetimeStats(); |
| 224 | if (text_log_) { |
| 225 | const bool plc = |
| 226 | (out_frame.speech_type_ == AudioFrame::SpeechType::kPLC) || |
| 227 | (out_frame.speech_type_ == AudioFrame::SpeechType::kPLCCNG); |
| 228 | const bool cng = out_frame.speech_type_ == AudioFrame::SpeechType::kCNG; |
| 229 | const bool voice_concealed = |
Ivo Creusen | bf4a221 | 2019-04-24 14:06:24 +0200 | [diff] [blame] | 230 | (lifetime_stats.concealed_samples - |
| 231 | lifetime_stats.silent_concealed_samples) > |
| 232 | (prev_lifetime_stats_.concealed_samples - |
| 233 | prev_lifetime_stats_.silent_concealed_samples); |
Ivo Creusen | 2db46b0 | 2018-12-14 16:49:12 +0100 | [diff] [blame] | 234 | *text_log_ << "GetAudio - wallclock: " << std::setw(5) << time_now_ms |
| 235 | << ", delta wc: " << std::setw(4) |
| 236 | << (input_->NextEventTime().value_or(time_now_ms) - |
| 237 | start_time_ms) |
| 238 | << ", CNG: " << cng << ", PLC: " << plc |
| 239 | << ", voice concealed: " << voice_concealed |
| 240 | << ", buffer size: " << std::setw(4) |
| 241 | << current_state_.current_delay_ms << std::endl; |
| 242 | if (operations_state.discarded_primary_packets > |
| 243 | prev_ops_state_.discarded_primary_packets) { |
| 244 | *text_log_ << "Discarded " |
| 245 | << (operations_state.discarded_primary_packets - |
| 246 | prev_ops_state_.discarded_primary_packets) |
| 247 | << " primary packets." << std::endl; |
| 248 | } |
| 249 | if (operations_state.packet_buffer_flushes > |
| 250 | prev_ops_state_.packet_buffer_flushes) { |
| 251 | *text_log_ << "Flushed packet buffer " |
| 252 | << (operations_state.packet_buffer_flushes - |
| 253 | prev_ops_state_.packet_buffer_flushes) |
| 254 | << " times." << std::endl; |
| 255 | } |
| 256 | } |
| 257 | prev_lifetime_stats_ = lifetime_stats; |
Jakob Ivarsson | 9ce451a | 2019-05-22 16:41:22 +0200 | [diff] [blame] | 258 | const bool no_more_packets_to_decode = |
| 259 | !input_->NextPacketTime() && !operations_state.next_packet_available; |
| 260 | result.is_simulation_finished = |
| 261 | no_more_packets_to_decode || input_->ended(); |
Ivo Creusen | d1c2f78 | 2018-09-13 14:39:55 +0200 | [diff] [blame] | 262 | prev_ops_state_ = operations_state; |
Ivo Creusen | 55de08e | 2018-09-03 11:49:27 +0200 | [diff] [blame] | 263 | return result; |
henrik.lundin | e8a77e3 | 2016-06-22 06:34:03 -0700 | [diff] [blame] | 264 | } |
| 265 | } |
Henrik Lundin | 9be7745 | 2018-09-10 12:53:27 +0200 | [diff] [blame] | 266 | result.simulation_step_ms = |
| 267 | input_->NextEventTime().value_or(time_now_ms) - start_time_ms; |
Ivo Creusen | 55de08e | 2018-09-03 11:49:27 +0200 | [diff] [blame] | 268 | result.is_simulation_finished = true; |
| 269 | return result; |
| 270 | } |
| 271 | |
| 272 | void NetEqTest::SetNextAction(NetEqTest::Action next_operation) { |
| 273 | next_action_ = absl::optional<Action>(next_operation); |
| 274 | } |
| 275 | |
| 276 | NetEqTest::NetEqState NetEqTest::GetNetEqState() { |
Ivo Creusen | 4384f53 | 2018-09-07 17:19:56 +0200 | [diff] [blame] | 277 | return current_state_; |
henrik.lundin | e8a77e3 | 2016-06-22 06:34:03 -0700 | [diff] [blame] | 278 | } |
| 279 | |
| 280 | NetEqNetworkStatistics NetEqTest::SimulationStats() { |
| 281 | NetEqNetworkStatistics stats; |
| 282 | RTC_CHECK_EQ(neteq_->NetworkStatistics(&stats), 0); |
| 283 | return stats; |
| 284 | } |
| 285 | |
Alex Narest | 7ff6ca5 | 2018-02-07 18:46:33 +0100 | [diff] [blame] | 286 | NetEqLifetimeStatistics NetEqTest::LifetimeStats() const { |
| 287 | return neteq_->GetLifetimeStatistics(); |
| 288 | } |
| 289 | |
Henrik Lundin | 7687ad5 | 2018-07-02 10:14:46 +0200 | [diff] [blame] | 290 | NetEqTest::DecoderMap NetEqTest::StandardDecoderMap() { |
| 291 | DecoderMap codecs = { |
Niels Möller | 0554368 | 2019-01-10 16:55:06 +0100 | [diff] [blame] | 292 | {0, SdpAudioFormat("pcmu", 8000, 1)}, |
| 293 | {8, SdpAudioFormat("pcma", 8000, 1)}, |
Henrik Lundin | 7687ad5 | 2018-07-02 10:14:46 +0200 | [diff] [blame] | 294 | #ifdef WEBRTC_CODEC_ILBC |
Niels Möller | 0554368 | 2019-01-10 16:55:06 +0100 | [diff] [blame] | 295 | {102, SdpAudioFormat("ilbc", 8000, 1)}, |
Henrik Lundin | 7687ad5 | 2018-07-02 10:14:46 +0200 | [diff] [blame] | 296 | #endif |
Niels Möller | 0554368 | 2019-01-10 16:55:06 +0100 | [diff] [blame] | 297 | {103, SdpAudioFormat("isac", 16000, 1)}, |
Henrik Lundin | 7687ad5 | 2018-07-02 10:14:46 +0200 | [diff] [blame] | 298 | #if !defined(WEBRTC_ANDROID) |
Niels Möller | 0554368 | 2019-01-10 16:55:06 +0100 | [diff] [blame] | 299 | {104, SdpAudioFormat("isac", 32000, 1)}, |
Henrik Lundin | 7687ad5 | 2018-07-02 10:14:46 +0200 | [diff] [blame] | 300 | #endif |
| 301 | #ifdef WEBRTC_CODEC_OPUS |
Niels Möller | 0554368 | 2019-01-10 16:55:06 +0100 | [diff] [blame] | 302 | {111, SdpAudioFormat("opus", 48000, 2)}, |
Henrik Lundin | 7687ad5 | 2018-07-02 10:14:46 +0200 | [diff] [blame] | 303 | #endif |
Niels Möller | 0554368 | 2019-01-10 16:55:06 +0100 | [diff] [blame] | 304 | {93, SdpAudioFormat("l16", 8000, 1)}, |
| 305 | {94, SdpAudioFormat("l16", 16000, 1)}, |
| 306 | {95, SdpAudioFormat("l16", 32000, 1)}, |
| 307 | {96, SdpAudioFormat("l16", 48000, 1)}, |
| 308 | {9, SdpAudioFormat("g722", 8000, 1)}, |
| 309 | {106, SdpAudioFormat("telephone-event", 8000, 1)}, |
| 310 | {114, SdpAudioFormat("telephone-event", 16000, 1)}, |
| 311 | {115, SdpAudioFormat("telephone-event", 32000, 1)}, |
| 312 | {116, SdpAudioFormat("telephone-event", 48000, 1)}, |
| 313 | {117, SdpAudioFormat("red", 8000, 1)}, |
| 314 | {13, SdpAudioFormat("cn", 8000, 1)}, |
| 315 | {98, SdpAudioFormat("cn", 16000, 1)}, |
| 316 | {99, SdpAudioFormat("cn", 32000, 1)}, |
| 317 | {100, SdpAudioFormat("cn", 48000, 1)} |
Henrik Lundin | 7687ad5 | 2018-07-02 10:14:46 +0200 | [diff] [blame] | 318 | }; |
| 319 | return codecs; |
| 320 | } |
| 321 | |
henrik.lundin | e8a77e3 | 2016-06-22 06:34:03 -0700 | [diff] [blame] | 322 | void NetEqTest::RegisterDecoders(const DecoderMap& codecs) { |
| 323 | for (const auto& c : codecs) { |
Niels Möller | 0554368 | 2019-01-10 16:55:06 +0100 | [diff] [blame] | 324 | RTC_CHECK(neteq_->RegisterPayloadType(c.first, c.second)) |
| 325 | << "Cannot register " << c.second.name << " to payload type " |
henrik.lundin | e8a77e3 | 2016-06-22 06:34:03 -0700 | [diff] [blame] | 326 | << c.first; |
| 327 | } |
| 328 | } |
| 329 | |
henrik.lundin | e8a77e3 | 2016-06-22 06:34:03 -0700 | [diff] [blame] | 330 | } // namespace test |
| 331 | } // namespace webrtc |