Ivo Creusen | 3ce44a3 | 2019-10-31 14:38:11 +0100 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (c) 2019 The WebRTC project authors. All Rights Reserved. |
| 3 | * |
| 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 |
| 6 | * tree. An additional intellectual property rights grant can be found |
| 7 | * in the file PATENTS. All contributing project authors may |
| 8 | * be found in the AUTHORS file in the root of the source tree. |
| 9 | */ |
| 10 | |
| 11 | #include "api/test/neteq_factory_with_codecs.h" |
| 12 | |
| 13 | #include "api/audio_codecs/audio_decoder_factory.h" |
| 14 | #include "api/audio_codecs/builtin_audio_decoder_factory.h" |
| 15 | #include "api/neteq/default_neteq_controller_factory.h" |
| 16 | #include "api/neteq/neteq_controller_factory.h" |
| 17 | #include "api/neteq/neteq_factory.h" |
| 18 | #include "modules/audio_coding/neteq/decision_logic.h" |
| 19 | #include "modules/audio_coding/neteq/neteq_impl.h" |
| 20 | #include "system_wrappers/include/clock.h" |
| 21 | |
| 22 | namespace webrtc { |
| 23 | namespace { |
| 24 | |
| 25 | class NetEqFactoryWithCodecs final : public NetEqFactory { |
| 26 | public: |
| 27 | std::unique_ptr<NetEq> CreateNetEq(const NetEq::Config& config, |
| 28 | Clock* clock) const override { |
| 29 | return std::make_unique<NetEqImpl>( |
| 30 | config, NetEqImpl::Dependencies(config, clock, decoder_factory_, |
| 31 | *controller_factory_)); |
| 32 | } |
| 33 | |
| 34 | private: |
| 35 | const rtc::scoped_refptr<AudioDecoderFactory> decoder_factory_ = |
| 36 | CreateBuiltinAudioDecoderFactory(); |
| 37 | const std::unique_ptr<NetEqControllerFactory> controller_factory_ = |
| 38 | std::make_unique<DefaultNetEqControllerFactory>(); |
| 39 | }; |
| 40 | |
| 41 | } // namespace |
| 42 | |
| 43 | std::unique_ptr<NetEqFactory> CreateNetEqFactoryWithCodecs() { |
| 44 | return std::make_unique<NetEqFactoryWithCodecs>(); |
| 45 | } |
| 46 | |
| 47 | } // namespace webrtc |