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