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

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

Issue 1178053002: Add UMA logging for target audio bitrate (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Fixing a problem that was revealed in tests, and silencing a few warnings Created 5 years, 6 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/rw_lock_wrapper.h" 27 #include "webrtc/system_wrappers/interface/rw_lock_wrapper.h"
27 #include "webrtc/system_wrappers/interface/trace.h" 28 #include "webrtc/system_wrappers/interface/trace.h"
28 #include "webrtc/typedefs.h" 29 #include "webrtc/typedefs.h"
29 30
30 namespace webrtc { 31 namespace webrtc {
31 32
32 namespace acm2 { 33 namespace acm2 {
33 34
34 enum { 35 enum {
35 kACMToneEnd = 999 36 kACMToneEnd = 999
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 // } 282 // }
282 // 283 //
283 // WebRtcACMCodecParams encoder_param; 284 // WebRtcACMCodecParams encoder_param;
284 // codec_manager_.current_encoder()->EncoderParams(&encoder_param); 285 // codec_manager_.current_encoder()->EncoderParams(&encoder_param);
285 // 286 //
286 // return encoder_param.codec_inst.rate; 287 // return encoder_param.codec_inst.rate;
287 } 288 }
288 289
289 void AudioCodingModuleImpl::SetBitRate(int bitrate_bps) { 290 void AudioCodingModuleImpl::SetBitRate(int bitrate_bps) {
290 CriticalSectionScoped lock(acm_crit_sect_); 291 CriticalSectionScoped lock(acm_crit_sect_);
291
292 if (codec_manager_.CurrentEncoder()) { 292 if (codec_manager_.CurrentEncoder()) {
293 codec_manager_.CurrentEncoder()->SetTargetBitrate(bitrate_bps); 293 codec_manager_.CurrentEncoder()->SetTargetBitrate(bitrate_bps);
294 RTC_HISTOGRAM_COUNTS_100(
295 HISTOGRAM_NAME_AUDIO_TARGET_BITRATE_IN_KBPS,
296 codec_manager_.CurrentEncoder()->GetTargetBitrate() / 1000);
294 } 297 }
295 } 298 }
296 299
297 // Set available bandwidth, inform the encoder about the estimated bandwidth 300 // Set available bandwidth, inform the encoder about the estimated bandwidth
298 // received from the remote party. 301 // received from the remote party.
299 // TODO(henrik.lundin): Remove; not used. 302 // TODO(henrik.lundin): Remove; not used.
300 int AudioCodingModuleImpl::SetReceivedEstimatedBandwidth(int bw) { 303 int AudioCodingModuleImpl::SetReceivedEstimatedBandwidth(int bw) {
301 CriticalSectionScoped lock(acm_crit_sect_); 304 CriticalSectionScoped lock(acm_crit_sect_);
302 FATAL() << "Dead code?"; 305 FATAL() << "Dead code?";
303 return -1; 306 return -1;
(...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after
1258 *channels = 1; 1261 *channels = 1;
1259 break; 1262 break;
1260 #endif 1263 #endif
1261 default: 1264 default:
1262 FATAL() << "Codec type " << codec_type << " not supported."; 1265 FATAL() << "Codec type " << codec_type << " not supported.";
1263 } 1266 }
1264 return true; 1267 return true;
1265 } 1268 }
1266 1269
1267 } // namespace webrtc 1270 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698