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

Unified Diff: webrtc/modules/audio_coding/neteq/neteq.cc

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.cc
diff --git a/webrtc/modules/audio_coding/neteq/neteq.cc b/webrtc/modules/audio_coding/neteq/neteq.cc
index bc6319dedb9238d5c4742137311b364f078f0f75..f18e661554af965d33df15e1de6c3833ec31ac88 100644
--- a/webrtc/modules/audio_coding/neteq/neteq.cc
+++ b/webrtc/modules/audio_coding/neteq/neteq.cc
@@ -12,20 +12,7 @@
#include <sstream>
-#include "webrtc/modules/audio_coding/neteq/accelerate.h"
-#include "webrtc/modules/audio_coding/neteq/buffer_level_filter.h"
-#include "webrtc/modules/audio_coding/neteq/decoder_database.h"
-#include "webrtc/modules/audio_coding/neteq/delay_manager.h"
-#include "webrtc/modules/audio_coding/neteq/delay_peak_detector.h"
-#include "webrtc/modules/audio_coding/neteq/dtmf_buffer.h"
-#include "webrtc/modules/audio_coding/neteq/dtmf_tone_generator.h"
-#include "webrtc/modules/audio_coding/neteq/expand.h"
#include "webrtc/modules/audio_coding/neteq/neteq_impl.h"
-#include "webrtc/modules/audio_coding/neteq/packet_buffer.h"
-#include "webrtc/modules/audio_coding/neteq/payload_splitter.h"
-#include "webrtc/modules/audio_coding/neteq/preemptive_expand.h"
-#include "webrtc/modules/audio_coding/neteq/tick_timer.h"
-#include "webrtc/modules/audio_coding/neteq/timestamp_scaler.h"
namespace webrtc {
@@ -45,27 +32,8 @@ std::string NetEq::Config::ToString() const {
// Creates all classes needed and inject them into a new NetEqImpl object.
// Return the new object.
NetEq* NetEq::Create(const NetEq::Config& config) {
- std::unique_ptr<TickTimer> tick_timer(new TickTimer);
- BufferLevelFilter* buffer_level_filter = new BufferLevelFilter;
- DecoderDatabase* decoder_database = new DecoderDatabase;
- DelayPeakDetector* delay_peak_detector = new DelayPeakDetector;
- DelayManager* delay_manager =
- new DelayManager(config.max_packets_in_buffer, delay_peak_detector);
- delay_manager->SetMaximumDelay(config.max_delay_ms);
- DtmfBuffer* dtmf_buffer = new DtmfBuffer(config.sample_rate_hz);
- DtmfToneGenerator* dtmf_tone_generator = new DtmfToneGenerator;
- PacketBuffer* packet_buffer = new PacketBuffer(config.max_packets_in_buffer);
- PayloadSplitter* payload_splitter = new PayloadSplitter;
- TimestampScaler* timestamp_scaler = new TimestampScaler(*decoder_database);
- AccelerateFactory* accelerate_factory = new AccelerateFactory;
- ExpandFactory* expand_factory = new ExpandFactory;
- PreemptiveExpandFactory* preemptive_expand_factory =
- new PreemptiveExpandFactory;
- return new NetEqImpl(config, std::move(tick_timer), buffer_level_filter,
- decoder_database, delay_manager, delay_peak_detector,
- dtmf_buffer, dtmf_tone_generator, packet_buffer,
- payload_splitter, timestamp_scaler, accelerate_factory,
- expand_factory, preemptive_expand_factory);
+ NetEqImpl::Dependencies deps(config);
+ return new NetEqImpl(config, std::move(deps));
kwiberg-webrtc 2016/04/26 13:00:04 Just return new NetEqImpl(config, NetEqImpl::De
hlundin-webrtc 2016/04/26 13:20:38 Done.
}
} // namespace webrtc
« no previous file with comments | « no previous file | webrtc/modules/audio_coding/neteq/neteq_impl.h » ('j') | webrtc/modules/audio_coding/neteq/neteq_impl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698