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

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

Issue 1677013002: Switch to using new ACM methods for encoder management (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@acm-13
Patch Set: Created 4 years, 9 months 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
« no previous file with comments | « no previous file | webrtc/modules/audio_coding/acm2/rent_a_codec.h » ('j') | webrtc/voice_engine/channel.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 fbd3a18b188efa203949159bf0e0b8c9bde353b3..a92c9c3b7d853be0fdcb2aa0397f72180db5d5f3 100644
--- a/webrtc/modules/audio_coding/acm2/codec_manager.h
+++ b/webrtc/modules/audio_coding/acm2/codec_manager.h
@@ -55,6 +55,25 @@ class CodecManager final {
bool SetCodecFEC(bool enable_codec_fec);
+ // Uses the provided Rent-A-Codec to create a new encoder stack, if we have a
+ // complete specification; if so, it is then passed to set_encoder. On error,
+ // returns false.
+ template <typename F>
+ bool MakeEncoder(RentACodec* rac, F set_encoder) {
+ if (!codec_stack_params_.speech_encoder && send_codec_inst_) {
+ // We have no speech encoder, but we have a specification for making one.
+ auto enc = rac->RentEncoder(*send_codec_inst_);
+ if (!enc)
+ return false;
+ codec_stack_params_.speech_encoder = std::move(enc);
+ }
+ auto stack = rac->RentEncoderStack(&codec_stack_params_);
+ if (stack) {
+ set_encoder(std::move(stack));
+ }
+ return true;
hlundin-webrtc 2016/03/29 20:23:32 If we did not get a stack, we still return true. D
kwiberg-webrtc 2016/03/29 23:25:32 No, because callers may call this method before a
hlundin-webrtc 2016/03/30 08:36:10 Acknowledged.
+ }
+
private:
rtc::ThreadChecker thread_checker_;
rtc::Optional<CodecInst> send_codec_inst_;
« no previous file with comments | « no previous file | webrtc/modules/audio_coding/acm2/rent_a_codec.h » ('j') | webrtc/voice_engine/channel.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698