Mirko Bonadei | 79eb4dd | 2018-07-19 10:39:30 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2018 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 | |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 11 | #include "api/peer_connection_interface.h" |
Jonas Olsson | a4d8737 | 2019-07-05 19:08:33 +0200 | [diff] [blame] | 12 | |
Harald Alvestrand | f33f7a2 | 2021-05-09 14:58:57 +0000 | [diff] [blame] | 13 | #include <utility> |
Mirko Bonadei | 79eb4dd | 2018-07-19 10:39:30 +0200 | [diff] [blame] | 14 | |
| 15 | namespace webrtc { |
| 16 | |
| 17 | PeerConnectionInterface::IceServer::IceServer() = default; |
| 18 | PeerConnectionInterface::IceServer::IceServer(const IceServer& rhs) = default; |
| 19 | PeerConnectionInterface::IceServer::~IceServer() = default; |
| 20 | |
| 21 | PeerConnectionInterface::RTCConfiguration::RTCConfiguration() = default; |
| 22 | |
| 23 | PeerConnectionInterface::RTCConfiguration::RTCConfiguration( |
| 24 | const RTCConfiguration& rhs) = default; |
| 25 | |
| 26 | PeerConnectionInterface::RTCConfiguration::RTCConfiguration( |
| 27 | RTCConfigurationType type) { |
| 28 | if (type == RTCConfigurationType::kAggressive) { |
| 29 | // These parameters are also defined in Java and IOS configurations, |
| 30 | // so their values may be overwritten by the Java or IOS configuration. |
| 31 | bundle_policy = kBundlePolicyMaxBundle; |
| 32 | rtcp_mux_policy = kRtcpMuxPolicyRequire; |
| 33 | ice_connection_receiving_timeout = kAggressiveIceConnectionReceivingTimeout; |
| 34 | |
| 35 | // These parameters are not defined in Java or IOS configuration, |
| 36 | // so their values will not be overwritten. |
| 37 | enable_ice_renomination = true; |
| 38 | redetermine_role_on_ice_restart = false; |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | PeerConnectionInterface::RTCConfiguration::~RTCConfiguration() = default; |
| 43 | |
Steve Anton | 24db573 | 2018-07-23 10:27:33 -0700 | [diff] [blame] | 44 | RTCError PeerConnectionInterface::RemoveTrackNew( |
| 45 | rtc::scoped_refptr<RtpSenderInterface> sender) { |
| 46 | return RTCError(RemoveTrack(sender) ? RTCErrorType::NONE |
| 47 | : RTCErrorType::INTERNAL_ERROR); |
| 48 | } |
| 49 | |
Niels Möller | 2579f0c | 2019-08-19 09:58:17 +0200 | [diff] [blame] | 50 | RTCError PeerConnectionInterface::SetConfiguration( |
Mirko Bonadei | 79eb4dd | 2018-07-19 10:39:30 +0200 | [diff] [blame] | 51 | const PeerConnectionInterface::RTCConfiguration& config) { |
Niels Möller | 2579f0c | 2019-08-19 09:58:17 +0200 | [diff] [blame] | 52 | return RTCError(); |
Mirko Bonadei | 79eb4dd | 2018-07-19 10:39:30 +0200 | [diff] [blame] | 53 | } |
| 54 | |
Mirko Bonadei | 79eb4dd | 2018-07-19 10:39:30 +0200 | [diff] [blame] | 55 | PeerConnectionDependencies::PeerConnectionDependencies( |
| 56 | PeerConnectionObserver* observer_in) |
| 57 | : observer(observer_in) {} |
| 58 | |
| 59 | PeerConnectionDependencies::PeerConnectionDependencies( |
| 60 | PeerConnectionDependencies&&) = default; |
| 61 | |
| 62 | PeerConnectionDependencies::~PeerConnectionDependencies() = default; |
| 63 | |
| 64 | PeerConnectionFactoryDependencies::PeerConnectionFactoryDependencies() = |
| 65 | default; |
| 66 | |
| 67 | PeerConnectionFactoryDependencies::PeerConnectionFactoryDependencies( |
| 68 | PeerConnectionFactoryDependencies&&) = default; |
| 69 | |
| 70 | PeerConnectionFactoryDependencies::~PeerConnectionFactoryDependencies() = |
| 71 | default; |
| 72 | |
| 73 | rtc::scoped_refptr<PeerConnectionInterface> |
| 74 | PeerConnectionFactoryInterface::CreatePeerConnection( |
| 75 | const PeerConnectionInterface::RTCConfiguration& configuration, |
Mirko Bonadei | 79eb4dd | 2018-07-19 10:39:30 +0200 | [diff] [blame] | 76 | std::unique_ptr<cricket::PortAllocator> allocator, |
| 77 | std::unique_ptr<rtc::RTCCertificateGeneratorInterface> cert_generator, |
| 78 | PeerConnectionObserver* observer) { |
Harald Alvestrand | f33f7a2 | 2021-05-09 14:58:57 +0000 | [diff] [blame] | 79 | PeerConnectionDependencies dependencies(observer); |
| 80 | dependencies.allocator = std::move(allocator); |
| 81 | dependencies.cert_generator = std::move(cert_generator); |
| 82 | auto result = |
| 83 | CreatePeerConnectionOrError(configuration, std::move(dependencies)); |
| 84 | if (!result.ok()) { |
| 85 | return nullptr; |
| 86 | } |
| 87 | return result.MoveValue(); |
Mirko Bonadei | 79eb4dd | 2018-07-19 10:39:30 +0200 | [diff] [blame] | 88 | } |
| 89 | |
| 90 | rtc::scoped_refptr<PeerConnectionInterface> |
| 91 | PeerConnectionFactoryInterface::CreatePeerConnection( |
| 92 | const PeerConnectionInterface::RTCConfiguration& configuration, |
| 93 | PeerConnectionDependencies dependencies) { |
Harald Alvestrand | f33f7a2 | 2021-05-09 14:58:57 +0000 | [diff] [blame] | 94 | auto result = |
| 95 | CreatePeerConnectionOrError(configuration, std::move(dependencies)); |
| 96 | if (!result.ok()) { |
| 97 | return nullptr; |
| 98 | } |
| 99 | return result.MoveValue(); |
Mirko Bonadei | 79eb4dd | 2018-07-19 10:39:30 +0200 | [diff] [blame] | 100 | } |
| 101 | |
Harald Alvestrand | a3dd772 | 2020-11-27 08:05:42 +0000 | [diff] [blame] | 102 | RTCErrorOr<rtc::scoped_refptr<PeerConnectionInterface>> |
| 103 | PeerConnectionFactoryInterface::CreatePeerConnectionOrError( |
| 104 | const PeerConnectionInterface::RTCConfiguration& configuration, |
| 105 | PeerConnectionDependencies dependencies) { |
| 106 | return RTCError(RTCErrorType::INTERNAL_ERROR); |
| 107 | } |
| 108 | |
Mirko Bonadei | 79eb4dd | 2018-07-19 10:39:30 +0200 | [diff] [blame] | 109 | RtpCapabilities PeerConnectionFactoryInterface::GetRtpSenderCapabilities( |
| 110 | cricket::MediaType kind) const { |
| 111 | return {}; |
| 112 | } |
| 113 | |
| 114 | RtpCapabilities PeerConnectionFactoryInterface::GetRtpReceiverCapabilities( |
| 115 | cricket::MediaType kind) const { |
| 116 | return {}; |
| 117 | } |
| 118 | |
Mirko Bonadei | 79eb4dd | 2018-07-19 10:39:30 +0200 | [diff] [blame] | 119 | } // namespace webrtc |