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