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 | |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 13 | #include "api/dtls_transport_interface.h" |
Harald Alvestrand | c85328f | 2019-02-28 07:51:00 +0100 | [diff] [blame] | 14 | #include "api/sctp_transport_interface.h" |
Mirko Bonadei | 79eb4dd | 2018-07-19 10:39:30 +0200 | [diff] [blame] | 15 | |
| 16 | namespace webrtc { |
| 17 | |
| 18 | PeerConnectionInterface::IceServer::IceServer() = default; |
| 19 | PeerConnectionInterface::IceServer::IceServer(const IceServer& rhs) = default; |
| 20 | PeerConnectionInterface::IceServer::~IceServer() = default; |
| 21 | |
| 22 | PeerConnectionInterface::RTCConfiguration::RTCConfiguration() = default; |
| 23 | |
| 24 | PeerConnectionInterface::RTCConfiguration::RTCConfiguration( |
| 25 | const RTCConfiguration& rhs) = default; |
| 26 | |
| 27 | PeerConnectionInterface::RTCConfiguration::RTCConfiguration( |
| 28 | RTCConfigurationType type) { |
| 29 | if (type == RTCConfigurationType::kAggressive) { |
| 30 | // These parameters are also defined in Java and IOS configurations, |
| 31 | // so their values may be overwritten by the Java or IOS configuration. |
| 32 | bundle_policy = kBundlePolicyMaxBundle; |
| 33 | rtcp_mux_policy = kRtcpMuxPolicyRequire; |
| 34 | ice_connection_receiving_timeout = kAggressiveIceConnectionReceivingTimeout; |
| 35 | |
| 36 | // These parameters are not defined in Java or IOS configuration, |
| 37 | // so their values will not be overwritten. |
| 38 | enable_ice_renomination = true; |
| 39 | redetermine_role_on_ice_restart = false; |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | PeerConnectionInterface::RTCConfiguration::~RTCConfiguration() = default; |
| 44 | |
| 45 | RTCErrorOr<rtc::scoped_refptr<RtpSenderInterface>> |
| 46 | PeerConnectionInterface::AddTrack( |
| 47 | rtc::scoped_refptr<MediaStreamTrackInterface> track, |
| 48 | const std::vector<std::string>& stream_ids) { |
| 49 | return RTCError(RTCErrorType::UNSUPPORTED_OPERATION, "Not implemented"); |
| 50 | } |
| 51 | |
Steve Anton | 24db573 | 2018-07-23 10:27:33 -0700 | [diff] [blame] | 52 | bool PeerConnectionInterface::RemoveTrack(RtpSenderInterface* sender) { |
| 53 | return RemoveTrackNew(sender).ok(); |
| 54 | } |
| 55 | |
| 56 | RTCError PeerConnectionInterface::RemoveTrackNew( |
| 57 | rtc::scoped_refptr<RtpSenderInterface> sender) { |
| 58 | return RTCError(RemoveTrack(sender) ? RTCErrorType::NONE |
| 59 | : RTCErrorType::INTERNAL_ERROR); |
| 60 | } |
| 61 | |
Mirko Bonadei | 79eb4dd | 2018-07-19 10:39:30 +0200 | [diff] [blame] | 62 | RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>> |
| 63 | PeerConnectionInterface::AddTransceiver( |
| 64 | rtc::scoped_refptr<MediaStreamTrackInterface> track) { |
| 65 | return RTCError(RTCErrorType::INTERNAL_ERROR, "not implemented"); |
| 66 | } |
| 67 | |
| 68 | RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>> |
| 69 | PeerConnectionInterface::AddTransceiver( |
| 70 | rtc::scoped_refptr<MediaStreamTrackInterface> track, |
| 71 | const RtpTransceiverInit& init) { |
| 72 | return RTCError(RTCErrorType::INTERNAL_ERROR, "not implemented"); |
| 73 | } |
| 74 | |
| 75 | RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>> |
| 76 | PeerConnectionInterface::AddTransceiver(cricket::MediaType media_type) { |
| 77 | return RTCError(RTCErrorType::INTERNAL_ERROR, "not implemented"); |
| 78 | } |
| 79 | |
| 80 | RTCErrorOr<rtc::scoped_refptr<RtpTransceiverInterface>> |
| 81 | PeerConnectionInterface::AddTransceiver(cricket::MediaType media_type, |
| 82 | const RtpTransceiverInit& init) { |
| 83 | return RTCError(RTCErrorType::INTERNAL_ERROR, "not implemented"); |
| 84 | } |
| 85 | |
| 86 | rtc::scoped_refptr<RtpSenderInterface> PeerConnectionInterface::CreateSender( |
| 87 | const std::string& kind, |
| 88 | const std::string& stream_id) { |
| 89 | return rtc::scoped_refptr<RtpSenderInterface>(); |
| 90 | } |
| 91 | |
| 92 | std::vector<rtc::scoped_refptr<RtpSenderInterface>> |
| 93 | PeerConnectionInterface::GetSenders() const { |
| 94 | return std::vector<rtc::scoped_refptr<RtpSenderInterface>>(); |
| 95 | } |
| 96 | |
| 97 | std::vector<rtc::scoped_refptr<RtpReceiverInterface>> |
| 98 | PeerConnectionInterface::GetReceivers() const { |
| 99 | return std::vector<rtc::scoped_refptr<RtpReceiverInterface>>(); |
| 100 | } |
| 101 | |
| 102 | std::vector<rtc::scoped_refptr<RtpTransceiverInterface>> |
| 103 | PeerConnectionInterface::GetTransceivers() const { |
Joachim Bauch | 02a454f | 2018-07-27 13:01:21 +0200 | [diff] [blame] | 104 | return std::vector<rtc::scoped_refptr<RtpTransceiverInterface>>(); |
Mirko Bonadei | 79eb4dd | 2018-07-19 10:39:30 +0200 | [diff] [blame] | 105 | } |
| 106 | |
| 107 | const SessionDescriptionInterface* |
| 108 | PeerConnectionInterface::current_local_description() const { |
| 109 | return nullptr; |
| 110 | } |
| 111 | |
| 112 | const SessionDescriptionInterface* |
| 113 | PeerConnectionInterface::current_remote_description() const { |
| 114 | return nullptr; |
| 115 | } |
| 116 | |
| 117 | const SessionDescriptionInterface* |
| 118 | PeerConnectionInterface::pending_local_description() const { |
| 119 | return nullptr; |
| 120 | } |
| 121 | |
| 122 | const SessionDescriptionInterface* |
| 123 | PeerConnectionInterface::pending_remote_description() const { |
| 124 | return nullptr; |
| 125 | } |
| 126 | |
| 127 | PeerConnectionInterface::RTCConfiguration |
| 128 | PeerConnectionInterface::GetConfiguration() { |
| 129 | return PeerConnectionInterface::RTCConfiguration(); |
| 130 | } |
| 131 | |
| 132 | bool PeerConnectionInterface::SetConfiguration( |
| 133 | const PeerConnectionInterface::RTCConfiguration& config, |
| 134 | RTCError* error) { |
| 135 | return false; |
| 136 | } |
| 137 | |
| 138 | bool PeerConnectionInterface::SetConfiguration( |
| 139 | const PeerConnectionInterface::RTCConfiguration& config) { |
| 140 | return false; |
| 141 | } |
| 142 | |
| 143 | bool PeerConnectionInterface::RemoveIceCandidates( |
| 144 | const std::vector<cricket::Candidate>& candidates) { |
| 145 | return false; |
| 146 | } |
| 147 | |
| 148 | RTCError PeerConnectionInterface::SetBitrate(const BitrateSettings& bitrate) { |
| 149 | BitrateParameters bitrate_parameters; |
| 150 | bitrate_parameters.min_bitrate_bps = bitrate.min_bitrate_bps; |
| 151 | bitrate_parameters.current_bitrate_bps = bitrate.start_bitrate_bps; |
| 152 | bitrate_parameters.max_bitrate_bps = bitrate.max_bitrate_bps; |
| 153 | return SetBitrate(bitrate_parameters); |
| 154 | } |
| 155 | |
| 156 | RTCError PeerConnectionInterface::SetBitrate( |
| 157 | const BitrateParameters& bitrate_parameters) { |
| 158 | BitrateSettings bitrate; |
| 159 | bitrate.min_bitrate_bps = bitrate_parameters.min_bitrate_bps; |
| 160 | bitrate.start_bitrate_bps = bitrate_parameters.current_bitrate_bps; |
| 161 | bitrate.max_bitrate_bps = bitrate_parameters.max_bitrate_bps; |
| 162 | return SetBitrate(bitrate); |
| 163 | } |
| 164 | |
Jonas Olsson | 1204690 | 2018-12-06 11:25:14 +0100 | [diff] [blame] | 165 | PeerConnectionInterface::IceConnectionState |
| 166 | PeerConnectionInterface::standardized_ice_connection_state() { |
| 167 | return PeerConnectionInterface::IceConnectionState::kIceConnectionFailed; |
| 168 | } |
| 169 | |
Jonas Olsson | 635474e | 2018-10-18 15:58:17 +0200 | [diff] [blame] | 170 | PeerConnectionInterface::PeerConnectionState |
| 171 | PeerConnectionInterface::peer_connection_state() { |
Jonas Olsson | 1204690 | 2018-12-06 11:25:14 +0100 | [diff] [blame] | 172 | return PeerConnectionInterface::PeerConnectionState::kFailed; |
Jonas Olsson | 635474e | 2018-10-18 15:58:17 +0200 | [diff] [blame] | 173 | } |
| 174 | |
Mirko Bonadei | 79eb4dd | 2018-07-19 10:39:30 +0200 | [diff] [blame] | 175 | bool PeerConnectionInterface::StartRtcEventLog( |
| 176 | std::unique_ptr<RtcEventLogOutput> output, |
| 177 | int64_t output_period_ms) { |
| 178 | return false; |
| 179 | } |
| 180 | |
Niels Möller | f00ca1a | 2019-05-10 11:33:12 +0200 | [diff] [blame] | 181 | bool PeerConnectionInterface::StartRtcEventLog( |
| 182 | std::unique_ptr<RtcEventLogOutput> output) { |
| 183 | return false; |
| 184 | } |
| 185 | |
Harald Alvestrand | ad88c88 | 2018-11-28 16:47:46 +0100 | [diff] [blame] | 186 | rtc::scoped_refptr<DtlsTransportInterface> |
| 187 | PeerConnectionInterface::LookupDtlsTransportByMid(const std::string& mid) { |
Harald Alvestrand | 4139047 | 2018-12-03 18:45:19 +0100 | [diff] [blame] | 188 | RTC_NOTREACHED(); |
Harald Alvestrand | ad88c88 | 2018-11-28 16:47:46 +0100 | [diff] [blame] | 189 | return nullptr; |
| 190 | } |
| 191 | |
Harald Alvestrand | c85328f | 2019-02-28 07:51:00 +0100 | [diff] [blame] | 192 | rtc::scoped_refptr<SctpTransportInterface> |
| 193 | PeerConnectionInterface::GetSctpTransport() const { |
| 194 | RTC_NOTREACHED(); |
| 195 | return nullptr; |
| 196 | } |
| 197 | |
Mirko Bonadei | 79eb4dd | 2018-07-19 10:39:30 +0200 | [diff] [blame] | 198 | PeerConnectionInterface::BitrateParameters::BitrateParameters() = default; |
| 199 | |
| 200 | PeerConnectionInterface::BitrateParameters::~BitrateParameters() = default; |
| 201 | |
| 202 | PeerConnectionDependencies::PeerConnectionDependencies( |
| 203 | PeerConnectionObserver* observer_in) |
| 204 | : observer(observer_in) {} |
| 205 | |
| 206 | PeerConnectionDependencies::PeerConnectionDependencies( |
| 207 | PeerConnectionDependencies&&) = default; |
| 208 | |
| 209 | PeerConnectionDependencies::~PeerConnectionDependencies() = default; |
| 210 | |
| 211 | PeerConnectionFactoryDependencies::PeerConnectionFactoryDependencies() = |
| 212 | default; |
| 213 | |
| 214 | PeerConnectionFactoryDependencies::PeerConnectionFactoryDependencies( |
| 215 | PeerConnectionFactoryDependencies&&) = default; |
| 216 | |
| 217 | PeerConnectionFactoryDependencies::~PeerConnectionFactoryDependencies() = |
| 218 | default; |
| 219 | |
| 220 | rtc::scoped_refptr<PeerConnectionInterface> |
| 221 | PeerConnectionFactoryInterface::CreatePeerConnection( |
| 222 | const PeerConnectionInterface::RTCConfiguration& configuration, |
Mirko Bonadei | 79eb4dd | 2018-07-19 10:39:30 +0200 | [diff] [blame] | 223 | std::unique_ptr<cricket::PortAllocator> allocator, |
| 224 | std::unique_ptr<rtc::RTCCertificateGeneratorInterface> cert_generator, |
| 225 | PeerConnectionObserver* observer) { |
| 226 | return nullptr; |
| 227 | } |
| 228 | |
| 229 | rtc::scoped_refptr<PeerConnectionInterface> |
| 230 | PeerConnectionFactoryInterface::CreatePeerConnection( |
| 231 | const PeerConnectionInterface::RTCConfiguration& configuration, |
| 232 | PeerConnectionDependencies dependencies) { |
| 233 | return nullptr; |
| 234 | } |
| 235 | |
| 236 | RtpCapabilities PeerConnectionFactoryInterface::GetRtpSenderCapabilities( |
| 237 | cricket::MediaType kind) const { |
| 238 | return {}; |
| 239 | } |
| 240 | |
| 241 | RtpCapabilities PeerConnectionFactoryInterface::GetRtpReceiverCapabilities( |
| 242 | cricket::MediaType kind) const { |
| 243 | return {}; |
| 244 | } |
| 245 | |
Mirko Bonadei | 79eb4dd | 2018-07-19 10:39:30 +0200 | [diff] [blame] | 246 | } // namespace webrtc |