zhihuang | 38ede13 | 2017-06-15 19:52:32 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2017 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 | |
Danil Chapovalov | 3d9c368 | 2023-12-05 10:07:54 | [diff] [blame] | 11 | #include "call/create_call.h" |
zhihuang | 38ede13 | 2017-06-15 19:52:32 | [diff] [blame] | 12 | |
| 13 | #include <memory> |
Florent Castelli | 8037fc6 | 2024-08-29 13:00:40 | [diff] [blame] | 14 | #include <optional> |
zhihuang | 38ede13 | 2017-06-15 19:52:32 | [diff] [blame] | 15 | |
Florent Castelli | 8037fc6 | 2024-08-29 13:00:40 | [diff] [blame] | 16 | #include "api/test/simulated_network.h" |
| 17 | #include "api/units/time_delta.h" |
Niels Möller | 8366e17 | 2018-02-14 11:20:13 | [diff] [blame] | 18 | #include "call/call.h" |
| 19 | |
zhihuang | 38ede13 | 2017-06-15 19:52:32 | [diff] [blame] | 20 | namespace webrtc { |
| 21 | |
Tony Herre | 5079e8a | 2024-07-29 05:54:20 | [diff] [blame] | 22 | std::unique_ptr<Call> CreateCall(CallConfig config) { |
Erik Språng | b5cba85c | 2022-02-08 11:35:46 | [diff] [blame] | 23 | std::vector<DegradedCall::TimeScopedNetworkConfig> send_degradation_configs = |
Danil Chapovalov | e79e722 | 2023-12-04 17:53:09 | [diff] [blame] | 24 | GetNetworkConfigs(config.env.field_trials(), /*send=*/true); |
Erik Språng | b5cba85c | 2022-02-08 11:35:46 | [diff] [blame] | 25 | std::vector<DegradedCall::TimeScopedNetworkConfig> |
| 26 | receive_degradation_configs = |
Danil Chapovalov | e79e722 | 2023-12-04 17:53:09 | [diff] [blame] | 27 | GetNetworkConfigs(config.env.field_trials(), /*send=*/false); |
Erik Språng | 0970851 | 2018-03-14 14:16:50 | [diff] [blame] | 28 | |
Tony Herre | 5079e8a | 2024-07-29 05:54:20 | [diff] [blame] | 29 | std::unique_ptr<Call> call = Call::Create(std::move(config)); |
Danil Chapovalov | 80b7c6b | 2022-06-20 17:59:11 | [diff] [blame] | 30 | |
Erik Språng | b5cba85c | 2022-02-08 11:35:46 | [diff] [blame] | 31 | if (!send_degradation_configs.empty() || |
| 32 | !receive_degradation_configs.empty()) { |
Danil Chapovalov | a3ce407 | 2023-10-13 11:53:00 | [diff] [blame] | 33 | return std::make_unique<DegradedCall>( |
| 34 | std::move(call), send_degradation_configs, receive_degradation_configs); |
Erik Språng | 0970851 | 2018-03-14 14:16:50 | [diff] [blame] | 35 | } |
| 36 | |
Danil Chapovalov | 80b7c6b | 2022-06-20 17:59:11 | [diff] [blame] | 37 | return call; |
zhihuang | 38ede13 | 2017-06-15 19:52:32 | [diff] [blame] | 38 | } |
| 39 | |
zhihuang | 38ede13 | 2017-06-15 19:52:32 | [diff] [blame] | 40 | } // namespace webrtc |