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

Side by Side Diff: webrtc/modules/audio_coding/neteq/neteq_impl.h

Issue 1921243002: NetEq: Dependency injection through one struct instead of many params (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase, with conflicts Created 4 years, 7 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 class NetEqImpl : public webrtc::NetEq { 59 class NetEqImpl : public webrtc::NetEq {
60 public: 60 public:
61 enum class OutputType { 61 enum class OutputType {
62 kNormalSpeech, 62 kNormalSpeech,
63 kPLC, 63 kPLC,
64 kCNG, 64 kCNG,
65 kPLCCNG, 65 kPLCCNG,
66 kVadPassive 66 kVadPassive
67 }; 67 };
68 68
69 // Creates a new NetEqImpl object. The object will assume ownership of all 69 struct Dependencies {
70 // injected dependencies, and will delete them when done. 70 // The constructor populates the Dependencies struct with the default
71 // implementations of the objects. They can all be replaced by the user
72 // before sending the struct to the NetEqImpl constructor. However, there
73 // are dependencies between some of the classes inside the struct, so
74 // swapping out one may make it necessary to re-create another one.
75 explicit Dependencies(const NetEq::Config& config);
76 ~Dependencies();
77
78 std::unique_ptr<TickTimer> tick_timer;
79 std::unique_ptr<BufferLevelFilter> buffer_level_filter;
80 std::unique_ptr<DecoderDatabase> decoder_database;
81 std::unique_ptr<DelayPeakDetector> delay_peak_detector;
82 std::unique_ptr<DelayManager> delay_manager;
83 std::unique_ptr<DtmfBuffer> dtmf_buffer;
84 std::unique_ptr<DtmfToneGenerator> dtmf_tone_generator;
85 std::unique_ptr<PacketBuffer> packet_buffer;
86 std::unique_ptr<PayloadSplitter> payload_splitter;
87 std::unique_ptr<TimestampScaler> timestamp_scaler;
88 std::unique_ptr<AccelerateFactory> accelerate_factory;
89 std::unique_ptr<ExpandFactory> expand_factory;
90 std::unique_ptr<PreemptiveExpandFactory> preemptive_expand_factory;
91 };
92
93 // Creates a new NetEqImpl object.
71 NetEqImpl(const NetEq::Config& config, 94 NetEqImpl(const NetEq::Config& config,
72 std::unique_ptr<TickTimer> tick_timer, 95 Dependencies&& deps,
73 BufferLevelFilter* buffer_level_filter,
74 DecoderDatabase* decoder_database,
75 DelayManager* delay_manager,
76 DelayPeakDetector* delay_peak_detector,
77 DtmfBuffer* dtmf_buffer,
78 DtmfToneGenerator* dtmf_tone_generator,
79 PacketBuffer* packet_buffer,
80 PayloadSplitter* payload_splitter,
81 TimestampScaler* timestamp_scaler,
82 AccelerateFactory* accelerate_factory,
83 ExpandFactory* expand_factory,
84 PreemptiveExpandFactory* preemptive_expand_factory,
85 bool create_components = true); 96 bool create_components = true);
86 97
87 ~NetEqImpl() override; 98 ~NetEqImpl() override;
88 99
89 // Inserts a new packet into NetEq. The |receive_timestamp| is an indication 100 // Inserts a new packet into NetEq. The |receive_timestamp| is an indication
90 // of the time when the packet was received, and should be measured with 101 // of the time when the packet was received, and should be measured with
91 // the same tick rate as the RTP timestamp of the current payload. 102 // the same tick rate as the RTP timestamp of the current payload.
92 // Returns 0 on success, -1 on failure. 103 // Returns 0 on success, -1 on failure.
93 int InsertPacket(const WebRtcRTPHeader& rtp_header, 104 int InsertPacket(const WebRtcRTPHeader& rtp_header,
94 rtc::ArrayView<const uint8_t> payload, 105 rtc::ArrayView<const uint8_t> payload,
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 bool nack_enabled_ GUARDED_BY(crit_sect_); 403 bool nack_enabled_ GUARDED_BY(crit_sect_);
393 AudioFrame::VADActivity last_vad_activity_ GUARDED_BY(crit_sect_) = 404 AudioFrame::VADActivity last_vad_activity_ GUARDED_BY(crit_sect_) =
394 AudioFrame::kVadPassive; 405 AudioFrame::kVadPassive;
395 406
396 private: 407 private:
397 RTC_DISALLOW_COPY_AND_ASSIGN(NetEqImpl); 408 RTC_DISALLOW_COPY_AND_ASSIGN(NetEqImpl);
398 }; 409 };
399 410
400 } // namespace webrtc 411 } // namespace webrtc
401 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_NETEQ_IMPL_H_ 412 #endif // WEBRTC_MODULES_AUDIO_CODING_NETEQ_NETEQ_IMPL_H_
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/neteq/neteq.cc ('k') | webrtc/modules/audio_coding/neteq/neteq_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698