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 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 | 47 |
48 int SetCodecFEC(bool enable_codec_fec); | 48 int SetCodecFEC(bool enable_codec_fec); |
49 | 49 |
50 // Returns a pointer to AudioDecoder of the given codec. For iSAC, encoding | 50 // Returns a pointer to AudioDecoder of the given codec. For iSAC, encoding |
51 // and decoding have to be performed on a shared codec instance. By calling | 51 // and decoding have to be performed on a shared codec instance. By calling |
52 // this method, we get the codec instance that ACM owns. | 52 // this method, we get the codec instance that ACM owns. |
53 // If |codec| does not share an instance between encoder and decoder, returns | 53 // If |codec| does not share an instance between encoder and decoder, returns |
54 // null. | 54 // null. |
55 AudioDecoder* GetAudioDecoder(const CodecInst& codec); | 55 AudioDecoder* GetAudioDecoder(const CodecInst& codec); |
56 | 56 |
57 bool red_enabled() const { return red_enabled_; } | 57 bool red_enabled() const { return codec_stack_params_.use_red; } |
58 | 58 |
59 bool codec_fec_enabled() const { return codec_fec_enabled_; } | 59 bool codec_fec_enabled() const { return codec_stack_params_.use_codec_fec; } |
60 | 60 |
61 AudioEncoder* CurrentEncoder() { return rent_a_codec_.GetEncoderStack(); } | 61 AudioEncoder* CurrentEncoder() { return rent_a_codec_.GetEncoderStack(); } |
62 const AudioEncoder* CurrentEncoder() const { | 62 const AudioEncoder* CurrentEncoder() const { |
63 return rent_a_codec_.GetEncoderStack(); | 63 return rent_a_codec_.GetEncoderStack(); |
64 } | 64 } |
65 | 65 |
66 bool CurrentEncoderIsOpus() const { return encoder_is_opus_; } | 66 bool CurrentEncoderIsOpus() const { return encoder_is_opus_; } |
67 | 67 |
68 private: | 68 private: |
69 int CngPayloadType(int sample_rate_hz) const; | |
70 int RedPayloadType(int sample_rate_hz) const; | |
71 void RentEncoderStack(AudioEncoder* speech_encoder, int sample_rate_hz); | |
72 | |
73 rtc::ThreadChecker thread_checker_; | 69 rtc::ThreadChecker thread_checker_; |
74 bool dtx_enabled_; | |
75 ACMVADMode vad_mode_; | |
76 CodecInst send_codec_inst_; | 70 CodecInst send_codec_inst_; |
77 bool red_enabled_; | |
78 bool codec_fec_enabled_; | |
79 RentACodec rent_a_codec_; | 71 RentACodec rent_a_codec_; |
80 | 72 RentACodec::StackParameters codec_stack_params_; |
81 // Maps from RTP timestamp rate (in Hz) to payload type. | |
82 std::map<int, int> cng_payload_types_; | |
83 std::map<int, int> red_payload_types_; | |
84 | 73 |
85 bool encoder_is_opus_; | 74 bool encoder_is_opus_; |
86 | 75 |
87 RTC_DISALLOW_COPY_AND_ASSIGN(CodecManager); | 76 RTC_DISALLOW_COPY_AND_ASSIGN(CodecManager); |
88 }; | 77 }; |
89 | 78 |
90 } // namespace acm2 | 79 } // namespace acm2 |
91 } // namespace webrtc | 80 } // namespace webrtc |
92 #endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_CODEC_MANAGER_H_ | 81 #endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_CODEC_MANAGER_H_ |
OLD | NEW |