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

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

Issue 1267683002: Hooked up RtcEventLog. It lives in Voice Engine and pointers are propagated to ACM and Call. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Moved RtcEventLog from SharedData to ChannelManager. Created 5 years, 4 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
OLDNEW
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 "webrtc/modules/audio_coding/main/acm2/audio_coding_module_impl.h" 11 #include "webrtc/modules/audio_coding/main/acm2/audio_coding_module_impl.h"
12 12
13 #include <assert.h> 13 #include <assert.h>
14 #include <stdlib.h> 14 #include <stdlib.h>
15 #include <vector> 15 #include <vector>
16 16
17 #include "webrtc/base/checks.h" 17 #include "webrtc/base/checks.h"
18 #include "webrtc/base/safe_conversions.h" 18 #include "webrtc/base/safe_conversions.h"
19 #include "webrtc/engine_configurations.h" 19 #include "webrtc/engine_configurations.h"
20 #include "webrtc/modules/audio_coding/main/interface/audio_coding_module_typedef s.h" 20 #include "webrtc/modules/audio_coding/main/interface/audio_coding_module_typedef s.h"
21 #include "webrtc/modules/audio_coding/main/acm2/acm_common_defs.h" 21 #include "webrtc/modules/audio_coding/main/acm2/acm_common_defs.h"
22 #include "webrtc/modules/audio_coding/main/acm2/acm_resampler.h" 22 #include "webrtc/modules/audio_coding/main/acm2/acm_resampler.h"
23 #include "webrtc/modules/audio_coding/main/acm2/call_statistics.h" 23 #include "webrtc/modules/audio_coding/main/acm2/call_statistics.h"
24 #include "webrtc/system_wrappers/interface/critical_section_wrapper.h" 24 #include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
25 #include "webrtc/system_wrappers/interface/logging.h" 25 #include "webrtc/system_wrappers/interface/logging.h"
26 #include "webrtc/system_wrappers/interface/metrics.h" 26 #include "webrtc/system_wrappers/interface/metrics.h"
27 #include "webrtc/system_wrappers/interface/rw_lock_wrapper.h" 27 #include "webrtc/system_wrappers/interface/rw_lock_wrapper.h"
28 #include "webrtc/system_wrappers/interface/trace.h" 28 #include "webrtc/system_wrappers/interface/trace.h"
29 #include "webrtc/typedefs.h" 29 #include "webrtc/typedefs.h"
30 #include "webrtc/video/rtc_event_log.h"
30 31
31 namespace webrtc { 32 namespace webrtc {
32 33
33 namespace acm2 { 34 namespace acm2 {
34 35
35 enum { 36 enum {
36 kACMToneEnd = 999 37 kACMToneEnd = 999
37 }; 38 };
38 39
39 // Maximum number of bytes in one packet (PCM16B, 20 ms packets, stereo). 40 // Maximum number of bytes in one packet (PCM16B, 20 ms packets, stereo).
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 expected_in_ts_(0xD87F3F9F), 139 expected_in_ts_(0xD87F3F9F),
139 receiver_(config), 140 receiver_(config),
140 bitrate_logger_("WebRTC.Audio.TargetBitrateInKbps"), 141 bitrate_logger_("WebRTC.Audio.TargetBitrateInKbps"),
141 previous_pltype_(255), 142 previous_pltype_(255),
142 aux_rtp_header_(NULL), 143 aux_rtp_header_(NULL),
143 receiver_initialized_(false), 144 receiver_initialized_(false),
144 first_10ms_data_(false), 145 first_10ms_data_(false),
145 first_frame_(true), 146 first_frame_(true),
146 callback_crit_sect_(CriticalSectionWrapper::CreateCriticalSection()), 147 callback_crit_sect_(CriticalSectionWrapper::CreateCriticalSection()),
147 packetization_callback_(NULL), 148 packetization_callback_(NULL),
148 vad_callback_(NULL) { 149 vad_callback_(NULL),
150 event_log_(config.event_log) {
149 if (InitializeReceiverSafe() < 0) { 151 if (InitializeReceiverSafe() < 0) {
150 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_, 152 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
151 "Cannot initialize receiver"); 153 "Cannot initialize receiver");
152 } 154 }
153 WEBRTC_TRACE(webrtc::kTraceMemory, webrtc::kTraceAudioCoding, id_, "Created"); 155 WEBRTC_TRACE(webrtc::kTraceMemory, webrtc::kTraceAudioCoding, id_, "Created");
154 } 156 }
155 157
156 AudioCodingModuleImpl::~AudioCodingModuleImpl() { 158 AudioCodingModuleImpl::~AudioCodingModuleImpl() {
157 if (aux_rtp_header_ != NULL) { 159 if (aux_rtp_header_ != NULL) {
158 delete aux_rtp_header_; 160 delete aux_rtp_header_;
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 // Get 10 milliseconds of raw audio data to play out. 731 // Get 10 milliseconds of raw audio data to play out.
730 // Automatic resample to the requested frequency. 732 // Automatic resample to the requested frequency.
731 int AudioCodingModuleImpl::PlayoutData10Ms(int desired_freq_hz, 733 int AudioCodingModuleImpl::PlayoutData10Ms(int desired_freq_hz,
732 AudioFrame* audio_frame) { 734 AudioFrame* audio_frame) {
733 // GetAudio always returns 10 ms, at the requested sample rate. 735 // GetAudio always returns 10 ms, at the requested sample rate.
734 if (receiver_.GetAudio(desired_freq_hz, audio_frame) != 0) { 736 if (receiver_.GetAudio(desired_freq_hz, audio_frame) != 0) {
735 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_, 737 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
736 "PlayoutData failed, RecOut Failed"); 738 "PlayoutData failed, RecOut Failed");
737 return -1; 739 return -1;
738 } 740 }
741 {
742 if (event_log_)
743 event_log_->LogDebugEvent(RtcEventLog::DebugEvent::kAudioPlayout);
744 }
739 745
740 audio_frame->id_ = id_; 746 audio_frame->id_ = id_;
741 return 0; 747 return 0;
742 } 748 }
743 749
744 ///////////////////////////////////////// 750 /////////////////////////////////////////
745 // Statistics 751 // Statistics
746 // 752 //
747 753
748 // TODO(turajs) change the return value to void. Also change the corresponding 754 // TODO(turajs) change the return value to void. Also change the corresponding
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
1273 *channels = 1; 1279 *channels = 1;
1274 break; 1280 break;
1275 #endif 1281 #endif
1276 default: 1282 default:
1277 FATAL() << "Codec type " << codec_type << " not supported."; 1283 FATAL() << "Codec type " << codec_type << " not supported.";
1278 } 1284 }
1279 return true; 1285 return true;
1280 } 1286 }
1281 1287
1282 } // namespace webrtc 1288 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698