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

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: Rebase Created 5 years, 3 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 expected_codec_ts_(0xD87F3F9F), 140 expected_codec_ts_(0xD87F3F9F),
140 expected_in_ts_(0xD87F3F9F), 141 expected_in_ts_(0xD87F3F9F),
141 receiver_(config), 142 receiver_(config),
142 bitrate_logger_("WebRTC.Audio.TargetBitrateInKbps"), 143 bitrate_logger_("WebRTC.Audio.TargetBitrateInKbps"),
143 previous_pltype_(255), 144 previous_pltype_(255),
144 receiver_initialized_(false), 145 receiver_initialized_(false),
145 first_10ms_data_(false), 146 first_10ms_data_(false),
146 first_frame_(true), 147 first_frame_(true),
147 callback_crit_sect_(CriticalSectionWrapper::CreateCriticalSection()), 148 callback_crit_sect_(CriticalSectionWrapper::CreateCriticalSection()),
148 packetization_callback_(NULL), 149 packetization_callback_(NULL),
149 vad_callback_(NULL) { 150 vad_callback_(NULL),
151 event_log_(config.event_log) {
150 if (InitializeReceiverSafe() < 0) { 152 if (InitializeReceiverSafe() < 0) {
151 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_, 153 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
152 "Cannot initialize receiver"); 154 "Cannot initialize receiver");
153 } 155 }
154 WEBRTC_TRACE(webrtc::kTraceMemory, webrtc::kTraceAudioCoding, id_, "Created"); 156 WEBRTC_TRACE(webrtc::kTraceMemory, webrtc::kTraceAudioCoding, id_, "Created");
155 } 157 }
156 158
157 AudioCodingModuleImpl::~AudioCodingModuleImpl() = default; 159 AudioCodingModuleImpl::~AudioCodingModuleImpl() = default;
158 160
159 int32_t AudioCodingModuleImpl::Encode(const InputData& input_data) { 161 int32_t AudioCodingModuleImpl::Encode(const InputData& input_data) {
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 // Get 10 milliseconds of raw audio data to play out. 674 // Get 10 milliseconds of raw audio data to play out.
673 // Automatic resample to the requested frequency. 675 // Automatic resample to the requested frequency.
674 int AudioCodingModuleImpl::PlayoutData10Ms(int desired_freq_hz, 676 int AudioCodingModuleImpl::PlayoutData10Ms(int desired_freq_hz,
675 AudioFrame* audio_frame) { 677 AudioFrame* audio_frame) {
676 // GetAudio always returns 10 ms, at the requested sample rate. 678 // GetAudio always returns 10 ms, at the requested sample rate.
677 if (receiver_.GetAudio(desired_freq_hz, audio_frame) != 0) { 679 if (receiver_.GetAudio(desired_freq_hz, audio_frame) != 0) {
678 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_, 680 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
679 "PlayoutData failed, RecOut Failed"); 681 "PlayoutData failed, RecOut Failed");
680 return -1; 682 return -1;
681 } 683 }
684 {
685 if (event_log_)
686 event_log_->LogDebugEvent(RtcEventLog::DebugEvent::kAudioPlayout);
687 }
682 688
683 audio_frame->id_ = id_; 689 audio_frame->id_ = id_;
684 return 0; 690 return 0;
685 } 691 }
686 692
687 ///////////////////////////////////////// 693 /////////////////////////////////////////
688 // Statistics 694 // Statistics
689 // 695 //
690 696
691 // TODO(turajs) change the return value to void. Also change the corresponding 697 // TODO(turajs) change the return value to void. Also change the corresponding
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
1149 *channels = 1; 1155 *channels = 1;
1150 break; 1156 break;
1151 #endif 1157 #endif
1152 default: 1158 default:
1153 FATAL() << "Codec type " << codec_type << " not supported."; 1159 FATAL() << "Codec type " << codec_type << " not supported.";
1154 } 1160 }
1155 return true; 1161 return true;
1156 } 1162 }
1157 1163
1158 } // namespace webrtc 1164 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698