blob: d01d58d32b92eaa5fc6325562370e873c3fd4930 [file] [log] [blame]
Mirko Bonadei79eb4dd2018-07-19 08:39:301/*
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 Anton10542f22019-01-11 17:11:0011#include "api/peer_connection_interface.h"
Jonas Olssona4d87372019-07-05 17:08:3312
Harald Alvestrandf33f7a22021-05-09 14:58:5713#include <utility>
Mirko Bonadei79eb4dd2018-07-19 08:39:3014
15namespace webrtc {
16
17PeerConnectionInterface::IceServer::IceServer() = default;
18PeerConnectionInterface::IceServer::IceServer(const IceServer& rhs) = default;
19PeerConnectionInterface::IceServer::~IceServer() = default;
20
21PeerConnectionInterface::RTCConfiguration::RTCConfiguration() = default;
22
23PeerConnectionInterface::RTCConfiguration::RTCConfiguration(
24 const RTCConfiguration& rhs) = default;
25
26PeerConnectionInterface::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
42PeerConnectionInterface::RTCConfiguration::~RTCConfiguration() = default;
43
Mirko Bonadei79eb4dd2018-07-19 08:39:3044PeerConnectionDependencies::PeerConnectionDependencies(
45 PeerConnectionObserver* observer_in)
46 : observer(observer_in) {}
47
48PeerConnectionDependencies::PeerConnectionDependencies(
49 PeerConnectionDependencies&&) = default;
50
51PeerConnectionDependencies::~PeerConnectionDependencies() = default;
52
53PeerConnectionFactoryDependencies::PeerConnectionFactoryDependencies() =
54 default;
55
56PeerConnectionFactoryDependencies::PeerConnectionFactoryDependencies(
57 PeerConnectionFactoryDependencies&&) = default;
58
59PeerConnectionFactoryDependencies::~PeerConnectionFactoryDependencies() =
60 default;
61
62rtc::scoped_refptr<PeerConnectionInterface>
63PeerConnectionFactoryInterface::CreatePeerConnection(
64 const PeerConnectionInterface::RTCConfiguration& configuration,
Mirko Bonadei79eb4dd2018-07-19 08:39:3065 std::unique_ptr<cricket::PortAllocator> allocator,
66 std::unique_ptr<rtc::RTCCertificateGeneratorInterface> cert_generator,
67 PeerConnectionObserver* observer) {
Harald Alvestrandf33f7a22021-05-09 14:58:5768 PeerConnectionDependencies dependencies(observer);
69 dependencies.allocator = std::move(allocator);
70 dependencies.cert_generator = std::move(cert_generator);
71 auto result =
72 CreatePeerConnectionOrError(configuration, std::move(dependencies));
73 if (!result.ok()) {
74 return nullptr;
75 }
76 return result.MoveValue();
Mirko Bonadei79eb4dd2018-07-19 08:39:3077}
78
79rtc::scoped_refptr<PeerConnectionInterface>
80PeerConnectionFactoryInterface::CreatePeerConnection(
81 const PeerConnectionInterface::RTCConfiguration& configuration,
82 PeerConnectionDependencies dependencies) {
Harald Alvestrandf33f7a22021-05-09 14:58:5783 auto result =
84 CreatePeerConnectionOrError(configuration, std::move(dependencies));
85 if (!result.ok()) {
86 return nullptr;
87 }
88 return result.MoveValue();
Mirko Bonadei79eb4dd2018-07-19 08:39:3089}
90
Harald Alvestranda3dd7722020-11-27 08:05:4291RTCErrorOr<rtc::scoped_refptr<PeerConnectionInterface>>
92PeerConnectionFactoryInterface::CreatePeerConnectionOrError(
93 const PeerConnectionInterface::RTCConfiguration& configuration,
94 PeerConnectionDependencies dependencies) {
95 return RTCError(RTCErrorType::INTERNAL_ERROR);
96}
97
Mirko Bonadei79eb4dd2018-07-19 08:39:3098RtpCapabilities PeerConnectionFactoryInterface::GetRtpSenderCapabilities(
99 cricket::MediaType kind) const {
100 return {};
101}
102
103RtpCapabilities PeerConnectionFactoryInterface::GetRtpReceiverCapabilities(
104 cricket::MediaType kind) const {
105 return {};
106}
107
Mirko Bonadei79eb4dd2018-07-19 08:39:30108} // namespace webrtc