Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(496)

Side by Side Diff: webrtc/modules/audio_coding/main/acm2/acm_dump.cc

Issue 1219333003: Targets should not depend on protobuf when enable_protobuf=0. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Do not define AcmDump::ParseAcmDump Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | webrtc/modules/audio_coding/main/acm2/audio_coding_module.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/audio_coding/main/acm2/audio_coding_module.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698