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

Unified Diff: webrtc/modules/audio_coding/acm2/codec_manager.h

Issue 1520283006: Move Rent-A-Codec out of CodecManager (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@rac0
Patch Set: review comments Created 5 years 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/audio_coding/acm2/codec_manager.h
diff --git a/webrtc/modules/audio_coding/acm2/codec_manager.h b/webrtc/modules/audio_coding/acm2/codec_manager.h
index 61832e4f1052f0cc8987a2b13f8eee48d1123561..ad96d1d9f074ce86bfdae6928e4d36696bfbefab 100644
--- a/webrtc/modules/audio_coding/acm2/codec_manager.h
+++ b/webrtc/modules/audio_coding/acm2/codec_manager.h
@@ -33,46 +33,33 @@ class CodecManager final {
CodecManager();
~CodecManager();
- int RegisterEncoder(const CodecInst& send_codec);
+ // Parses the given specification. On success, returns true and updates the
+ // stored CodecInst and stack parameters; on error, returns false.
+ bool RegisterEncoder(const CodecInst& send_codec);
- void RegisterEncoder(AudioEncoder* external_speech_encoder);
+ static CodecInst ForgeCodecInst(const AudioEncoder* external_speech_encoder);
- rtc::Optional<CodecInst> GetCodecInst() const;
+ const CodecInst* GetCodecInst() const {
+ return send_codec_inst_ ? &*send_codec_inst_ : nullptr;
+ }
+ const RentACodec::StackParameters* GetStackParams() const {
+ return &codec_stack_params_;
+ }
+ RentACodec::StackParameters* GetStackParams() { return &codec_stack_params_; }
bool SetCopyRed(bool enable);
- int SetVAD(bool enable, ACMVADMode mode);
-
- void VAD(bool* dtx_enabled, bool* vad_enabled, ACMVADMode* mode) const;
-
- int SetCodecFEC(bool enable_codec_fec);
-
- // Returns a pointer to AudioDecoder of the given codec. For iSAC, encoding
- // and decoding have to be performed on a shared codec instance. By calling
- // this method, we get the codec instance that ACM owns.
- // If |codec| does not share an instance between encoder and decoder, returns
- // null.
- AudioDecoder* GetAudioDecoder(const CodecInst& codec);
+ bool SetVAD(bool enable, ACMVADMode mode);
- bool red_enabled() const { return codec_stack_params_.use_red; }
+ bool SetCodecFEC(bool enable_codec_fec);
- bool codec_fec_enabled() const { return codec_stack_params_.use_codec_fec; }
-
- AudioEncoder* CurrentEncoder() { return rent_a_codec_.GetEncoderStack(); }
- const AudioEncoder* CurrentEncoder() const {
- return rent_a_codec_.GetEncoderStack();
- }
-
- bool CurrentEncoderIsOpus() const { return encoder_is_opus_; }
+ bool CurrentEncoderIsOpus() const;
private:
rtc::ThreadChecker thread_checker_;
- CodecInst send_codec_inst_;
- RentACodec rent_a_codec_;
+ rtc::Optional<CodecInst> send_codec_inst_;
RentACodec::StackParameters codec_stack_params_;
- bool encoder_is_opus_;
-
RTC_DISALLOW_COPY_AND_ASSIGN(CodecManager);
};

Powered by Google App Engine
This is Rietveld 408576698