2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
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.
11 // TODO(hlundin): The functionality in this file should be moved into one or
21 #include "google/gflags.h"
22 #include "webrtc/modules/audio_coding/codecs/pcm16b/include/pcm16b.h"
23 #include "webrtc/modules/audio_coding/neteq4/interface/neteq.h"
24 #include "webrtc/modules/audio_coding/neteq4/test/NETEQTEST_RTPpacket.h"
25 #include "webrtc/modules/audio_coding/neteq4/test/NETEQTEST_DummyRTPpacket.h"
26 #include "webrtc/modules/audio_coding/neteq4/tools/input_audio_file.h"
27 #include "webrtc/modules/interface/module_common_types.h"
28 #include "webrtc/system_wrappers/interface/scoped_ptr.h"
29 #include "webrtc/system_wrappers/interface/trace.h"
30 #include "webrtc/test/testsupport/fileutils.h"
31 #include "webrtc/typedefs.h"
34 using webrtc::WebRtcRTPHeader;
37 static bool ValidatePayloadType(const char* flagname, int32_t value) {
38 if (value >= 0 && value <= 127) // Value is ok.
40 printf("Invalid value for --%s: %d\n", flagname, static_cast<int>(value));
44 // Define command line flags.
45 DEFINE_int32(pcmu, 0, "RTP payload type for PCM-u");
46 static const bool pcmu_dummy =
47 google::RegisterFlagValidator(&FLAGS_pcmu, &ValidatePayloadType);
48 DEFINE_int32(pcma, 8, "RTP payload type for PCM-a");
49 static const bool pcma_dummy =
50 google::RegisterFlagValidator(&FLAGS_pcma, &ValidatePayloadType);
51 DEFINE_int32(ilbc, 102, "RTP payload type for iLBC");
52 static const bool ilbc_dummy =
53 google::RegisterFlagValidator(&FLAGS_ilbc, &ValidatePayloadType);
54 DEFINE_int32(isac, 103, "RTP payload type for iSAC");
55 static const bool isac_dummy =
56 google::RegisterFlagValidator(&FLAGS_isac, &ValidatePayloadType);
57 DEFINE_int32(isac_swb, 104, "RTP payload type for iSAC-swb (32 kHz)");
58 static const bool isac_swb_dummy =
59 google::RegisterFlagValidator(&FLAGS_isac_swb, &ValidatePayloadType);
60 DEFINE_int32(pcm16b, 93, "RTP payload type for PCM16b-nb (8 kHz)");
61 static const bool pcm16b_dummy =
62 google::RegisterFlagValidator(&FLAGS_pcm16b, &ValidatePayloadType);
63 DEFINE_int32(pcm16b_wb, 94, "RTP payload type for PCM16b-wb (16 kHz)");
64 static const bool pcm16b_wb_dummy =
65 google::RegisterFlagValidator(&FLAGS_pcm16b_wb, &ValidatePayloadType);
66 DEFINE_int32(pcm16b_swb32, 95, "RTP payload type for PCM16b-swb32 (32 kHz)");
67 static const bool pcm16b_swb32_dummy =
68 google::RegisterFlagValidator(&FLAGS_pcm16b_swb32, &ValidatePayloadType);
69 DEFINE_int32(pcm16b_swb48, 96, "RTP payload type for PCM16b-swb48 (48 kHz)");
70 static const bool pcm16b_swb48_dummy =
71 google::RegisterFlagValidator(&FLAGS_pcm16b_swb48, &ValidatePayloadType);
72 DEFINE_int32(g722, 9, "RTP payload type for G.722");
73 static const bool g722_dummy =
74 google::RegisterFlagValidator(&FLAGS_g722, &ValidatePayloadType);
75 DEFINE_int32(avt, 106, "RTP payload type for AVT/DTMF");
76 static const bool avt_dummy =
77 google::RegisterFlagValidator(&FLAGS_avt, &ValidatePayloadType);
78 DEFINE_int32(red, 117, "RTP payload type for redundant audio (RED)");
79 static const bool red_dummy =
80 google::RegisterFlagValidator(&FLAGS_red, &ValidatePayloadType);
81 DEFINE_int32(cn_nb, 13, "RTP payload type for comfort noise (8 kHz)");
82 static const bool cn_nb_dummy =
83 google::RegisterFlagValidator(&FLAGS_cn_nb, &ValidatePayloadType);
84 DEFINE_int32(cn_wb, 98, "RTP payload type for comfort noise (16 kHz)");
85 static const bool cn_wb_dummy =
86 google::RegisterFlagValidator(&FLAGS_cn_wb, &ValidatePayloadType);
87 DEFINE_int32(cn_swb32, 99, "RTP payload type for comfort noise (32 kHz)");
88 static const bool cn_swb32_dummy =
89 google::RegisterFlagValidator(&FLAGS_cn_swb32, &ValidatePayloadType);
90 DEFINE_int32(cn_swb48, 100, "RTP payload type for comfort noise (48 kHz)");
91 static const bool cn_swb48_dummy =
92 google::RegisterFlagValidator(&FLAGS_cn_swb48, &ValidatePayloadType);
93 DEFINE_bool(codec_map, false, "Prints the mapping between RTP payload type and "
95 DEFINE_bool(dummy_rtp, false, "The input file contains ""dummy"" RTP data, "
96 "i.e., only headers");
97 DEFINE_string(replacement_audio_file, "",
98 "A PCM file that will be used to populate ""dummy"" RTP packets");
100 // Declaring helper functions (defined further down in this file).
101 std::string CodecName(webrtc::NetEqDecoder codec);
102 void RegisterPayloadTypes(NetEq* neteq);
103 void PrintCodecMapping();
104 size_t ReplacePayload(webrtc::test::InputAudioFile* replacement_audio_file,
105 webrtc::scoped_ptr<int16_t[]>* replacement_audio,
106 webrtc::scoped_ptr<uint8_t[]>* payload,
107 size_t* payload_mem_size_bytes,
108 size_t* frame_size_samples,
109 WebRtcRTPHeader* rtp_header,
110 NETEQTEST_RTPpacket* next_rtp);
111 int CodecSampleRate(uint8_t payload_type);
112 int CodecTimestampRate(uint8_t payload_type);
113 bool IsComfortNosie(uint8_t payload_type);
115 int main(int argc, char* argv[]) {
116 static const int kMaxChannels = 5;
117 static const int kMaxSamplesPerMs = 48000 / 1000;
118 static const int kOutputBlockSizeMs = 10;
120 std::string program_name = argv[0];
121 std::string usage = "Tool for decoding an RTP dump file using NetEq.\n"
122 "Run " + program_name + " --helpshort for usage.\n"
123 "Example usage:\n" + program_name +
124 " input.rtp output.pcm\n";
125 google::SetUsageMessage(usage);
126 google::ParseCommandLineFlags(&argc, &argv, true);
128 if (FLAGS_codec_map) {
133 if (FLAGS_codec_map) {
134 // We have already printed the codec map. Just end the program.
137 // Print usage information.
138 std::cout << google::ProgramUsage();
142 FILE* in_file = fopen(argv[1], "rb");
144 std::cerr << "Cannot open input file " << argv[1] << std::endl;
147 std::cout << "Input file: " << argv[1] << std::endl;
149 FILE* out_file = fopen(argv[2], "wb");
151 std::cerr << "Cannot open output file " << argv[2] << std::endl;
154 std::cout << "Output file: " << argv[2] << std::endl;
156 // Check if a replacement audio file was provided, and if so, open it.
157 bool replace_payload = false;
158 webrtc::scoped_ptr<webrtc::test::InputAudioFile> replacement_audio_file;
159 if (!FLAGS_replacement_audio_file.empty()) {
160 replacement_audio_file.reset(
161 new webrtc::test::InputAudioFile(FLAGS_replacement_audio_file));
162 replace_payload = true;
165 // Read RTP file header.
166 if (NETEQTEST_RTPpacket::skipFileHeader(in_file) != 0) {
167 std::cerr << "Wrong format in RTP file" << std::endl;
172 webrtc::Trace::CreateTrace();
173 webrtc::Trace::SetTraceFile((webrtc::test::OutputPath() +
174 "neteq_trace.txt").c_str());
175 webrtc::Trace::set_level_filter(webrtc::kTraceAll);
177 // Initialize NetEq instance.
178 int sample_rate_hz = 16000;
179 NetEq* neteq = NetEq::Create(sample_rate_hz);
180 RegisterPayloadTypes(neteq);
182 // Read first packet.
183 NETEQTEST_RTPpacket* rtp;
184 NETEQTEST_RTPpacket* next_rtp = NULL;
185 if (!FLAGS_dummy_rtp) {
186 rtp = new NETEQTEST_RTPpacket();
187 if (replace_payload) {
188 next_rtp = new NETEQTEST_RTPpacket();
191 rtp = new NETEQTEST_DummyRTPpacket();
192 if (replace_payload) {
193 next_rtp = new NETEQTEST_DummyRTPpacket();
196 rtp->readFromFile(in_file);
197 if (rtp->dataLen() < 0) {
198 std::cout << "Warning: RTP file is empty" << std::endl;
201 // Set up variables for audio replacement if needed.
202 size_t input_frame_size_timestamps = 0;
203 webrtc::scoped_ptr<int16_t[]> replacement_audio;
204 webrtc::scoped_ptr<uint8_t[]> payload;
205 size_t payload_mem_size_bytes = 0;
206 if (replace_payload) {
207 // Initially assume that the frame size is 30 ms at the initial sample rate.
208 // This value will be replaced with the correct one as soon as two
209 // consecutive packets are found.
210 input_frame_size_timestamps = 30 * sample_rate_hz / 1000;
211 replacement_audio.reset(new int16_t[input_frame_size_timestamps]);
212 payload_mem_size_bytes = 2 * input_frame_size_timestamps;
213 payload.reset(new uint8_t[payload_mem_size_bytes]);
215 next_rtp->readFromFile(in_file);
218 // This is the main simulation loop.
219 int time_now_ms = rtp->time(); // Start immediately with the first packet.
220 int next_input_time_ms = rtp->time();
221 int next_output_time_ms = time_now_ms;
222 if (time_now_ms % kOutputBlockSizeMs != 0) {
223 // Make sure that next_output_time_ms is rounded up to the next multiple
224 // of kOutputBlockSizeMs. (Legacy bit-exactness.)
225 next_output_time_ms +=
226 kOutputBlockSizeMs - time_now_ms % kOutputBlockSizeMs;
228 while (rtp->dataLen() >= 0) {
229 // Check if it is time to insert packet.
230 while (time_now_ms >= next_input_time_ms && rtp->dataLen() >= 0) {
231 if (rtp->dataLen() > 0) {
233 WebRtcRTPHeader rtp_header;
234 rtp->parseHeader(&rtp_header);
235 uint8_t* payload_ptr = rtp->payload();
236 size_t payload_len = rtp->payloadLen();
237 if (replace_payload) {
238 payload_len = ReplacePayload(replacement_audio_file.get(),
241 &payload_mem_size_bytes,
242 &input_frame_size_timestamps,
245 payload_ptr = payload.get();
247 int error = neteq->InsertPacket(rtp_header, payload_ptr,
248 static_cast<int>(payload_len),
249 rtp->time() * sample_rate_hz / 1000);
250 if (error != NetEq::kOK) {
251 std::cerr << "InsertPacket returned error code " <<
252 neteq->LastError() << std::endl;
255 // Get next packet from file.
256 rtp->readFromFile(in_file);
257 if (replace_payload) {
258 // At this point |rtp| contains the packet *after* |next_rtp|.
259 // Swap RTP packet objects between |rtp| and |next_rtp|.
260 NETEQTEST_RTPpacket* temp_rtp = rtp;
264 next_input_time_ms = rtp->time();
267 // Check if it is time to get output audio.
268 if (time_now_ms >= next_output_time_ms) {
269 static const int kOutDataLen = kOutputBlockSizeMs * kMaxSamplesPerMs *
271 int16_t out_data[kOutDataLen];
273 int samples_per_channel;
274 int error = neteq->GetAudio(kOutDataLen, out_data, &samples_per_channel,
275 &num_channels, NULL);
276 if (error != NetEq::kOK) {
277 std::cerr << "GetAudio returned error code " <<
278 neteq->LastError() << std::endl;
280 // Calculate sample rate from output size.
281 sample_rate_hz = 1000 * samples_per_channel / kOutputBlockSizeMs;
285 // TODO(hlundin): Make writing to file optional.
286 size_t write_len = samples_per_channel * num_channels;
287 if (fwrite(out_data, sizeof(out_data[0]), write_len, out_file) !=
289 std::cerr << "Error while writing to file" << std::endl;
290 webrtc::Trace::ReturnTrace();
293 next_output_time_ms += kOutputBlockSizeMs;
295 // Advance time to next event.
296 time_now_ms = std::min(next_input_time_ms, next_output_time_ms);
299 std::cout << "Simulation done" << std::endl;
306 webrtc::Trace::ReturnTrace();
313 // Maps a codec type to a printable name string.
314 std::string CodecName(webrtc::NetEqDecoder codec) {
316 case webrtc::kDecoderPCMu:
318 case webrtc::kDecoderPCMa:
320 case webrtc::kDecoderILBC:
322 case webrtc::kDecoderISAC:
324 case webrtc::kDecoderISACswb:
325 return "iSAC-swb (32 kHz)";
326 case webrtc::kDecoderPCM16B:
327 return "PCM16b-nb (8 kHz)";
328 case webrtc::kDecoderPCM16Bwb:
329 return "PCM16b-wb (16 kHz)";
330 case webrtc::kDecoderPCM16Bswb32kHz:
331 return "PCM16b-swb32 (32 kHz)";
332 case webrtc::kDecoderPCM16Bswb48kHz:
333 return "PCM16b-swb48 (48 kHz)";
334 case webrtc::kDecoderG722:
336 case webrtc::kDecoderRED:
337 return "redundant audio (RED)";
338 case webrtc::kDecoderAVT:
340 case webrtc::kDecoderCNGnb:
341 return "comfort noise (8 kHz)";
342 case webrtc::kDecoderCNGwb:
343 return "comfort noise (16 kHz)";
344 case webrtc::kDecoderCNGswb32kHz:
345 return "comfort noise (32 kHz)";
346 case webrtc::kDecoderCNGswb48kHz:
347 return "comfort noise (48 kHz)";
354 // Registers all decoders in |neteq|.
355 void RegisterPayloadTypes(NetEq* neteq) {
358 error = neteq->RegisterPayloadType(webrtc::kDecoderPCMu, FLAGS_pcmu);
360 std::cerr << "Cannot register payload type " << FLAGS_pcmu <<
361 " as " << CodecName(webrtc::kDecoderPCMu).c_str() << std::endl;
364 error = neteq->RegisterPayloadType(webrtc::kDecoderPCMa, FLAGS_pcma);
366 std::cerr << "Cannot register payload type " << FLAGS_pcma <<
367 " as " << CodecName(webrtc::kDecoderPCMa).c_str() << std::endl;
370 error = neteq->RegisterPayloadType(webrtc::kDecoderILBC, FLAGS_ilbc);
372 std::cerr << "Cannot register payload type " << FLAGS_ilbc <<
373 " as " << CodecName(webrtc::kDecoderILBC).c_str() << std::endl;
376 error = neteq->RegisterPayloadType(webrtc::kDecoderISAC, FLAGS_isac);
378 std::cerr << "Cannot register payload type " << FLAGS_isac <<
379 " as " << CodecName(webrtc::kDecoderISAC).c_str() << std::endl;
382 error = neteq->RegisterPayloadType(webrtc::kDecoderISACswb, FLAGS_isac_swb);
384 std::cerr << "Cannot register payload type " << FLAGS_isac_swb <<
385 " as " << CodecName(webrtc::kDecoderISACswb).c_str() << std::endl;
388 error = neteq->RegisterPayloadType(webrtc::kDecoderPCM16B, FLAGS_pcm16b);
390 std::cerr << "Cannot register payload type " << FLAGS_pcm16b <<
391 " as " << CodecName(webrtc::kDecoderPCM16B).c_str() << std::endl;
394 error = neteq->RegisterPayloadType(webrtc::kDecoderPCM16Bwb,
397 std::cerr << "Cannot register payload type " << FLAGS_pcm16b_wb <<
398 " as " << CodecName(webrtc::kDecoderPCM16Bwb).c_str() << std::endl;
401 error = neteq->RegisterPayloadType(webrtc::kDecoderPCM16Bswb32kHz,
404 std::cerr << "Cannot register payload type " << FLAGS_pcm16b_swb32 <<
405 " as " << CodecName(webrtc::kDecoderPCM16Bswb32kHz).c_str() <<
409 error = neteq->RegisterPayloadType(webrtc::kDecoderPCM16Bswb48kHz,
412 std::cerr << "Cannot register payload type " << FLAGS_pcm16b_swb48 <<
413 " as " << CodecName(webrtc::kDecoderPCM16Bswb48kHz).c_str() <<
417 error = neteq->RegisterPayloadType(webrtc::kDecoderG722, FLAGS_g722);
419 std::cerr << "Cannot register payload type " << FLAGS_g722 <<
420 " as " << CodecName(webrtc::kDecoderG722).c_str() << std::endl;
423 error = neteq->RegisterPayloadType(webrtc::kDecoderAVT, FLAGS_avt);
425 std::cerr << "Cannot register payload type " << FLAGS_avt <<
426 " as " << CodecName(webrtc::kDecoderAVT).c_str() << std::endl;
429 error = neteq->RegisterPayloadType(webrtc::kDecoderRED, FLAGS_red);
431 std::cerr << "Cannot register payload type " << FLAGS_red <<
432 " as " << CodecName(webrtc::kDecoderRED).c_str() << std::endl;
435 error = neteq->RegisterPayloadType(webrtc::kDecoderCNGnb, FLAGS_cn_nb);
437 std::cerr << "Cannot register payload type " << FLAGS_cn_nb <<
438 " as " << CodecName(webrtc::kDecoderCNGnb).c_str() << std::endl;
441 error = neteq->RegisterPayloadType(webrtc::kDecoderCNGwb, FLAGS_cn_wb);
443 std::cerr << "Cannot register payload type " << FLAGS_cn_wb <<
444 " as " << CodecName(webrtc::kDecoderCNGwb).c_str() << std::endl;
447 error = neteq->RegisterPayloadType(webrtc::kDecoderCNGswb32kHz,
450 std::cerr << "Cannot register payload type " << FLAGS_cn_swb32 <<
451 " as " << CodecName(webrtc::kDecoderCNGswb32kHz).c_str() << std::endl;
454 error = neteq->RegisterPayloadType(webrtc::kDecoderCNGswb48kHz,
457 std::cerr << "Cannot register payload type " << FLAGS_cn_swb48 <<
458 " as " << CodecName(webrtc::kDecoderCNGswb48kHz).c_str() << std::endl;
463 void PrintCodecMapping() {
464 std::cout << CodecName(webrtc::kDecoderPCMu).c_str() << ": " << FLAGS_pcmu <<
466 std::cout << CodecName(webrtc::kDecoderPCMa).c_str() << ": " << FLAGS_pcma <<
468 std::cout << CodecName(webrtc::kDecoderILBC).c_str() << ": " << FLAGS_ilbc <<
470 std::cout << CodecName(webrtc::kDecoderISAC).c_str() << ": " << FLAGS_isac <<
472 std::cout << CodecName(webrtc::kDecoderISACswb).c_str() << ": " <<
473 FLAGS_isac_swb << std::endl;
474 std::cout << CodecName(webrtc::kDecoderPCM16B).c_str() << ": " <<
475 FLAGS_pcm16b << std::endl;
476 std::cout << CodecName(webrtc::kDecoderPCM16Bwb).c_str() << ": " <<
477 FLAGS_pcm16b_wb << std::endl;
478 std::cout << CodecName(webrtc::kDecoderPCM16Bswb32kHz).c_str() << ": " <<
479 FLAGS_pcm16b_swb32 << std::endl;
480 std::cout << CodecName(webrtc::kDecoderPCM16Bswb48kHz).c_str() << ": " <<
481 FLAGS_pcm16b_swb48 << std::endl;
482 std::cout << CodecName(webrtc::kDecoderG722).c_str() << ": " << FLAGS_g722 <<
484 std::cout << CodecName(webrtc::kDecoderAVT).c_str() << ": " << FLAGS_avt <<
486 std::cout << CodecName(webrtc::kDecoderRED).c_str() << ": " << FLAGS_red <<
488 std::cout << CodecName(webrtc::kDecoderCNGnb).c_str() << ": " <<
489 FLAGS_cn_nb << std::endl;
490 std::cout << CodecName(webrtc::kDecoderCNGwb).c_str() << ": " <<
491 FLAGS_cn_wb << std::endl;
492 std::cout << CodecName(webrtc::kDecoderCNGswb32kHz).c_str() << ": " <<
493 FLAGS_cn_swb32 << std::endl;
494 std::cout << CodecName(webrtc::kDecoderCNGswb48kHz).c_str() << ": " <<
495 FLAGS_cn_swb48 << std::endl;
498 size_t ReplacePayload(webrtc::test::InputAudioFile* replacement_audio_file,
499 webrtc::scoped_ptr<int16_t[]>* replacement_audio,
500 webrtc::scoped_ptr<uint8_t[]>* payload,
501 size_t* payload_mem_size_bytes,
502 size_t* frame_size_samples,
503 WebRtcRTPHeader* rtp_header,
504 NETEQTEST_RTPpacket* next_rtp) {
505 size_t payload_len = 0;
507 if (IsComfortNosie(rtp_header->header.payloadType)) {
508 // If CNG, simply insert a zero-energy one-byte payload.
509 if (*payload_mem_size_bytes < 1) {
510 (*payload).reset(new uint8_t[1]);
511 *payload_mem_size_bytes = 1;
513 (*payload)[0] = 127; // Max attenuation of CNG.
516 if (next_rtp->payloadLen() > 0) {
517 // Check if payload length has changed.
518 if (next_rtp->sequenceNumber() == rtp_header->header.sequenceNumber + 1) {
519 if (*frame_size_samples !=
520 next_rtp->timeStamp() - rtp_header->header.timestamp) {
521 *frame_size_samples =
522 next_rtp->timeStamp() - rtp_header->header.timestamp;
523 (*replacement_audio).reset(
524 new int16_t[*frame_size_samples]);
525 *payload_mem_size_bytes = 2 * *frame_size_samples;
526 (*payload).reset(new uint8_t[*payload_mem_size_bytes]);
531 assert((*replacement_audio).get());
532 if (CodecTimestampRate(rtp_header->header.payloadType) !=
533 CodecSampleRate(rtp_header->header.payloadType) ||
534 rtp_header->header.payloadType == FLAGS_red ||
535 rtp_header->header.payloadType == FLAGS_avt) {
536 // Some codecs have different sample and timestamp rates. And neither
537 // RED nor DTMF is supported for replacement.
538 std::cerr << "Codec not supported for audio replacement." <<
540 webrtc::Trace::ReturnTrace();
543 assert(*frame_size_samples > 0);
544 if (!replacement_audio_file->Read(*frame_size_samples,
545 (*replacement_audio).get())) {
546 std::cerr << "Could no read replacement audio file." << std::endl;
547 webrtc::Trace::ReturnTrace();
550 // Encode it as PCM16.
551 assert((*payload).get());
552 payload_len = WebRtcPcm16b_Encode((*replacement_audio).get(),
553 static_cast<int16_t>(*frame_size_samples),
555 assert(payload_len == 2 * *frame_size_samples);
556 // Change payload type to PCM16.
557 switch (CodecSampleRate(rtp_header->header.payloadType)) {
559 rtp_header->header.payloadType = FLAGS_pcm16b;
562 rtp_header->header.payloadType = FLAGS_pcm16b_wb;
565 rtp_header->header.payloadType = FLAGS_pcm16b_swb32;
568 rtp_header->header.payloadType = FLAGS_pcm16b_swb48;
571 std::cerr << "Payload type " <<
572 static_cast<int>(rtp_header->header.payloadType) <<
573 " not supported or unknown." << std::endl;
574 webrtc::Trace::ReturnTrace();
582 int CodecSampleRate(uint8_t payload_type) {
583 if (payload_type == FLAGS_pcmu ||
584 payload_type == FLAGS_pcma ||
585 payload_type == FLAGS_ilbc ||
586 payload_type == FLAGS_pcm16b ||
587 payload_type == FLAGS_cn_nb) {
589 } else if (payload_type == FLAGS_isac ||
590 payload_type == FLAGS_pcm16b_wb ||
591 payload_type == FLAGS_g722 ||
592 payload_type == FLAGS_cn_wb) {
594 } else if (payload_type == FLAGS_isac_swb ||
595 payload_type == FLAGS_pcm16b_swb32 ||
596 payload_type == FLAGS_cn_swb32) {
598 } else if (payload_type == FLAGS_pcm16b_swb48 ||
599 payload_type == FLAGS_cn_swb48) {
601 } else if (payload_type == FLAGS_avt ||
602 payload_type == FLAGS_red) {
609 int CodecTimestampRate(uint8_t payload_type) {
610 if (payload_type == FLAGS_g722) {
613 return CodecSampleRate(payload_type);
617 bool IsComfortNosie(uint8_t payload_type) {
618 if (payload_type == FLAGS_cn_nb ||
619 payload_type == FLAGS_cn_wb ||
620 payload_type == FLAGS_cn_swb32 ||
621 payload_type == FLAGS_cn_swb48) {