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

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: Addressed Henrik's review comments. 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_crit_sect_(CriticalSectionWrapper::CreateCriticalSection()),
151 event_log_(nullptr) {
149 if (InitializeReceiverSafe() < 0) { 152 if (InitializeReceiverSafe() < 0) {
150 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_, 153 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
151 "Cannot initialize receiver"); 154 "Cannot initialize receiver");
152 } 155 }
153 WEBRTC_TRACE(webrtc::kTraceMemory, webrtc::kTraceAudioCoding, id_, "Created"); 156 WEBRTC_TRACE(webrtc::kTraceMemory, webrtc::kTraceAudioCoding, id_, "Created");
154 } 157 }
155 158
156 AudioCodingModuleImpl::~AudioCodingModuleImpl() { 159 AudioCodingModuleImpl::~AudioCodingModuleImpl() {
157 if (aux_rtp_header_ != NULL) { 160 if (aux_rtp_header_ != NULL) {
158 delete aux_rtp_header_; 161 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. 732 // Get 10 milliseconds of raw audio data to play out.
730 // Automatic resample to the requested frequency. 733 // Automatic resample to the requested frequency.
731 int AudioCodingModuleImpl::PlayoutData10Ms(int desired_freq_hz, 734 int AudioCodingModuleImpl::PlayoutData10Ms(int desired_freq_hz,
732 AudioFrame* audio_frame) { 735 AudioFrame* audio_frame) {
733 // GetAudio always returns 10 ms, at the requested sample rate. 736 // GetAudio always returns 10 ms, at the requested sample rate.
734 if (receiver_.GetAudio(desired_freq_hz, audio_frame) != 0) { 737 if (receiver_.GetAudio(desired_freq_hz, audio_frame) != 0) {
735 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_, 738 WEBRTC_TRACE(webrtc::kTraceError, webrtc::kTraceAudioCoding, id_,
736 "PlayoutData failed, RecOut Failed"); 739 "PlayoutData failed, RecOut Failed");
737 return -1; 740 return -1;
738 } 741 }
742 {
743 CriticalSectionScoped lock(event_log_crit_sect_);
744 if (event_log_)
745 event_log_->LogDebugEvent(RtcEventLog::DebugEvent::kAudioPlayout);
746 }
739 747
740 audio_frame->id_ = id_; 748 audio_frame->id_ = id_;
741 return 0; 749 return 0;
742 } 750 }
743 751
744 ///////////////////////////////////////// 752 /////////////////////////////////////////
745 // Statistics 753 // Statistics
746 // 754 //
747 755
748 // TODO(turajs) change the return value to void. Also change the corresponding 756 // TODO(turajs) change the return value to void. Also change the corresponding
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
964 } 972 }
965 973
966 int AudioCodingModuleImpl::EnableNack(size_t max_nack_list_size) { 974 int AudioCodingModuleImpl::EnableNack(size_t max_nack_list_size) {
967 return receiver_.EnableNack(max_nack_list_size); 975 return receiver_.EnableNack(max_nack_list_size);
968 } 976 }
969 977
970 void AudioCodingModuleImpl::DisableNack() { 978 void AudioCodingModuleImpl::DisableNack() {
971 receiver_.DisableNack(); 979 receiver_.DisableNack();
972 } 980 }
973 981
982 void AudioCodingModuleImpl::SetEventLog(RtcEventLog* event_log) {
983 CriticalSectionScoped lock(event_log_crit_sect_);
984 event_log_ = event_log;
985 }
986
974 std::vector<uint16_t> AudioCodingModuleImpl::GetNackList( 987 std::vector<uint16_t> AudioCodingModuleImpl::GetNackList(
975 int64_t round_trip_time_ms) const { 988 int64_t round_trip_time_ms) const {
976 return receiver_.GetNackList(round_trip_time_ms); 989 return receiver_.GetNackList(round_trip_time_ms);
977 } 990 }
978 991
979 int AudioCodingModuleImpl::LeastRequiredDelayMs() const { 992 int AudioCodingModuleImpl::LeastRequiredDelayMs() const {
980 return receiver_.LeastRequiredDelayMs(); 993 return receiver_.LeastRequiredDelayMs();
981 } 994 }
982 995
983 void AudioCodingModuleImpl::GetDecodingCallStatistics( 996 void AudioCodingModuleImpl::GetDecodingCallStatistics(
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
1273 *channels = 1; 1286 *channels = 1;
1274 break; 1287 break;
1275 #endif 1288 #endif
1276 default: 1289 default:
1277 FATAL() << "Codec type " << codec_type << " not supported."; 1290 FATAL() << "Codec type " << codec_type << " not supported.";
1278 } 1291 }
1279 return true; 1292 return true;
1280 } 1293 }
1281 1294
1282 } // namespace webrtc 1295 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698