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

Side by Side Diff: webrtc/modules/audio_coding/acm2/audio_coding_module_impl.h

Issue 1702943002: Pass ownership of external encoders to the ACM (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 12 matching lines...) Expand all
23 #include "webrtc/modules/audio_coding/acm2/acm_receiver.h" 23 #include "webrtc/modules/audio_coding/acm2/acm_receiver.h"
24 #include "webrtc/modules/audio_coding/acm2/acm_resampler.h" 24 #include "webrtc/modules/audio_coding/acm2/acm_resampler.h"
25 #include "webrtc/modules/audio_coding/acm2/codec_manager.h" 25 #include "webrtc/modules/audio_coding/acm2/codec_manager.h"
26 26
27 namespace webrtc { 27 namespace webrtc {
28 28
29 class AudioCodingImpl; 29 class AudioCodingImpl;
30 30
31 namespace acm2 { 31 namespace acm2 {
32 32
33 struct EncoderFactory;
34
33 class AudioCodingModuleImpl final : public AudioCodingModule { 35 class AudioCodingModuleImpl final : public AudioCodingModule {
34 public: 36 public:
35 friend webrtc::AudioCodingImpl; 37 friend webrtc::AudioCodingImpl;
36 38
37 explicit AudioCodingModuleImpl(const AudioCodingModule::Config& config); 39 explicit AudioCodingModuleImpl(const AudioCodingModule::Config& config);
38 ~AudioCodingModuleImpl() override; 40 ~AudioCodingModuleImpl() override;
39 41
40 ///////////////////////////////////////// 42 /////////////////////////////////////////
41 // Sender 43 // Sender
42 // 44 //
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 244
243 rtc::CriticalSection acm_crit_sect_; 245 rtc::CriticalSection acm_crit_sect_;
244 rtc::Buffer encode_buffer_ GUARDED_BY(acm_crit_sect_); 246 rtc::Buffer encode_buffer_ GUARDED_BY(acm_crit_sect_);
245 int id_; // TODO(henrik.lundin) Make const. 247 int id_; // TODO(henrik.lundin) Make const.
246 uint32_t expected_codec_ts_ GUARDED_BY(acm_crit_sect_); 248 uint32_t expected_codec_ts_ GUARDED_BY(acm_crit_sect_);
247 uint32_t expected_in_ts_ GUARDED_BY(acm_crit_sect_); 249 uint32_t expected_in_ts_ GUARDED_BY(acm_crit_sect_);
248 ACMResampler resampler_ GUARDED_BY(acm_crit_sect_); 250 ACMResampler resampler_ GUARDED_BY(acm_crit_sect_);
249 AcmReceiver receiver_; // AcmReceiver has it's own internal lock. 251 AcmReceiver receiver_; // AcmReceiver has it's own internal lock.
250 ChangeLogger bitrate_logger_ GUARDED_BY(acm_crit_sect_); 252 ChangeLogger bitrate_logger_ GUARDED_BY(acm_crit_sect_);
251 253
252 struct EncoderFactory {
253 CodecManager codec_manager;
254 RentACodec rent_a_codec;
255 };
256 std::unique_ptr<EncoderFactory> encoder_factory_ GUARDED_BY(acm_crit_sect_); 254 std::unique_ptr<EncoderFactory> encoder_factory_ GUARDED_BY(acm_crit_sect_);
257 255
258 // Current encoder stack, either obtained from 256 // Current encoder stack, either obtained from
259 // encoder_factory_->rent_a_codec.RentEncoderStack or provided by a call to 257 // encoder_factory_->rent_a_codec.RentEncoderStack or provided by a call to
260 // RegisterEncoder. 258 // RegisterEncoder.
261 AudioEncoder* encoder_stack_ GUARDED_BY(acm_crit_sect_); 259 std::unique_ptr<AudioEncoder> encoder_stack_ GUARDED_BY(acm_crit_sect_);
262 260
263 // This is to keep track of CN instances where we can send DTMFs. 261 // This is to keep track of CN instances where we can send DTMFs.
264 uint8_t previous_pltype_ GUARDED_BY(acm_crit_sect_); 262 uint8_t previous_pltype_ GUARDED_BY(acm_crit_sect_);
265 263
266 // Used when payloads are pushed into ACM without any RTP info 264 // Used when payloads are pushed into ACM without any RTP info
267 // One example is when pre-encoded bit-stream is pushed from 265 // One example is when pre-encoded bit-stream is pushed from
268 // a file. 266 // a file.
269 // IMPORTANT: this variable is only used in IncomingPayload(), therefore, 267 // IMPORTANT: this variable is only used in IncomingPayload(), therefore,
270 // no lock acquired when interacting with this variable. If it is going to 268 // no lock acquired when interacting with this variable. If it is going to
271 // be used in other methods, locks need to be taken. 269 // be used in other methods, locks need to be taken.
(...skipping 11 matching lines...) Expand all
283 rtc::CriticalSection callback_crit_sect_; 281 rtc::CriticalSection callback_crit_sect_;
284 AudioPacketizationCallback* packetization_callback_ 282 AudioPacketizationCallback* packetization_callback_
285 GUARDED_BY(callback_crit_sect_); 283 GUARDED_BY(callback_crit_sect_);
286 ACMVADCallback* vad_callback_ GUARDED_BY(callback_crit_sect_); 284 ACMVADCallback* vad_callback_ GUARDED_BY(callback_crit_sect_);
287 }; 285 };
288 286
289 } // namespace acm2 287 } // namespace acm2
290 } // namespace webrtc 288 } // namespace webrtc
291 289
292 #endif // WEBRTC_MODULES_AUDIO_CODING_ACM2_AUDIO_CODING_MODULE_IMPL_H_ 290 #endif // WEBRTC_MODULES_AUDIO_CODING_ACM2_AUDIO_CODING_MODULE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698