| 265 | } |
| 266 | |
| 267 | void RtcPeer::OnSuccess(webrtc::SessionDescriptionInterface *desc) { |
| 268 | std::string sdp; |
| 269 | desc->ToString(&sdp); |
| 270 | |
| 271 | /* An in-bound DataChannel created by the server side will not connect if the SDP is set to |
| 272 | * passive. */ |
| 273 | // modified_sdp_ = ModifySetupAttribute(sdp, "passive"); |
| 274 | modified_sdp_ = sdp; |
| 275 | webrtc::SdpParseError modified_desc_error_; |
| 276 | // Release previous description — PeerConnection took ownership via SetLocalDescription. |
| 277 | modified_desc_.release(); |
| 278 | modified_desc_ = |
| 279 | webrtc::CreateSessionDescription(desc->GetType(), modified_sdp_, &modified_desc_error_); |
| 280 | if (!modified_desc_) { |
| 281 | ERROR_PRINT("Failed to create session description: %s", |
| 282 | modified_desc_error_.description.c_str()); |
| 283 | return; |
| 284 | } |
| 285 | |
| 286 | peer_connection_->SetLocalDescription(SetSessionDescription::Create(nullptr, nullptr).get(), |
| 287 | modified_desc_.get()); |
| 288 | |
| 289 | if (has_candidates_in_sdp_) { |
| 290 | EmitLocalSdp(1); |
| 291 | } else { |
| 292 | EmitLocalSdp(); |
| 293 | } |
| 294 | } |
| 295 | |
| 296 | void RtcPeer::EmitLocalSdp(int delay_sec) { |
| 297 | if (!on_local_sdp_fn_) { |