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

Side by Side Diff: webrtc/modules/audio_coding/neteq/neteq.cc

Issue 1903043003: WIP: Adding a centralized NetEq Clock (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@neteq-remove-type-param
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 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
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" 15 #include "webrtc/modules/audio_coding/neteq/accelerate.h"
16 #include "webrtc/modules/audio_coding/neteq/buffer_level_filter.h" 16 #include "webrtc/modules/audio_coding/neteq/buffer_level_filter.h"
17 #include "webrtc/modules/audio_coding/neteq/decoder_database.h" 17 #include "webrtc/modules/audio_coding/neteq/decoder_database.h"
18 #include "webrtc/modules/audio_coding/neteq/delay_manager.h" 18 #include "webrtc/modules/audio_coding/neteq/delay_manager.h"
19 #include "webrtc/modules/audio_coding/neteq/delay_peak_detector.h" 19 #include "webrtc/modules/audio_coding/neteq/delay_peak_detector.h"
20 #include "webrtc/modules/audio_coding/neteq/dtmf_buffer.h" 20 #include "webrtc/modules/audio_coding/neteq/dtmf_buffer.h"
21 #include "webrtc/modules/audio_coding/neteq/dtmf_tone_generator.h" 21 #include "webrtc/modules/audio_coding/neteq/dtmf_tone_generator.h"
22 #include "webrtc/modules/audio_coding/neteq/expand.h" 22 #include "webrtc/modules/audio_coding/neteq/expand.h"
23 #include "webrtc/modules/audio_coding/neteq/neteq_impl.h" 23 #include "webrtc/modules/audio_coding/neteq/neteq_impl.h"
24 #include "webrtc/modules/audio_coding/neteq/packet_buffer.h" 24 #include "webrtc/modules/audio_coding/neteq/packet_buffer.h"
25 #include "webrtc/modules/audio_coding/neteq/payload_splitter.h" 25 #include "webrtc/modules/audio_coding/neteq/payload_splitter.h"
26 #include "webrtc/modules/audio_coding/neteq/preemptive_expand.h" 26 #include "webrtc/modules/audio_coding/neteq/preemptive_expand.h"
27 #include "webrtc/modules/audio_coding/neteq/tick_timer.h"
27 #include "webrtc/modules/audio_coding/neteq/timestamp_scaler.h" 28 #include "webrtc/modules/audio_coding/neteq/timestamp_scaler.h"
28 29
29 namespace webrtc { 30 namespace webrtc {
30 31
31 std::string NetEq::Config::ToString() const { 32 std::string NetEq::Config::ToString() const {
32 std::stringstream ss; 33 std::stringstream ss;
33 ss << "sample_rate_hz=" << sample_rate_hz << ", enable_audio_classifier=" 34 ss << "sample_rate_hz=" << sample_rate_hz << ", enable_audio_classifier="
34 << (enable_audio_classifier ? "true" : "false") 35 << (enable_audio_classifier ? "true" : "false")
35 << ", enable_post_decode_vad=" 36 << ", enable_post_decode_vad="
36 << (enable_post_decode_vad ? "true" : "false") 37 << (enable_post_decode_vad ? "true" : "false")
37 << ", max_packets_in_buffer=" << max_packets_in_buffer 38 << ", max_packets_in_buffer=" << max_packets_in_buffer
38 << ", background_noise_mode=" << background_noise_mode 39 << ", background_noise_mode=" << background_noise_mode
39 << ", playout_mode=" << playout_mode 40 << ", playout_mode=" << playout_mode
40 << ", enable_fast_accelerate=" << enable_fast_accelerate; 41 << ", enable_fast_accelerate=" << enable_fast_accelerate;
41 return ss.str(); 42 return ss.str();
42 } 43 }
43 44
44 // Creates all classes needed and inject them into a new NetEqImpl object. 45 // Creates all classes needed and inject them into a new NetEqImpl object.
45 // Return the new object. 46 // Return the new object.
46 NetEq* NetEq::Create(const NetEq::Config& config) { 47 NetEq* NetEq::Create(const NetEq::Config& config) {
48 std::unique_ptr<TickTimer> tick_timer(new TickTimer);
47 BufferLevelFilter* buffer_level_filter = new BufferLevelFilter; 49 BufferLevelFilter* buffer_level_filter = new BufferLevelFilter;
48 DecoderDatabase* decoder_database = new DecoderDatabase; 50 DecoderDatabase* decoder_database = new DecoderDatabase;
49 DelayPeakDetector* delay_peak_detector = new DelayPeakDetector; 51 DelayPeakDetector* delay_peak_detector = new DelayPeakDetector(*tick_timer);
50 DelayManager* delay_manager = 52 DelayManager* delay_manager = new DelayManager(
51 new DelayManager(config.max_packets_in_buffer, delay_peak_detector); 53 config.max_packets_in_buffer, delay_peak_detector, *tick_timer);
52 delay_manager->SetMaximumDelay(config.max_delay_ms); 54 delay_manager->SetMaximumDelay(config.max_delay_ms);
53 DtmfBuffer* dtmf_buffer = new DtmfBuffer(config.sample_rate_hz); 55 DtmfBuffer* dtmf_buffer = new DtmfBuffer(config.sample_rate_hz);
54 DtmfToneGenerator* dtmf_tone_generator = new DtmfToneGenerator; 56 DtmfToneGenerator* dtmf_tone_generator = new DtmfToneGenerator;
55 PacketBuffer* packet_buffer = new PacketBuffer(config.max_packets_in_buffer); 57 PacketBuffer* packet_buffer =
58 new PacketBuffer(config.max_packets_in_buffer, *tick_timer);
56 PayloadSplitter* payload_splitter = new PayloadSplitter; 59 PayloadSplitter* payload_splitter = new PayloadSplitter;
57 TimestampScaler* timestamp_scaler = new TimestampScaler(*decoder_database); 60 TimestampScaler* timestamp_scaler = new TimestampScaler(*decoder_database);
58 AccelerateFactory* accelerate_factory = new AccelerateFactory; 61 AccelerateFactory* accelerate_factory = new AccelerateFactory;
59 ExpandFactory* expand_factory = new ExpandFactory; 62 ExpandFactory* expand_factory = new ExpandFactory;
60 PreemptiveExpandFactory* preemptive_expand_factory = 63 PreemptiveExpandFactory* preemptive_expand_factory =
61 new PreemptiveExpandFactory; 64 new PreemptiveExpandFactory;
62 return new NetEqImpl(config, 65 return new NetEqImpl(config, std::move(tick_timer), buffer_level_filter,
63 buffer_level_filter, 66 decoder_database, delay_manager, delay_peak_detector,
64 decoder_database, 67 dtmf_buffer, dtmf_tone_generator, packet_buffer,
65 delay_manager, 68 payload_splitter, timestamp_scaler, accelerate_factory,
66 delay_peak_detector, 69 expand_factory, preemptive_expand_factory);
67 dtmf_buffer,
68 dtmf_tone_generator,
69 packet_buffer,
70 payload_splitter,
71 timestamp_scaler,
72 accelerate_factory,
73 expand_factory,
74 preemptive_expand_factory);
75 } 70 }
76 71
77 } // namespace webrtc 72 } // namespace webrtc
OLDNEW
« no previous file with comments | « webrtc/modules/audio_coding/neteq/mock/mock_packet_buffer.h ('k') | webrtc/modules/audio_coding/neteq/neteq.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698