Chromium Code Reviews| Index: webrtc/modules/audio_coding/neteq/tools/neteq_rtpplay.cc |
| diff --git a/webrtc/modules/audio_coding/neteq/tools/neteq_rtpplay.cc b/webrtc/modules/audio_coding/neteq/tools/neteq_rtpplay.cc |
| index 9e3119b246826988c8d578757e43029c5d252a70..ff4b68bfb5ca4d0cb49207e039ef75395e434bbe 100644 |
| --- a/webrtc/modules/audio_coding/neteq/tools/neteq_rtpplay.cc |
| +++ b/webrtc/modules/audio_coding/neteq/tools/neteq_rtpplay.cc |
| @@ -74,6 +74,13 @@ bool ValidateSsrcValue(const char* flagname, const std::string& str) { |
| return ParseSsrc(str, &dummy_ssrc); |
| } |
| +static bool ValidateExtensionId(const char* flagname, int32_t value) { |
| + if (value > 0 && value <= 255) // Value is ok. |
| + return true; |
| + printf("Invalid value for --%s: %d\n", flagname, static_cast<int>(value)); |
|
ivoc
2016/08/24 15:06:07
The style guide says we should prefer cout over pr
hlundin-webrtc
2016/08/24 15:26:46
I'd rather keep the printf for consistency with th
|
| + return false; |
| +} |
| + |
| // Define command line flags. |
| DEFINE_int32(pcmu, 0, "RTP payload type for PCM-u"); |
| const bool pcmu_dummy = |
| @@ -136,6 +143,12 @@ DEFINE_string(ssrc, |
| "starting with 0x)"); |
| const bool hex_ssrc_dummy = |
| google::RegisterFlagValidator(&FLAGS_ssrc, &ValidateSsrcValue); |
| +DEFINE_int32(audio_level, 1, "Extension ID for audio level (RFC 6464)"); |
| +const bool audio_level_dummy = |
| + google::RegisterFlagValidator(&FLAGS_audio_level, &ValidateExtensionId); |
| +DEFINE_int32(abs_send_time, 3, "Extension ID for absolute sender time"); |
| +const bool abs_send_time_dummy = |
| + google::RegisterFlagValidator(&FLAGS_abs_send_time, &ValidateExtensionId); |
| // Maps a codec type to a printable name string. |
| std::string CodecName(NetEqDecoder codec) { |
| @@ -297,13 +310,18 @@ int RunTest(int argc, char* argv[]) { |
| return 0; |
| } |
| + // Gather RTP header extensions in a map. |
| + NetEqPacketSourceInput::RtpHeaderExtensionMap rtp_ext_map = { |
| + {FLAGS_audio_level, kRtpExtensionAudioLevel}, |
| + {FLAGS_abs_send_time, kRtpExtensionAbsoluteSendTime}}; |
| + |
| const std::string input_file_name = argv[1]; |
| std::unique_ptr<NetEqInput> input; |
| if (RtpFileSource::ValidRtpDump(input_file_name) || |
| RtpFileSource::ValidPcap(input_file_name)) { |
| - input.reset(new NetEqRtpDumpInput(input_file_name)); |
| + input.reset(new NetEqRtpDumpInput(input_file_name, rtp_ext_map)); |
| } else { |
| - input.reset(new NetEqEventLogInput(input_file_name)); |
| + input.reset(new NetEqEventLogInput(input_file_name, rtp_ext_map)); |
| } |
| std::cout << "Input file: " << input_file_name << std::endl; |