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