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

Side by Side Diff: webrtc/modules/audio_coding/main/acm2/rent_a_codec.h

Issue 1459193002: Extract the parameters for the encoder stack from the CodecManager (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 1 month 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 unified diff | Download patch
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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 const CodecInst& codec_inst); 193 const CodecInst& codec_inst);
194 194
195 RentACodec(); 195 RentACodec();
196 ~RentACodec(); 196 ~RentACodec();
197 197
198 // Creates and returns an audio encoder built to the given specification. 198 // Creates and returns an audio encoder built to the given specification.
199 // Returns null in case of error. The returned encoder is live until the next 199 // Returns null in case of error. The returned encoder is live until the next
200 // successful call to this function, or until the Rent-A-Codec is destroyed. 200 // successful call to this function, or until the Rent-A-Codec is destroyed.
201 AudioEncoder* RentEncoder(const CodecInst& codec_inst); 201 AudioEncoder* RentEncoder(const CodecInst& codec_inst);
202 202
203 // Creates and returns an audio encoder stack where the given speech encoder 203 struct StackParameters {
204 // is augmented with the specified CNG/VAD and RED encoders. Leave either 204 StackParameters();
205 // optional field blank if you don't want the corresponding gizmo in the 205 ~StackParameters();
206 // stack. The returned encoder is live until the next successful call to this 206
207 // function, or until the Rent-A-Codec is destroyed. 207 bool use_codec_fec = false;
208 struct CngConfig { 208 bool use_red = false;
209 int cng_payload_type; 209 bool use_cng = false;
210 ACMVADMode vad_mode; 210 ACMVADMode vad_mode = VADNormal;
211
212 // Maps from RTP timestamp rate (in Hz) to payload type.
213 std::map<int, int> cng_payload_types;
214 std::map<int, int> red_payload_types;
211 }; 215 };
216
217 // Creates and returns an audio encoder stack constructed to the given
218 // specification. If the specification isn't compatible with the encoder, it
219 // will be changed to match (things will be switched off). The returned
220 // encoder is live until the next successful call to this function, or until
221 // the Rent-A-Codec is destroyed.
212 AudioEncoder* RentEncoderStack(AudioEncoder* speech_encoder, 222 AudioEncoder* RentEncoderStack(AudioEncoder* speech_encoder,
213 rtc::Optional<CngConfig> cng_config, 223 StackParameters* param);
214 rtc::Optional<int> red_payload_type);
215 224
216 // Get the last return values of RentEncoder and RentEncoderStack, or null if 225 // Get the last return values of RentEncoder and RentEncoderStack, or null if
217 // they haven't been called. 226 // they haven't been called.
218 AudioEncoder* GetEncoder() const { return speech_encoder_.get(); } 227 AudioEncoder* GetEncoder() const { return speech_encoder_.get(); }
219 AudioEncoder* GetEncoderStack() const { return encoder_stack_; } 228 AudioEncoder* GetEncoderStack() const { return encoder_stack_; }
220 229
221 // Creates and returns an iSAC decoder, which will remain live until the 230 // Creates and returns an iSAC decoder, which will remain live until the
222 // Rent-A-Codec is destroyed. Subsequent calls will simply return the same 231 // Rent-A-Codec is destroyed. Subsequent calls will simply return the same
223 // object. 232 // object.
224 AudioDecoder* RentIsacDecoder(); 233 AudioDecoder* RentIsacDecoder();
225 234
226 private: 235 private:
227 rtc::scoped_ptr<AudioEncoder> speech_encoder_; 236 rtc::scoped_ptr<AudioEncoder> speech_encoder_;
228 rtc::scoped_ptr<AudioEncoder> cng_encoder_; 237 rtc::scoped_ptr<AudioEncoder> cng_encoder_;
229 rtc::scoped_ptr<AudioEncoder> red_encoder_; 238 rtc::scoped_ptr<AudioEncoder> red_encoder_;
230 rtc::scoped_ptr<AudioDecoder> isac_decoder_; 239 rtc::scoped_ptr<AudioDecoder> isac_decoder_;
231 AudioEncoder* encoder_stack_ = nullptr; 240 AudioEncoder* encoder_stack_ = nullptr;
232 LockedIsacBandwidthInfo isac_bandwidth_info_; 241 LockedIsacBandwidthInfo isac_bandwidth_info_;
233 242
234 RTC_DISALLOW_COPY_AND_ASSIGN(RentACodec); 243 RTC_DISALLOW_COPY_AND_ASSIGN(RentACodec);
235 }; 244 };
236 245
237 } // namespace acm2 246 } // namespace acm2
238 } // namespace webrtc 247 } // namespace webrtc
239 248
240 #endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_RENT_A_CODEC_H_ 249 #endif // WEBRTC_MODULES_AUDIO_CODING_MAIN_ACM2_RENT_A_CODEC_H_
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/main/acm2/codec_manager.cc ('k') | webrtc/modules/audio_coding/main/acm2/rent_a_codec.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698