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

Unified 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: Created 4 years, 8 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
Index: webrtc/modules/audio_coding/neteq/neteq_impl.h
diff --git a/webrtc/modules/audio_coding/neteq/neteq_impl.h b/webrtc/modules/audio_coding/neteq/neteq_impl.h
index 9d4a9ff26966c703065c36f4da367e44562cc06f..7f39474a738c3caee668692ec86766800fcab4a7 100644
--- a/webrtc/modules/audio_coding/neteq/neteq_impl.h
+++ b/webrtc/modules/audio_coding/neteq/neteq_impl.h
@@ -66,22 +66,34 @@ class NetEqImpl : public webrtc::NetEq {
kVadPassive
};
+ struct Dependencies {
+ // The constructor populates the Dependencies struct with the default
+ // implementations of the objects. They can all be replaced by the user
+ // before sending the struct to the NetEqImpl constructor. However, there
+ // are dependencies between some of the classes inside the struct, so
+ // swapping out one may make it necessary to re-create another one.
+ explicit Dependencies(const NetEq::Config& config);
+ ~Dependencies();
+
+ std::unique_ptr<TickTimer> tick_timer;
+ std::unique_ptr<BufferLevelFilter> buffer_level_filter;
+ std::unique_ptr<DecoderDatabase> decoder_database;
+ std::unique_ptr<DelayPeakDetector> delay_peak_detector;
+ std::unique_ptr<DelayManager> delay_manager;
+ std::unique_ptr<DtmfBuffer> dtmf_buffer;
+ std::unique_ptr<DtmfToneGenerator> dtmf_tone_generator;
+ std::unique_ptr<PacketBuffer> packet_buffer;
+ std::unique_ptr<PayloadSplitter> payload_splitter;
+ std::unique_ptr<TimestampScaler> timestamp_scaler;
+ std::unique_ptr<AccelerateFactory> accelerate_factory;
+ std::unique_ptr<ExpandFactory> expand_factory;
+ std::unique_ptr<PreemptiveExpandFactory> preemptive_expand_factory;
+ };
+
// Creates a new NetEqImpl object. The object will assume ownership of all
// injected dependencies, and will delete them when done.
kwiberg-webrtc 2016/04/26 13:00:04 You no longer need the second sentence in this com
hlundin-webrtc 2016/04/26 13:20:38 Done.
NetEqImpl(const NetEq::Config& config,
- std::unique_ptr<TickTimer> tick_timer,
- BufferLevelFilter* buffer_level_filter,
- DecoderDatabase* decoder_database,
- DelayManager* delay_manager,
- DelayPeakDetector* delay_peak_detector,
- DtmfBuffer* dtmf_buffer,
- DtmfToneGenerator* dtmf_tone_generator,
- PacketBuffer* packet_buffer,
- PayloadSplitter* payload_splitter,
- TimestampScaler* timestamp_scaler,
- AccelerateFactory* accelerate_factory,
- ExpandFactory* expand_factory,
- PreemptiveExpandFactory* preemptive_expand_factory,
+ Dependencies&& deps,
bool create_components = true);
~NetEqImpl() override;

Powered by Google App Engine
This is Rietveld 408576698