| OLD | NEW |
| 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/neteq_impl.h" | 11 #include "webrtc/modules/audio_coding/neteq/neteq_impl.h" |
| 12 | 12 |
| 13 #include <assert.h> | 13 #include <assert.h> |
| 14 #include <memory.h> // memset | 14 #include <memory.h> // memset |
| 15 | 15 |
| 16 #include <algorithm> | 16 #include <algorithm> |
| 17 #include <vector> | 17 #include <vector> |
| 18 | 18 |
| 19 #include "webrtc/base/checks.h" | 19 #include "webrtc/base/checks.h" |
| 20 #include "webrtc/base/logging.h" | 20 #include "webrtc/base/logging.h" |
| 21 #include "webrtc/base/safe_conversions.h" | 21 #include "webrtc/base/safe_conversions.h" |
| 22 #include "webrtc/base/trace_event.h" | 22 #include "webrtc/base/trace_event.h" |
| 23 #include "webrtc/common_audio/signal_processing/include/signal_processing_librar
y.h" | 23 #include "webrtc/common_audio/signal_processing/include/signal_processing_librar
y.h" |
| 24 #include "webrtc/modules/audio_coding/codecs/audio_decoder.h" | 24 #include "webrtc/modules/audio_coding/codecs/audio_decoder.h" |
| 25 #include "webrtc/modules/audio_coding/codecs/builtin_audio_decoder_factory.h" | |
| 26 #include "webrtc/modules/audio_coding/neteq/accelerate.h" | 25 #include "webrtc/modules/audio_coding/neteq/accelerate.h" |
| 27 #include "webrtc/modules/audio_coding/neteq/background_noise.h" | 26 #include "webrtc/modules/audio_coding/neteq/background_noise.h" |
| 28 #include "webrtc/modules/audio_coding/neteq/buffer_level_filter.h" | 27 #include "webrtc/modules/audio_coding/neteq/buffer_level_filter.h" |
| 29 #include "webrtc/modules/audio_coding/neteq/comfort_noise.h" | 28 #include "webrtc/modules/audio_coding/neteq/comfort_noise.h" |
| 30 #include "webrtc/modules/audio_coding/neteq/decision_logic.h" | 29 #include "webrtc/modules/audio_coding/neteq/decision_logic.h" |
| 31 #include "webrtc/modules/audio_coding/neteq/decoder_database.h" | 30 #include "webrtc/modules/audio_coding/neteq/decoder_database.h" |
| 32 #include "webrtc/modules/audio_coding/neteq/defines.h" | 31 #include "webrtc/modules/audio_coding/neteq/defines.h" |
| 33 #include "webrtc/modules/audio_coding/neteq/delay_manager.h" | 32 #include "webrtc/modules/audio_coding/neteq/delay_manager.h" |
| 34 #include "webrtc/modules/audio_coding/neteq/delay_peak_detector.h" | 33 #include "webrtc/modules/audio_coding/neteq/delay_peak_detector.h" |
| 35 #include "webrtc/modules/audio_coding/neteq/dtmf_buffer.h" | 34 #include "webrtc/modules/audio_coding/neteq/dtmf_buffer.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 48 #include "webrtc/modules/audio_coding/neteq/timestamp_scaler.h" | 47 #include "webrtc/modules/audio_coding/neteq/timestamp_scaler.h" |
| 49 #include "webrtc/modules/include/module_common_types.h" | 48 #include "webrtc/modules/include/module_common_types.h" |
| 50 | 49 |
| 51 // Modify the code to obtain backwards bit-exactness. Once bit-exactness is no | 50 // Modify the code to obtain backwards bit-exactness. Once bit-exactness is no |
| 52 // longer required, this #define should be removed (and the code that it | 51 // longer required, this #define should be removed (and the code that it |
| 53 // enables). | 52 // enables). |
| 54 #define LEGACY_BITEXACT | 53 #define LEGACY_BITEXACT |
| 55 | 54 |
| 56 namespace webrtc { | 55 namespace webrtc { |
| 57 | 56 |
| 58 NetEqImpl::Dependencies::Dependencies(const NetEq::Config& config) | 57 NetEqImpl::Dependencies::Dependencies( |
| 58 const NetEq::Config& config, |
| 59 std::shared_ptr<AudioDecoderFactory> decoder_factory) |
| 59 : tick_timer(new TickTimer), | 60 : tick_timer(new TickTimer), |
| 60 buffer_level_filter(new BufferLevelFilter), | 61 buffer_level_filter(new BufferLevelFilter), |
| 61 decoder_database(new DecoderDatabase(CreateBuiltinAudioDecoderFactory())), | 62 decoder_database(new DecoderDatabase(std::move(decoder_factory))), |
| 62 delay_peak_detector(new DelayPeakDetector(tick_timer.get())), | 63 delay_peak_detector(new DelayPeakDetector(tick_timer.get())), |
| 63 delay_manager(new DelayManager(config.max_packets_in_buffer, | 64 delay_manager(new DelayManager(config.max_packets_in_buffer, |
| 64 delay_peak_detector.get(), | 65 delay_peak_detector.get(), |
| 65 tick_timer.get())), | 66 tick_timer.get())), |
| 66 dtmf_buffer(new DtmfBuffer(config.sample_rate_hz)), | 67 dtmf_buffer(new DtmfBuffer(config.sample_rate_hz)), |
| 67 dtmf_tone_generator(new DtmfToneGenerator), | 68 dtmf_tone_generator(new DtmfToneGenerator), |
| 68 packet_buffer( | 69 packet_buffer( |
| 69 new PacketBuffer(config.max_packets_in_buffer, tick_timer.get())), | 70 new PacketBuffer(config.max_packets_in_buffer, tick_timer.get())), |
| 70 payload_splitter(new PayloadSplitter), | 71 payload_splitter(new PayloadSplitter), |
| 71 timestamp_scaler(new TimestampScaler(*decoder_database)), | 72 timestamp_scaler(new TimestampScaler(*decoder_database)), |
| (...skipping 2049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2121 | 2122 |
| 2122 void NetEqImpl::CreateDecisionLogic() { | 2123 void NetEqImpl::CreateDecisionLogic() { |
| 2123 decision_logic_.reset(DecisionLogic::Create(fs_hz_, output_size_samples_, | 2124 decision_logic_.reset(DecisionLogic::Create(fs_hz_, output_size_samples_, |
| 2124 playout_mode_, | 2125 playout_mode_, |
| 2125 decoder_database_.get(), | 2126 decoder_database_.get(), |
| 2126 *packet_buffer_.get(), | 2127 *packet_buffer_.get(), |
| 2127 delay_manager_.get(), | 2128 delay_manager_.get(), |
| 2128 buffer_level_filter_.get())); | 2129 buffer_level_filter_.get())); |
| 2129 } | 2130 } |
| 2130 } // namespace webrtc | 2131 } // namespace webrtc |
| OLD | NEW |