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