OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
109 google::RegisterFlagValidator(&FLAGS_pcm16b_wb, &ValidatePayloadType); | 109 google::RegisterFlagValidator(&FLAGS_pcm16b_wb, &ValidatePayloadType); |
110 DEFINE_int32(pcm16b_swb32, 95, "RTP payload type for PCM16b-swb32 (32 kHz)"); | 110 DEFINE_int32(pcm16b_swb32, 95, "RTP payload type for PCM16b-swb32 (32 kHz)"); |
111 const bool pcm16b_swb32_dummy = | 111 const bool pcm16b_swb32_dummy = |
112 google::RegisterFlagValidator(&FLAGS_pcm16b_swb32, &ValidatePayloadType); | 112 google::RegisterFlagValidator(&FLAGS_pcm16b_swb32, &ValidatePayloadType); |
113 DEFINE_int32(pcm16b_swb48, 96, "RTP payload type for PCM16b-swb48 (48 kHz)"); | 113 DEFINE_int32(pcm16b_swb48, 96, "RTP payload type for PCM16b-swb48 (48 kHz)"); |
114 const bool pcm16b_swb48_dummy = | 114 const bool pcm16b_swb48_dummy = |
115 google::RegisterFlagValidator(&FLAGS_pcm16b_swb48, &ValidatePayloadType); | 115 google::RegisterFlagValidator(&FLAGS_pcm16b_swb48, &ValidatePayloadType); |
116 DEFINE_int32(g722, 9, "RTP payload type for G.722"); | 116 DEFINE_int32(g722, 9, "RTP payload type for G.722"); |
117 const bool g722_dummy = | 117 const bool g722_dummy = |
118 google::RegisterFlagValidator(&FLAGS_g722, &ValidatePayloadType); | 118 google::RegisterFlagValidator(&FLAGS_g722, &ValidatePayloadType); |
119 DEFINE_int32(avt, 106, "RTP payload type for AVT/DTMF"); | 119 DEFINE_int32(avt_nb, 106, "RTP payload type for AVT/DTMF (8 kHz)"); |
120 const bool avt_dummy = | 120 const bool avt_nb_dummy = |
121 google::RegisterFlagValidator(&FLAGS_avt, &ValidatePayloadType); | 121 google::RegisterFlagValidator(&FLAGS_avt_nb, &ValidatePayloadType); |
122 DEFINE_int32(avt_wb, 114, "RTP payload type for AVT/DTMF (16 kHz)"); // TODO: | |
123 const bool avt_wb_dummy = | |
124 google::RegisterFlagValidator(&FLAGS_avt_wb, &ValidatePayloadType); | |
125 DEFINE_int32(avt_swb32, 115, "RTP payload type for AVT/DTMF (32 kHz)"); // TOD O: | |
126 const bool avt_swb32_dummy = | |
127 google::RegisterFlagValidator(&FLAGS_avt_swb32, &ValidatePayloadType); | |
128 DEFINE_int32(avt_swb48, 116, "RTP payload type for AVT/DTMF (48 kHz)"); // TOD O: | |
129 const bool avt_swb48_dummy = | |
130 google::RegisterFlagValidator(&FLAGS_avt_swb48, &ValidatePayloadType); | |
122 DEFINE_int32(red, 117, "RTP payload type for redundant audio (RED)"); | 131 DEFINE_int32(red, 117, "RTP payload type for redundant audio (RED)"); |
123 const bool red_dummy = | 132 const bool red_dummy = |
124 google::RegisterFlagValidator(&FLAGS_red, &ValidatePayloadType); | 133 google::RegisterFlagValidator(&FLAGS_red, &ValidatePayloadType); |
125 DEFINE_int32(cn_nb, 13, "RTP payload type for comfort noise (8 kHz)"); | 134 DEFINE_int32(cn_nb, 13, "RTP payload type for comfort noise (8 kHz)"); |
126 const bool cn_nb_dummy = | 135 const bool cn_nb_dummy = |
127 google::RegisterFlagValidator(&FLAGS_cn_nb, &ValidatePayloadType); | 136 google::RegisterFlagValidator(&FLAGS_cn_nb, &ValidatePayloadType); |
128 DEFINE_int32(cn_wb, 98, "RTP payload type for comfort noise (16 kHz)"); | 137 DEFINE_int32(cn_wb, 98, "RTP payload type for comfort noise (16 kHz)"); |
129 const bool cn_wb_dummy = | 138 const bool cn_wb_dummy = |
130 google::RegisterFlagValidator(&FLAGS_cn_wb, &ValidatePayloadType); | 139 google::RegisterFlagValidator(&FLAGS_cn_wb, &ValidatePayloadType); |
131 DEFINE_int32(cn_swb32, 99, "RTP payload type for comfort noise (32 kHz)"); | 140 DEFINE_int32(cn_swb32, 99, "RTP payload type for comfort noise (32 kHz)"); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
171 case NetEqDecoder::kDecoderPCM16Bwb: | 180 case NetEqDecoder::kDecoderPCM16Bwb: |
172 return "PCM16b-wb (16 kHz)"; | 181 return "PCM16b-wb (16 kHz)"; |
173 case NetEqDecoder::kDecoderPCM16Bswb32kHz: | 182 case NetEqDecoder::kDecoderPCM16Bswb32kHz: |
174 return "PCM16b-swb32 (32 kHz)"; | 183 return "PCM16b-swb32 (32 kHz)"; |
175 case NetEqDecoder::kDecoderPCM16Bswb48kHz: | 184 case NetEqDecoder::kDecoderPCM16Bswb48kHz: |
176 return "PCM16b-swb48 (48 kHz)"; | 185 return "PCM16b-swb48 (48 kHz)"; |
177 case NetEqDecoder::kDecoderG722: | 186 case NetEqDecoder::kDecoderG722: |
178 return "G.722"; | 187 return "G.722"; |
179 case NetEqDecoder::kDecoderRED: | 188 case NetEqDecoder::kDecoderRED: |
180 return "redundant audio (RED)"; | 189 return "redundant audio (RED)"; |
181 case NetEqDecoder::kDecoderAVT: | 190 case NetEqDecoder::kDecoderAVT8kHz: |
182 return "AVT/DTMF"; | 191 return "AVT/DTMF (8 kHz)"; |
192 case NetEqDecoder::kDecoderAVT16kHz: | |
193 return "AVT/DTMF (16 kHz)"; | |
194 case NetEqDecoder::kDecoderAVT32kHz: | |
195 return "AVT/DTMF (32 kHz)"; | |
196 case NetEqDecoder::kDecoderAVT48kHz: | |
197 return "AVT/DTMF (48 kHz)"; | |
183 case NetEqDecoder::kDecoderCNGnb: | 198 case NetEqDecoder::kDecoderCNGnb: |
184 return "comfort noise (8 kHz)"; | 199 return "comfort noise (8 kHz)"; |
185 case NetEqDecoder::kDecoderCNGwb: | 200 case NetEqDecoder::kDecoderCNGwb: |
186 return "comfort noise (16 kHz)"; | 201 return "comfort noise (16 kHz)"; |
187 case NetEqDecoder::kDecoderCNGswb32kHz: | 202 case NetEqDecoder::kDecoderCNGswb32kHz: |
188 return "comfort noise (32 kHz)"; | 203 return "comfort noise (32 kHz)"; |
189 case NetEqDecoder::kDecoderCNGswb48kHz: | 204 case NetEqDecoder::kDecoderCNGswb48kHz: |
190 return "comfort noise (48 kHz)"; | 205 return "comfort noise (48 kHz)"; |
191 default: | 206 default: |
192 FATAL(); | 207 FATAL(); |
(...skipping 12 matching lines...) Expand all Loading... | |
205 PrintCodecMappingEntry(NetEqDecoder::kDecoderISAC, FLAGS_isac); | 220 PrintCodecMappingEntry(NetEqDecoder::kDecoderISAC, FLAGS_isac); |
206 PrintCodecMappingEntry(NetEqDecoder::kDecoderISACswb, FLAGS_isac_swb); | 221 PrintCodecMappingEntry(NetEqDecoder::kDecoderISACswb, FLAGS_isac_swb); |
207 PrintCodecMappingEntry(NetEqDecoder::kDecoderOpus, FLAGS_opus); | 222 PrintCodecMappingEntry(NetEqDecoder::kDecoderOpus, FLAGS_opus); |
208 PrintCodecMappingEntry(NetEqDecoder::kDecoderPCM16B, FLAGS_pcm16b); | 223 PrintCodecMappingEntry(NetEqDecoder::kDecoderPCM16B, FLAGS_pcm16b); |
209 PrintCodecMappingEntry(NetEqDecoder::kDecoderPCM16Bwb, FLAGS_pcm16b_wb); | 224 PrintCodecMappingEntry(NetEqDecoder::kDecoderPCM16Bwb, FLAGS_pcm16b_wb); |
210 PrintCodecMappingEntry(NetEqDecoder::kDecoderPCM16Bswb32kHz, | 225 PrintCodecMappingEntry(NetEqDecoder::kDecoderPCM16Bswb32kHz, |
211 FLAGS_pcm16b_swb32); | 226 FLAGS_pcm16b_swb32); |
212 PrintCodecMappingEntry(NetEqDecoder::kDecoderPCM16Bswb48kHz, | 227 PrintCodecMappingEntry(NetEqDecoder::kDecoderPCM16Bswb48kHz, |
213 FLAGS_pcm16b_swb48); | 228 FLAGS_pcm16b_swb48); |
214 PrintCodecMappingEntry(NetEqDecoder::kDecoderG722, FLAGS_g722); | 229 PrintCodecMappingEntry(NetEqDecoder::kDecoderG722, FLAGS_g722); |
215 PrintCodecMappingEntry(NetEqDecoder::kDecoderAVT, FLAGS_avt); | 230 PrintCodecMappingEntry(NetEqDecoder::kDecoderAVT8kHz, FLAGS_avt_nb); |
231 PrintCodecMappingEntry(NetEqDecoder::kDecoderAVT16kHz, FLAGS_avt_wb); | |
232 PrintCodecMappingEntry(NetEqDecoder::kDecoderAVT32kHz, FLAGS_avt_swb32); | |
233 PrintCodecMappingEntry(NetEqDecoder::kDecoderAVT48kHz, FLAGS_avt_swb48); | |
216 PrintCodecMappingEntry(NetEqDecoder::kDecoderRED, FLAGS_red); | 234 PrintCodecMappingEntry(NetEqDecoder::kDecoderRED, FLAGS_red); |
217 PrintCodecMappingEntry(NetEqDecoder::kDecoderCNGnb, FLAGS_cn_nb); | 235 PrintCodecMappingEntry(NetEqDecoder::kDecoderCNGnb, FLAGS_cn_nb); |
218 PrintCodecMappingEntry(NetEqDecoder::kDecoderCNGwb, FLAGS_cn_wb); | 236 PrintCodecMappingEntry(NetEqDecoder::kDecoderCNGwb, FLAGS_cn_wb); |
219 PrintCodecMappingEntry(NetEqDecoder::kDecoderCNGswb32kHz, FLAGS_cn_swb32); | 237 PrintCodecMappingEntry(NetEqDecoder::kDecoderCNGswb32kHz, FLAGS_cn_swb32); |
220 PrintCodecMappingEntry(NetEqDecoder::kDecoderCNGswb48kHz, FLAGS_cn_swb48); | 238 PrintCodecMappingEntry(NetEqDecoder::kDecoderCNGswb48kHz, FLAGS_cn_swb48); |
221 } | 239 } |
222 | 240 |
223 int CodecSampleRate(uint8_t payload_type) { | 241 int CodecSampleRate(uint8_t payload_type) { |
224 if (payload_type == FLAGS_pcmu || payload_type == FLAGS_pcma || | 242 if (payload_type == FLAGS_pcmu || payload_type == FLAGS_pcma || |
225 payload_type == FLAGS_ilbc || payload_type == FLAGS_pcm16b || | 243 payload_type == FLAGS_ilbc || payload_type == FLAGS_pcm16b || |
226 payload_type == FLAGS_cn_nb) | 244 payload_type == FLAGS_cn_nb || payload_type == FLAGS_avt_nb) |
227 return 8000; | 245 return 8000; |
228 if (payload_type == FLAGS_isac || payload_type == FLAGS_pcm16b_wb || | 246 if (payload_type == FLAGS_isac || payload_type == FLAGS_pcm16b_wb || |
229 payload_type == FLAGS_g722 || payload_type == FLAGS_cn_wb) | 247 payload_type == FLAGS_g722 || payload_type == FLAGS_cn_wb || |
248 payload_type == FLAGS_avt_wb) | |
230 return 16000; | 249 return 16000; |
231 if (payload_type == FLAGS_isac_swb || payload_type == FLAGS_pcm16b_swb32 || | 250 if (payload_type == FLAGS_isac_swb || payload_type == FLAGS_pcm16b_swb32 || |
232 payload_type == FLAGS_cn_swb32) | 251 payload_type == FLAGS_cn_swb32 || payload_type == FLAGS_avt_swb32) |
233 return 32000; | 252 return 32000; |
234 if (payload_type == FLAGS_opus || payload_type == FLAGS_pcm16b_swb48 || | 253 if (payload_type == FLAGS_opus || payload_type == FLAGS_pcm16b_swb48 || |
235 payload_type == FLAGS_cn_swb48) | 254 payload_type == FLAGS_cn_swb48 || payload_type == FLAGS_avt_swb48) |
236 return 48000; | 255 return 48000; |
237 if (payload_type == FLAGS_avt || payload_type == FLAGS_red) | 256 if (payload_type == FLAGS_red) |
ossu
2016/10/04 09:26:57
Why could this be 0 before but not anymore?
the sun
2016/10/08 22:06:51
It couldn't. Previously, a WAVE file with SR=0 wou
ossu
2016/10/10 23:26:34
Acknowledged.
| |
238 return 0; | 257 return 0; |
239 return -1; | 258 return -1; |
240 } | 259 } |
241 | 260 |
242 // Class to let through only the packets with a given SSRC. Should be used as an | 261 // Class to let through only the packets with a given SSRC. Should be used as an |
243 // outer layer on another NetEqInput object. | 262 // outer layer on another NetEqInput object. |
244 class FilterSsrcInput : public NetEqInput { | 263 class FilterSsrcInput : public NetEqInput { |
245 public: | 264 public: |
246 FilterSsrcInput(std::unique_ptr<NetEqInput> source, uint32_t ssrc) | 265 FilterSsrcInput(std::unique_ptr<NetEqInput> source, uint32_t ssrc) |
247 : source_(std::move(source)), ssrc_(ssrc) { | 266 : source_(std::move(source)), ssrc_(ssrc) { |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
368 std::make_pair(NetEqDecoder::kDecoderISACswb, "isac-swb")}, | 387 std::make_pair(NetEqDecoder::kDecoderISACswb, "isac-swb")}, |
369 {FLAGS_opus, std::make_pair(NetEqDecoder::kDecoderOpus, "opus")}, | 388 {FLAGS_opus, std::make_pair(NetEqDecoder::kDecoderOpus, "opus")}, |
370 {FLAGS_pcm16b, std::make_pair(NetEqDecoder::kDecoderPCM16B, "pcm16-nb")}, | 389 {FLAGS_pcm16b, std::make_pair(NetEqDecoder::kDecoderPCM16B, "pcm16-nb")}, |
371 {FLAGS_pcm16b_wb, | 390 {FLAGS_pcm16b_wb, |
372 std::make_pair(NetEqDecoder::kDecoderPCM16Bwb, "pcm16-wb")}, | 391 std::make_pair(NetEqDecoder::kDecoderPCM16Bwb, "pcm16-wb")}, |
373 {FLAGS_pcm16b_swb32, | 392 {FLAGS_pcm16b_swb32, |
374 std::make_pair(NetEqDecoder::kDecoderPCM16Bswb32kHz, "pcm16-swb32")}, | 393 std::make_pair(NetEqDecoder::kDecoderPCM16Bswb32kHz, "pcm16-swb32")}, |
375 {FLAGS_pcm16b_swb48, | 394 {FLAGS_pcm16b_swb48, |
376 std::make_pair(NetEqDecoder::kDecoderPCM16Bswb48kHz, "pcm16-swb48")}, | 395 std::make_pair(NetEqDecoder::kDecoderPCM16Bswb48kHz, "pcm16-swb48")}, |
377 {FLAGS_g722, std::make_pair(NetEqDecoder::kDecoderG722, "g722")}, | 396 {FLAGS_g722, std::make_pair(NetEqDecoder::kDecoderG722, "g722")}, |
378 {FLAGS_avt, std::make_pair(NetEqDecoder::kDecoderAVT, "avt")}, | 397 {FLAGS_avt_nb, std::make_pair(NetEqDecoder::kDecoderAVT8kHz, "avt-nb")}, |
398 {FLAGS_avt_wb, std::make_pair(NetEqDecoder::kDecoderAVT16kHz, "avt-wb")}, | |
399 {FLAGS_avt_swb32, | |
400 std::make_pair(NetEqDecoder::kDecoderAVT32kHz, "avt-swb32")}, | |
401 {FLAGS_avt_swb48, | |
402 std::make_pair(NetEqDecoder::kDecoderAVT48kHz, "avt-swb48")}, | |
379 {FLAGS_red, std::make_pair(NetEqDecoder::kDecoderRED, "red")}, | 403 {FLAGS_red, std::make_pair(NetEqDecoder::kDecoderRED, "red")}, |
380 {FLAGS_cn_nb, std::make_pair(NetEqDecoder::kDecoderCNGnb, "cng-nb")}, | 404 {FLAGS_cn_nb, std::make_pair(NetEqDecoder::kDecoderCNGnb, "cng-nb")}, |
381 {FLAGS_cn_wb, std::make_pair(NetEqDecoder::kDecoderCNGwb, "cng-wb")}, | 405 {FLAGS_cn_wb, std::make_pair(NetEqDecoder::kDecoderCNGwb, "cng-wb")}, |
382 {FLAGS_cn_swb32, | 406 {FLAGS_cn_swb32, |
383 std::make_pair(NetEqDecoder::kDecoderCNGswb32kHz, "cng-swb32")}, | 407 std::make_pair(NetEqDecoder::kDecoderCNGswb32kHz, "cng-swb32")}, |
384 {FLAGS_cn_swb48, | 408 {FLAGS_cn_swb48, |
385 std::make_pair(NetEqDecoder::kDecoderCNGswb48kHz, "cng-swb48")}}; | 409 std::make_pair(NetEqDecoder::kDecoderCNGswb48kHz, "cng-swb48")}}; |
386 | 410 |
387 // Check if a replacement audio file was provided. | 411 // Check if a replacement audio file was provided. |
388 std::unique_ptr<AudioDecoder> replacement_decoder; | 412 std::unique_ptr<AudioDecoder> replacement_decoder; |
(...skipping 11 matching lines...) Expand all Loading... | |
400 std::set<uint8_t> b; | 424 std::set<uint8_t> b; |
401 for (auto& x : a) { | 425 for (auto& x : a) { |
402 b.insert(static_cast<uint8_t>(x)); | 426 b.insert(static_cast<uint8_t>(x)); |
403 } | 427 } |
404 return b; | 428 return b; |
405 }; | 429 }; |
406 | 430 |
407 std::set<uint8_t> cn_types = std_set_int32_to_uint8( | 431 std::set<uint8_t> cn_types = std_set_int32_to_uint8( |
408 {FLAGS_cn_nb, FLAGS_cn_wb, FLAGS_cn_swb32, FLAGS_cn_swb48}); | 432 {FLAGS_cn_nb, FLAGS_cn_wb, FLAGS_cn_swb32, FLAGS_cn_swb48}); |
409 std::set<uint8_t> forbidden_types = | 433 std::set<uint8_t> forbidden_types = |
410 std_set_int32_to_uint8({FLAGS_g722, FLAGS_red, FLAGS_avt}); | 434 std_set_int32_to_uint8({FLAGS_g722, FLAGS_red, FLAGS_avt_nb, |
435 FLAGS_avt_wb, FLAGS_avt_swb32, | |
436 FLAGS_avt_swb48}); | |
411 input.reset(new NetEqReplacementInput(std::move(input), replacement_pt, | 437 input.reset(new NetEqReplacementInput(std::move(input), replacement_pt, |
412 cn_types, forbidden_types)); | 438 cn_types, forbidden_types)); |
413 | 439 |
414 replacement_decoder.reset(new FakeDecodeFromFile( | 440 replacement_decoder.reset(new FakeDecodeFromFile( |
415 std::unique_ptr<InputAudioFile>( | 441 std::unique_ptr<InputAudioFile>( |
416 new InputAudioFile(FLAGS_replacement_audio_file)), | 442 new InputAudioFile(FLAGS_replacement_audio_file)), |
417 48000, false)); | 443 48000, false)); |
418 NetEqTest::ExternalDecoderInfo ext_dec_info = { | 444 NetEqTest::ExternalDecoderInfo ext_dec_info = { |
419 replacement_decoder.get(), NetEqDecoder::kDecoderArbitrary, | 445 replacement_decoder.get(), NetEqDecoder::kDecoderArbitrary, |
420 "replacement codec"}; | 446 "replacement codec"}; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
452 return 0; | 478 return 0; |
453 } | 479 } |
454 | 480 |
455 } // namespace | 481 } // namespace |
456 } // namespace test | 482 } // namespace test |
457 } // namespace webrtc | 483 } // namespace webrtc |
458 | 484 |
459 int main(int argc, char* argv[]) { | 485 int main(int argc, char* argv[]) { |
460 webrtc::test::RunTest(argc, argv); | 486 webrtc::test::RunTest(argc, argv); |
461 } | 487 } |
OLD | NEW |