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

Side by Side 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: Rebase, with conflicts 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 unified diff | Download patch
« no previous file with comments | « no previous file | webrtc/modules/audio_coding/neteq/neteq_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
11 #include "webrtc/modules/audio_coding/neteq/include/neteq.h" 11 #include "webrtc/modules/audio_coding/neteq/include/neteq.h"
12 12
13 #include <sstream> 13 #include <sstream>
14 14
15 #include "webrtc/modules/audio_coding/neteq/accelerate.h"
16 #include "webrtc/modules/audio_coding/neteq/buffer_level_filter.h"
17 #include "webrtc/modules/audio_coding/neteq/decoder_database.h"
18 #include "webrtc/modules/audio_coding/neteq/delay_manager.h"
19 #include "webrtc/modules/audio_coding/neteq/delay_peak_detector.h"
20 #include "webrtc/modules/audio_coding/neteq/dtmf_buffer.h"
21 #include "webrtc/modules/audio_coding/neteq/dtmf_tone_generator.h"
22 #include "webrtc/modules/audio_coding/neteq/expand.h"
23 #include "webrtc/modules/audio_coding/neteq/neteq_impl.h" 15 #include "webrtc/modules/audio_coding/neteq/neteq_impl.h"
24 #include "webrtc/modules/audio_coding/neteq/packet_buffer.h"
25 #include "webrtc/modules/audio_coding/neteq/payload_splitter.h"
26 #include "webrtc/modules/audio_coding/neteq/preemptive_expand.h"
27 #include "webrtc/modules/audio_coding/neteq/tick_timer.h"
28 #include "webrtc/modules/audio_coding/neteq/timestamp_scaler.h"
29 16
30 namespace webrtc { 17 namespace webrtc {
31 18
32 std::string NetEq::Config::ToString() const { 19 std::string NetEq::Config::ToString() const {
33 std::stringstream ss; 20 std::stringstream ss;
34 ss << "sample_rate_hz=" << sample_rate_hz << ", enable_audio_classifier=" 21 ss << "sample_rate_hz=" << sample_rate_hz << ", enable_audio_classifier="
35 << (enable_audio_classifier ? "true" : "false") 22 << (enable_audio_classifier ? "true" : "false")
36 << ", enable_post_decode_vad=" 23 << ", enable_post_decode_vad="
37 << (enable_post_decode_vad ? "true" : "false") 24 << (enable_post_decode_vad ? "true" : "false")
38 << ", max_packets_in_buffer=" << max_packets_in_buffer 25 << ", max_packets_in_buffer=" << max_packets_in_buffer
39 << ", background_noise_mode=" << background_noise_mode 26 << ", background_noise_mode=" << background_noise_mode
40 << ", playout_mode=" << playout_mode 27 << ", playout_mode=" << playout_mode
41 << ", enable_fast_accelerate=" << enable_fast_accelerate; 28 << ", enable_fast_accelerate=" << enable_fast_accelerate;
42 return ss.str(); 29 return ss.str();
43 } 30 }
44 31
45 // Creates all classes needed and inject them into a new NetEqImpl object. 32 // Creates all classes needed and inject them into a new NetEqImpl object.
46 // Return the new object. 33 // Return the new object.
47 NetEq* NetEq::Create(const NetEq::Config& config) { 34 NetEq* NetEq::Create(const NetEq::Config& config) {
48 std::unique_ptr<TickTimer> tick_timer(new TickTimer); 35 return new NetEqImpl(config, NetEqImpl::Dependencies(config));
49 BufferLevelFilter* buffer_level_filter = new BufferLevelFilter;
50 DecoderDatabase* decoder_database = new DecoderDatabase;
51 DelayPeakDetector* delay_peak_detector = new DelayPeakDetector;
52 DelayManager* delay_manager =
53 new DelayManager(config.max_packets_in_buffer, delay_peak_detector);
54 delay_manager->SetMaximumDelay(config.max_delay_ms);
55 DtmfBuffer* dtmf_buffer = new DtmfBuffer(config.sample_rate_hz);
56 DtmfToneGenerator* dtmf_tone_generator = new DtmfToneGenerator;
57 PacketBuffer* packet_buffer =
58 new PacketBuffer(config.max_packets_in_buffer, tick_timer.get());
59 PayloadSplitter* payload_splitter = new PayloadSplitter;
60 TimestampScaler* timestamp_scaler = new TimestampScaler(*decoder_database);
61 AccelerateFactory* accelerate_factory = new AccelerateFactory;
62 ExpandFactory* expand_factory = new ExpandFactory;
63 PreemptiveExpandFactory* preemptive_expand_factory =
64 new PreemptiveExpandFactory;
65 return new NetEqImpl(config, std::move(tick_timer), buffer_level_filter,
66 decoder_database, delay_manager, delay_peak_detector,
67 dtmf_buffer, dtmf_tone_generator, packet_buffer,
68 payload_splitter, timestamp_scaler, accelerate_factory,
69 expand_factory, preemptive_expand_factory);
70 } 36 }
71 37
72 } // namespace webrtc 38 } // namespace webrtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/modules/audio_coding/neteq/neteq_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698