1 /* 2 * Copyright (c) 2020 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/voip/voip_engine_factory.h" 12 13 #include <utility> 14 15 #include "audio/voip/voip_core.h" 16 #include "rtc_base/logging.h" 17 18 namespace webrtc { 19 CreateVoipEngine(VoipEngineConfig config)20std::unique_ptr<VoipEngine> CreateVoipEngine(VoipEngineConfig config) { 21 RTC_CHECK(config.encoder_factory); 22 RTC_CHECK(config.decoder_factory); 23 RTC_CHECK(config.task_queue_factory); 24 RTC_CHECK(config.audio_device_module); 25 26 if (!config.audio_processing) { 27 RTC_DLOG(INFO) << "No audio processing functionality provided."; 28 } 29 30 auto voip_core = std::make_unique<VoipCore>(); 31 32 if (!voip_core->Init(std::move(config.encoder_factory), 33 std::move(config.decoder_factory), 34 std::move(config.task_queue_factory), 35 std::move(config.audio_device_module), 36 std::move(config.audio_processing))) { 37 RTC_DLOG(LS_ERROR) << "Failed to initialize VoIP core."; 38 return nullptr; 39 } 40 41 return voip_core; 42 } 43 44 } // namespace webrtc 45