blob: 230731c42df8d2a7f4804e0bb172e3a8cfef7a2e [file] [log] [blame]
Mirko Bonadei79eb4dd2018-07-19 10:39:30 +02001/*
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 09:11:00 -080011#include "api/peer_connection_interface.h"
Jonas Olssona4d87372019-07-05 19:08:33 +020012
Harald Alvestrandf33f7a22021-05-09 14:58:57 +000013#include <utility>
Mirko Bonadei79eb4dd2018-07-19 10:39:30 +020014
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
Steve Anton24db5732018-07-23 10:27:33 -070044RTCError PeerConnectionInterface::RemoveTrackNew(
45 rtc::scoped_refptr<RtpSenderInterface> sender) {
46 return RTCError(RemoveTrack(sender) ? RTCErrorType::NONE
47 : RTCErrorType::INTERNAL_ERROR);
48}
49
Niels Möller2579f0c2019-08-19 09:58:17 +020050RTCError PeerConnectionInterface::SetConfiguration(
Mirko Bonadei79eb4dd2018-07-19 10:39:30 +020051 const PeerConnectionInterface::RTCConfiguration& config) {
Niels Möller2579f0c2019-08-19 09:58:17 +020052 return RTCError();
Mirko Bonadei79eb4dd2018-07-19 10:39:30 +020053}
54
Mirko Bonadei79eb4dd2018-07-19 10:39:30 +020055PeerConnectionDependencies::PeerConnectionDependencies(
56 PeerConnectionObserver* observer_in)
57 : observer(observer_in) {}
58
59PeerConnectionDependencies::PeerConnectionDependencies(
60 PeerConnectionDependencies&&) = default;
61
62PeerConnectionDependencies::~PeerConnectionDependencies() = default;
63
64PeerConnectionFactoryDependencies::PeerConnectionFactoryDependencies() =
65 default;
66
67PeerConnectionFactoryDependencies::PeerConnectionFactoryDependencies(
68 PeerConnectionFactoryDependencies&&) = default;
69
70PeerConnectionFactoryDependencies::~PeerConnectionFactoryDependencies() =
71 default;
72
73rtc::scoped_refptr<PeerConnectionInterface>
74PeerConnectionFactoryInterface::CreatePeerConnection(
75 const PeerConnectionInterface::RTCConfiguration& configuration,
Mirko Bonadei79eb4dd2018-07-19 10:39:30 +020076 std::unique_ptr<cricket::PortAllocator> allocator,
77 std::unique_ptr<rtc::RTCCertificateGeneratorInterface> cert_generator,
78 PeerConnectionObserver* observer) {
Harald Alvestrandf33f7a22021-05-09 14:58:57 +000079 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 Bonadei79eb4dd2018-07-19 10:39:30 +020088}
89
90rtc::scoped_refptr<PeerConnectionInterface>
91PeerConnectionFactoryInterface::CreatePeerConnection(
92 const PeerConnectionInterface::RTCConfiguration& configuration,
93 PeerConnectionDependencies dependencies) {
Harald Alvestrandf33f7a22021-05-09 14:58:57 +000094 auto result =
95 CreatePeerConnectionOrError(configuration, std::move(dependencies));
96 if (!result.ok()) {
97 return nullptr;
98 }
99 return result.MoveValue();
Mirko Bonadei79eb4dd2018-07-19 10:39:30 +0200100}
101
Harald Alvestranda3dd7722020-11-27 08:05:42 +0000102RTCErrorOr<rtc::scoped_refptr<PeerConnectionInterface>>
103PeerConnectionFactoryInterface::CreatePeerConnectionOrError(
104 const PeerConnectionInterface::RTCConfiguration& configuration,
105 PeerConnectionDependencies dependencies) {
106 return RTCError(RTCErrorType::INTERNAL_ERROR);
107}
108
Mirko Bonadei79eb4dd2018-07-19 10:39:30 +0200109RtpCapabilities PeerConnectionFactoryInterface::GetRtpSenderCapabilities(
110 cricket::MediaType kind) const {
111 return {};
112}
113
114RtpCapabilities PeerConnectionFactoryInterface::GetRtpReceiverCapabilities(
115 cricket::MediaType kind) const {
116 return {};
117}
118
Mirko Bonadei79eb4dd2018-07-19 10:39:30 +0200119} // namespace webrtc