OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2015 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 "webrtc/modules/audio_coding/main/acm2/acm_dump.h" | 11 #include "webrtc/modules/audio_coding/main/acm2/acm_dump.h" |
12 | 12 |
13 #include <deque> | 13 #include <deque> |
14 | 14 |
15 #include "webrtc/base/checks.h" | 15 #include "webrtc/base/checks.h" |
16 #include "webrtc/base/thread_annotations.h" | 16 #include "webrtc/base/thread_annotations.h" |
17 #include "webrtc/system_wrappers/interface/clock.h" | 17 #include "webrtc/system_wrappers/interface/clock.h" |
18 #include "webrtc/system_wrappers/interface/critical_section_wrapper.h" | 18 #include "webrtc/system_wrappers/interface/critical_section_wrapper.h" |
19 #include "webrtc/system_wrappers/interface/file_wrapper.h" | 19 #include "webrtc/system_wrappers/interface/file_wrapper.h" |
20 | 20 |
21 #ifdef RTC_AUDIOCODING_DEBUG_DUMP | |
21 // Files generated at build-time by the protobuf compiler. | 22 // Files generated at build-time by the protobuf compiler. |
22 #ifdef WEBRTC_ANDROID_PLATFORM_BUILD | 23 #ifdef WEBRTC_ANDROID_PLATFORM_BUILD |
23 #include "external/webrtc/webrtc/modules/audio_coding/dump.pb.h" | 24 #include "external/webrtc/webrtc/modules/audio_coding/dump.pb.h" |
24 #else | 25 #else |
25 #include "webrtc/audio_coding/dump.pb.h" | 26 #include "webrtc/audio_coding/dump.pb.h" |
26 #endif | 27 #endif |
28 #endif | |
27 | 29 |
28 namespace webrtc { | 30 namespace webrtc { |
29 | 31 |
30 // Noop implementation if flag is not set | 32 // Noop implementation if flag is not set |
31 #ifndef RTC_AUDIOCODING_DEBUG_DUMP | 33 #ifndef RTC_AUDIOCODING_DEBUG_DUMP |
32 class AcmDumpImpl final : public AcmDump { | 34 class AcmDumpImpl final : public AcmDump { |
33 public: | 35 public: |
34 void StartLogging(const std::string& file_name, int duration_ms) override{}; | 36 void StartLogging(const std::string& file_name, int duration_ms) override{}; |
35 void LogRtpPacket(bool incoming, | 37 void LogRtpPacket(bool incoming, |
36 const uint8_t* packet, | 38 const uint8_t* packet, |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
206 } | 208 } |
207 | 209 |
208 void AcmDumpImpl::AddRecentEvent(const ACMDumpEvent& event) { | 210 void AcmDumpImpl::AddRecentEvent(const ACMDumpEvent& event) { |
209 recent_log_events_.push_back(event); | 211 recent_log_events_.push_back(event); |
210 while (recent_log_events_.front().timestamp_us() < | 212 while (recent_log_events_.front().timestamp_us() < |
211 event.timestamp_us() - recent_log_duration_us) { | 213 event.timestamp_us() - recent_log_duration_us) { |
212 recent_log_events_.pop_front(); | 214 recent_log_events_.pop_front(); |
213 } | 215 } |
214 } | 216 } |
215 | 217 |
216 #endif // RTC_AUDIOCODING_DEBUG_DUMP | |
217 | |
218 // AcmDump member functions. | |
219 rtc::scoped_ptr<AcmDump> AcmDump::Create() { | |
220 return rtc::scoped_ptr<AcmDump>(new AcmDumpImpl()); | |
221 } | |
222 | |
223 bool AcmDump::ParseAcmDump(const std::string& file_name, | 218 bool AcmDump::ParseAcmDump(const std::string& file_name, |
hlundin-webrtc
2015/07/03 15:13:26
AcmDump::ParseAcmDump() no longer has an implement
| |
224 ACMDumpEventStream* result) { | 219 ACMDumpEventStream* result) { |
225 char tmp_buffer[1024]; | 220 char tmp_buffer[1024]; |
226 int bytes_read = 0; | 221 int bytes_read = 0; |
227 rtc::scoped_ptr<FileWrapper> dump_file(FileWrapper::Create()); | 222 rtc::scoped_ptr<FileWrapper> dump_file(FileWrapper::Create()); |
228 if (dump_file->OpenFile(file_name.c_str(), true) != 0) { | 223 if (dump_file->OpenFile(file_name.c_str(), true) != 0) { |
229 return false; | 224 return false; |
230 } | 225 } |
231 std::string dump_buffer; | 226 std::string dump_buffer; |
232 while ((bytes_read = dump_file->Read(tmp_buffer, sizeof(tmp_buffer))) > 0) { | 227 while ((bytes_read = dump_file->Read(tmp_buffer, sizeof(tmp_buffer))) > 0) { |
233 dump_buffer.append(tmp_buffer, bytes_read); | 228 dump_buffer.append(tmp_buffer, bytes_read); |
234 } | 229 } |
235 dump_file->CloseFile(); | 230 dump_file->CloseFile(); |
236 return result->ParseFromString(dump_buffer); | 231 return result->ParseFromString(dump_buffer); |
237 } | 232 } |
238 | 233 |
234 #endif // RTC_AUDIOCODING_DEBUG_DUMP | |
235 | |
236 // AcmDump member functions. | |
237 rtc::scoped_ptr<AcmDump> AcmDump::Create() { | |
238 return rtc::scoped_ptr<AcmDump>(new AcmDumpImpl()); | |
239 } | |
239 } // namespace webrtc | 240 } // namespace webrtc |
OLD | NEW |