Chromium Code Reviews

Side by Side 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.
Jump to:
View unified diff |
OLDNEW
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 37 matching lines...)
48 return &codec_stack_params_; 48 return &codec_stack_params_;
49 } 49 }
50 RentACodec::StackParameters* GetStackParams() { return &codec_stack_params_; } 50 RentACodec::StackParameters* GetStackParams() { return &codec_stack_params_; }
51 51
52 bool SetCopyRed(bool enable); 52 bool SetCopyRed(bool enable);
53 53
54 bool SetVAD(bool enable, ACMVADMode mode); 54 bool SetVAD(bool enable, ACMVADMode mode);
55 55
56 bool SetCodecFEC(bool enable_codec_fec); 56 bool SetCodecFEC(bool enable_codec_fec);
57 57
58 // Uses the provided Rent-A-Codec to create a new encoder stack, if we have a
59 // complete specification; if so, it is then passed to set_encoder. On error,
60 // returns false.
61 template <typename F>
62 bool MakeEncoder(RentACodec* rac, F set_encoder) {
63 if (!codec_stack_params_.speech_encoder && send_codec_inst_) {
64 // We have no speech encoder, but we have a specification for making one.
65 auto enc = rac->RentEncoder(*send_codec_inst_);
66 if (!enc)
67 return false;
68 codec_stack_params_.speech_encoder = std::move(enc);
69 }
70 auto stack = rac->RentEncoderStack(&codec_stack_params_);
71 if (stack) {
72 set_encoder(std::move(stack));
73 }
74 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.
75 }
76
58 private: 77 private:
59 rtc::ThreadChecker thread_checker_; 78 rtc::ThreadChecker thread_checker_;
60 rtc::Optional<CodecInst> send_codec_inst_; 79 rtc::Optional<CodecInst> send_codec_inst_;
61 RentACodec::StackParameters codec_stack_params_; 80 RentACodec::StackParameters codec_stack_params_;
62 81
63 RTC_DISALLOW_COPY_AND_ASSIGN(CodecManager); 82 RTC_DISALLOW_COPY_AND_ASSIGN(CodecManager);
64 }; 83 };
65 84
66 } // namespace acm2 85 } // namespace acm2
67 } // namespace webrtc 86 } // namespace webrtc
68 #endif // WEBRTC_MODULES_AUDIO_CODING_ACM2_CODEC_MANAGER_H_ 87 #endif // WEBRTC_MODULES_AUDIO_CODING_ACM2_CODEC_MANAGER_H_
OLDNEW
« 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