| 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 #ifndef WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_CODEC_OWNER_H_ | 11 #ifndef WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_CODEC_OWNER_H_ |
| 12 #define WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_CODEC_OWNER_H_ | 12 #define WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_CODEC_OWNER_H_ |
| 13 | 13 |
| 14 #include "webrtc/base/constructormagic.h" | 14 #include "webrtc/base/constructormagic.h" |
| 15 #include "webrtc/base/scoped_ptr.h" | 15 #include "webrtc/base/scoped_ptr.h" |
| 16 #include "webrtc/common_types.h" | 16 #include "webrtc/common_types.h" |
| 17 #include "webrtc/modules/audio_coding/codecs/audio_encoder.h" | 17 #include "webrtc/modules/audio_coding/codecs/audio_encoder.h" |
| 18 #include "webrtc/modules/audio_coding/codecs/audio_decoder.h" | 18 #include "webrtc/modules/audio_coding/codecs/audio_decoder.h" |
| 19 #include "webrtc/modules/audio_coding/main/acm2/rent_a_codec.h" | |
| 20 #include "webrtc/modules/audio_coding/main/include/audio_coding_module_typedefs.
h" | 19 #include "webrtc/modules/audio_coding/main/include/audio_coding_module_typedefs.
h" |
| 21 | 20 |
| 22 namespace webrtc { | 21 namespace webrtc { |
| 23 namespace acm2 { | 22 namespace acm2 { |
| 24 | 23 |
| 25 class CodecOwner { | 24 class CodecOwner { |
| 26 public: | 25 public: |
| 27 CodecOwner(); | 26 CodecOwner(); |
| 28 ~CodecOwner(); | 27 ~CodecOwner(); |
| 29 | 28 |
| 30 // Start using the specified encoder. Returns false on error. | |
| 31 // TODO(kwiberg): Don't handle errors here (bug 5033) | |
| 32 bool SetEncoders(const CodecInst& speech_inst, | |
| 33 int cng_payload_type, | |
| 34 ACMVADMode vad_mode, | |
| 35 int red_payload_type) WARN_UNUSED_RESULT; | |
| 36 | |
| 37 void SetEncoders(AudioEncoder* external_speech_encoder, | 29 void SetEncoders(AudioEncoder* external_speech_encoder, |
| 38 int cng_payload_type, | 30 int cng_payload_type, |
| 39 ACMVADMode vad_mode, | 31 ACMVADMode vad_mode, |
| 40 int red_payload_type); | 32 int red_payload_type); |
| 41 | 33 |
| 42 void ChangeCngAndRed(int cng_payload_type, | 34 void ChangeCngAndRed(int cng_payload_type, |
| 43 ACMVADMode vad_mode, | 35 ACMVADMode vad_mode, |
| 44 int red_payload_type); | 36 int red_payload_type); |
| 45 | 37 |
| 46 // Returns a pointer to an iSAC decoder owned by the CodecOwner. The decoder | |
| 47 // will live as long as the CodecOwner exists. | |
| 48 AudioDecoder* GetIsacDecoder(); | |
| 49 | |
| 50 AudioEncoder* Encoder(); | 38 AudioEncoder* Encoder(); |
| 51 const AudioEncoder* Encoder() const; | 39 const AudioEncoder* Encoder() const; |
| 52 | 40 |
| 53 private: | 41 private: |
| 54 AudioEncoder* speech_encoder_; | 42 AudioEncoder* speech_encoder_; |
| 55 | 43 |
| 56 // |cng_encoder_| and |red_encoder_| are valid iff CNG or RED, respectively, | 44 // |cng_encoder_| and |red_encoder_| are valid iff CNG or RED, respectively, |
| 57 // are active. | 45 // are active. |
| 58 rtc::scoped_ptr<AudioEncoder> cng_encoder_; | 46 rtc::scoped_ptr<AudioEncoder> cng_encoder_; |
| 59 rtc::scoped_ptr<AudioEncoder> red_encoder_; | 47 rtc::scoped_ptr<AudioEncoder> red_encoder_; |
| 60 | 48 |
| 61 RentACodec rent_a_codec_; | |
| 62 | |
| 63 RTC_DISALLOW_COPY_AND_ASSIGN(CodecOwner); | 49 RTC_DISALLOW_COPY_AND_ASSIGN(CodecOwner); |
| 64 }; | 50 }; |
| 65 | 51 |
| 66 } // namespace acm2 | 52 } // namespace acm2 |
| 67 } // namespace webrtc | 53 } // namespace webrtc |
| 68 #endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_CODEC_OWNER_H_ | 54 #endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_CODEC_OWNER_H_ |
| OLD | NEW |