OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2012 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 |
11 #include <assert.h> | 11 #include <assert.h> |
12 #include <stdio.h> | 12 #include <stdio.h> |
| 13 |
| 14 #include <memory> |
13 #include <vector> | 15 #include <vector> |
14 | 16 |
15 #include "gflags/gflags.h" | 17 #include "gflags/gflags.h" |
16 #include "webrtc/base/scoped_ptr.h" | |
17 #include "webrtc/modules/audio_coding/neteq/tools/packet.h" | 18 #include "webrtc/modules/audio_coding/neteq/tools/packet.h" |
18 #include "webrtc/modules/audio_coding/neteq/tools/rtp_file_source.h" | 19 #include "webrtc/modules/audio_coding/neteq/tools/rtp_file_source.h" |
19 | 20 |
20 // Flag validator. | 21 // Flag validator. |
21 static bool ValidatePayloadType(const char* flagname, int32_t value) { | 22 static bool ValidatePayloadType(const char* flagname, int32_t value) { |
22 if (value >= 0 && value <= 127) // Value is ok. | 23 if (value >= 0 && value <= 127) // Value is ok. |
23 return true; | 24 return true; |
24 printf("Invalid value for --%s: %d\n", flagname, static_cast<int>(value)); | 25 printf("Invalid value for --%s: %d\n", flagname, static_cast<int>(value)); |
25 return false; | 26 return false; |
26 } | 27 } |
(...skipping 29 matching lines...) Expand all Loading... |
56 google::SetUsageMessage(usage); | 57 google::SetUsageMessage(usage); |
57 google::ParseCommandLineFlags(&argc, &argv, true); | 58 google::ParseCommandLineFlags(&argc, &argv, true); |
58 | 59 |
59 if (argc != 2 && argc != 3) { | 60 if (argc != 2 && argc != 3) { |
60 // Print usage information. | 61 // Print usage information. |
61 printf("%s", google::ProgramUsage()); | 62 printf("%s", google::ProgramUsage()); |
62 return 0; | 63 return 0; |
63 } | 64 } |
64 | 65 |
65 printf("Input file: %s\n", argv[1]); | 66 printf("Input file: %s\n", argv[1]); |
66 rtc::scoped_ptr<webrtc::test::RtpFileSource> file_source( | 67 std::unique_ptr<webrtc::test::RtpFileSource> file_source( |
67 webrtc::test::RtpFileSource::Create(argv[1])); | 68 webrtc::test::RtpFileSource::Create(argv[1])); |
68 assert(file_source.get()); | 69 assert(file_source.get()); |
69 // Set RTP extension IDs. | 70 // Set RTP extension IDs. |
70 bool print_audio_level = false; | 71 bool print_audio_level = false; |
71 if (!google::GetCommandLineFlagInfoOrDie("audio_level").is_default) { | 72 if (!google::GetCommandLineFlagInfoOrDie("audio_level").is_default) { |
72 print_audio_level = true; | 73 print_audio_level = true; |
73 file_source->RegisterRtpHeaderExtension(webrtc::kRtpExtensionAudioLevel, | 74 file_source->RegisterRtpHeaderExtension(webrtc::kRtpExtensionAudioLevel, |
74 FLAGS_audio_level); | 75 FLAGS_audio_level); |
75 } | 76 } |
76 bool print_abs_send_time = false; | 77 bool print_abs_send_time = false; |
(...skipping 20 matching lines...) Expand all Loading... |
97 if (print_audio_level) { | 98 if (print_audio_level) { |
98 fprintf(out_file, " AuLvl (V)"); | 99 fprintf(out_file, " AuLvl (V)"); |
99 } | 100 } |
100 if (print_abs_send_time) { | 101 if (print_abs_send_time) { |
101 fprintf(out_file, " AbsSendTime"); | 102 fprintf(out_file, " AbsSendTime"); |
102 } | 103 } |
103 fprintf(out_file, "\n"); | 104 fprintf(out_file, "\n"); |
104 | 105 |
105 uint32_t max_abs_send_time = 0; | 106 uint32_t max_abs_send_time = 0; |
106 int cycles = -1; | 107 int cycles = -1; |
107 rtc::scoped_ptr<webrtc::test::Packet> packet; | 108 std::unique_ptr<webrtc::test::Packet> packet; |
108 while (true) { | 109 while (true) { |
109 packet.reset(file_source->NextPacket()); | 110 packet.reset(file_source->NextPacket()); |
110 if (!packet.get()) { | 111 if (!packet.get()) { |
111 // End of file reached. | 112 // End of file reached. |
112 break; | 113 break; |
113 } | 114 } |
114 // Write packet data to file. Use virtual_packet_length_bytes so that the | 115 // Write packet data to file. Use virtual_packet_length_bytes so that the |
115 // correct packet sizes are printed also for RTP header-only dumps. | 116 // correct packet sizes are printed also for RTP header-only dumps. |
116 fprintf(out_file, | 117 fprintf(out_file, |
117 "%5u %10u %10u %5i %5i %2i %#08X", | 118 "%5u %10u %10u %5i %5i %2i %#08X", |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 red_headers.pop_front(); | 175 red_headers.pop_front(); |
175 delete red; | 176 delete red; |
176 } | 177 } |
177 } | 178 } |
178 } | 179 } |
179 | 180 |
180 fclose(out_file); | 181 fclose(out_file); |
181 | 182 |
182 return 0; | 183 return 0; |
183 } | 184 } |
OLD | NEW |