OLD | NEW |
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/codec_manager.h" | 11 #include "webrtc/modules/audio_coding/main/acm2/codec_manager.h" |
12 | 12 |
13 #include "webrtc/base/checks.h" | 13 #include "webrtc/base/checks.h" |
14 #include "webrtc/engine_configurations.h" | 14 #include "webrtc/engine_configurations.h" |
15 #include "webrtc/modules/audio_coding/main/acm2/acm_codec_database.h" | 15 #include "webrtc/modules/audio_coding/main/acm2/acm_codec_database.h" |
| 16 #include "webrtc/modules/audio_coding/main/acm2/acm_common_defs.h" |
| 17 #include "webrtc/system_wrappers/interface/metrics.h" |
16 #include "webrtc/system_wrappers/interface/trace.h" | 18 #include "webrtc/system_wrappers/interface/trace.h" |
17 | 19 |
18 namespace webrtc { | 20 namespace webrtc { |
19 namespace acm2 { | 21 namespace acm2 { |
20 | 22 |
21 namespace { | 23 namespace { |
22 bool IsCodecRED(const CodecInst& codec) { | 24 bool IsCodecRED(const CodecInst& codec) { |
23 return (STR_CASE_CMP(codec.plname, "RED") == 0); | 25 return (STR_CASE_CMP(codec.plname, "RED") == 0); |
24 } | 26 } |
25 | 27 |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 DCHECK(codec_owner_.Encoder()); | 307 DCHECK(codec_owner_.Encoder()); |
306 } | 308 } |
307 send_codec_inst_.plfreq = send_codec.plfreq; | 309 send_codec_inst_.plfreq = send_codec.plfreq; |
308 send_codec_inst_.pacsize = send_codec.pacsize; | 310 send_codec_inst_.pacsize = send_codec.pacsize; |
309 send_codec_inst_.channels = send_codec.channels; | 311 send_codec_inst_.channels = send_codec.channels; |
310 send_codec_inst_.pltype = send_codec.pltype; | 312 send_codec_inst_.pltype = send_codec.pltype; |
311 | 313 |
312 // Check if a change in Rate is required. | 314 // Check if a change in Rate is required. |
313 if (send_codec.rate != send_codec_inst_.rate) { | 315 if (send_codec.rate != send_codec_inst_.rate) { |
314 codec_owner_.SpeechEncoder()->SetTargetBitrate(send_codec.rate); | 316 codec_owner_.SpeechEncoder()->SetTargetBitrate(send_codec.rate); |
| 317 RTC_HISTOGRAM_COUNTS_100( |
| 318 HISTOGRAM_NAME_AUDIO_TARGET_BITRATE_IN_KBPS, |
| 319 codec_owner_.SpeechEncoder()->GetTargetBitrate() / 1000); |
315 send_codec_inst_.rate = send_codec.rate; | 320 send_codec_inst_.rate = send_codec.rate; |
316 } | 321 } |
317 | 322 |
318 codec_fec_enabled_ = codec_fec_enabled_ && | 323 codec_fec_enabled_ = codec_fec_enabled_ && |
319 codec_owner_.SpeechEncoder()->SetFec(codec_fec_enabled_); | 324 codec_owner_.SpeechEncoder()->SetFec(codec_fec_enabled_); |
320 | 325 |
321 return 0; | 326 return 0; |
322 } | 327 } |
323 | 328 |
324 void CodecManager::RegisterEncoder( | 329 void CodecManager::RegisterEncoder( |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 case 48000: | 470 case 48000: |
466 return -1; | 471 return -1; |
467 default: | 472 default: |
468 FATAL() << sample_rate_hz << " Hz is not supported"; | 473 FATAL() << sample_rate_hz << " Hz is not supported"; |
469 return -1; | 474 return -1; |
470 } | 475 } |
471 } | 476 } |
472 | 477 |
473 } // namespace acm2 | 478 } // namespace acm2 |
474 } // namespace webrtc | 479 } // namespace webrtc |
OLD | NEW |