| OLD | NEW |
| 1 /* | 1 /* |
| 2 * libjingle | 2 * libjingle |
| 3 * Copyright 2013 Google Inc. | 3 * Copyright 2013 Google Inc. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
| 9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 MediaSessionOptions::Streams sorted_streams = streams; | 61 MediaSessionOptions::Streams sorted_streams = streams; |
| 62 std::sort(sorted_streams.begin(), sorted_streams.end(), CompareStream); | 62 std::sort(sorted_streams.begin(), sorted_streams.end(), CompareStream); |
| 63 MediaSessionOptions::Streams::iterator it = | 63 MediaSessionOptions::Streams::iterator it = |
| 64 std::adjacent_find(sorted_streams.begin(), sorted_streams.end(), | 64 std::adjacent_find(sorted_streams.begin(), sorted_streams.end(), |
| 65 SameId); | 65 SameId); |
| 66 return it == sorted_streams.end(); | 66 return it == sorted_streams.end(); |
| 67 } | 67 } |
| 68 | 68 |
| 69 enum { | 69 enum { |
| 70 MSG_CREATE_SESSIONDESCRIPTION_SUCCESS, | 70 MSG_CREATE_SESSIONDESCRIPTION_SUCCESS, |
| 71 MSG_CREATE_SESSIONDESCRIPTION_FAILED | 71 MSG_CREATE_SESSIONDESCRIPTION_FAILED, |
| 72 MSG_USE_CONSTRUCTOR_CERTIFICATE |
| 72 }; | 73 }; |
| 73 | 74 |
| 74 struct CreateSessionDescriptionMsg : public rtc::MessageData { | 75 struct CreateSessionDescriptionMsg : public rtc::MessageData { |
| 75 explicit CreateSessionDescriptionMsg( | 76 explicit CreateSessionDescriptionMsg( |
| 76 webrtc::CreateSessionDescriptionObserver* observer) | 77 webrtc::CreateSessionDescriptionObserver* observer) |
| 77 : observer(observer) { | 78 : observer(observer) { |
| 78 } | 79 } |
| 79 | 80 |
| 80 rtc::scoped_refptr<webrtc::CreateSessionDescriptionObserver> observer; | 81 rtc::scoped_refptr<webrtc::CreateSessionDescriptionObserver> observer; |
| 81 std::string error; | 82 std::string error; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 source_desc->candidates(m); | 120 source_desc->candidates(m); |
| 120 const IceCandidateCollection* dest_candidates = dest_desc->candidates(m); | 121 const IceCandidateCollection* dest_candidates = dest_desc->candidates(m); |
| 121 for (size_t n = 0; n < source_candidates->count(); ++n) { | 122 for (size_t n = 0; n < source_candidates->count(); ++n) { |
| 122 const IceCandidateInterface* new_candidate = source_candidates->at(n); | 123 const IceCandidateInterface* new_candidate = source_candidates->at(n); |
| 123 if (!dest_candidates->HasCandidate(new_candidate)) | 124 if (!dest_candidates->HasCandidate(new_candidate)) |
| 124 dest_desc->AddCandidate(source_candidates->at(n)); | 125 dest_desc->AddCandidate(source_candidates->at(n)); |
| 125 } | 126 } |
| 126 } | 127 } |
| 127 } | 128 } |
| 128 | 129 |
| 130 // Private constructor called by other constructors. |
| 129 WebRtcSessionDescriptionFactory::WebRtcSessionDescriptionFactory( | 131 WebRtcSessionDescriptionFactory::WebRtcSessionDescriptionFactory( |
| 130 rtc::Thread* signaling_thread, | 132 rtc::Thread* signaling_thread, |
| 131 cricket::ChannelManager* channel_manager, | 133 cricket::ChannelManager* channel_manager, |
| 132 MediaStreamSignaling* mediastream_signaling, | 134 MediaStreamSignaling* mediastream_signaling, |
| 133 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store, | 135 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store, |
| 136 const rtc::scoped_refptr<WebRtcIdentityRequestObserver>& |
| 137 identity_request_observer, |
| 134 WebRtcSession* session, | 138 WebRtcSession* session, |
| 135 const std::string& session_id, | 139 const std::string& session_id, |
| 136 cricket::DataChannelType dct, | 140 cricket::DataChannelType dct, |
| 137 bool dtls_enabled) | 141 bool dtls_enabled) |
| 138 : signaling_thread_(signaling_thread), | 142 : signaling_thread_(signaling_thread), |
| 139 mediastream_signaling_(mediastream_signaling), | 143 mediastream_signaling_(mediastream_signaling), |
| 140 session_desc_factory_(channel_manager, &transport_desc_factory_), | 144 session_desc_factory_(channel_manager, &transport_desc_factory_), |
| 141 // RFC 4566 suggested a Network Time Protocol (NTP) format timestamp | 145 // RFC 4566 suggested a Network Time Protocol (NTP) format timestamp |
| 142 // as the session id and session version. To simplify, it should be fine | 146 // as the session id and session version. To simplify, it should be fine |
| 143 // to just use a random number as session id and start version from | 147 // to just use a random number as session id and start version from |
| 144 // |kInitSessionVersion|. | 148 // |kInitSessionVersion|. |
| 145 session_version_(kInitSessionVersion), | 149 session_version_(kInitSessionVersion), |
| 146 dtls_identity_store_(dtls_identity_store.Pass()), | 150 dtls_identity_store_(dtls_identity_store.Pass()), |
| 151 identity_request_observer_(identity_request_observer), |
| 147 session_(session), | 152 session_(session), |
| 148 session_id_(session_id), | 153 session_id_(session_id), |
| 149 data_channel_type_(dct), | 154 data_channel_type_(dct), |
| 150 identity_request_state_(IDENTITY_NOT_NEEDED) { | 155 certificate_request_state_(CERTIFICATE_NOT_NEEDED) { |
| 151 session_desc_factory_.set_add_legacy_streams(false); | 156 session_desc_factory_.set_add_legacy_streams(false); |
| 152 // SRTP-SDES is disabled if DTLS is on. | 157 // SRTP-SDES is disabled if DTLS is on. |
| 153 SetSdesPolicy(dtls_enabled ? cricket::SEC_DISABLED : cricket::SEC_REQUIRED); | 158 SetSdesPolicy(dtls_enabled ? cricket::SEC_DISABLED : cricket::SEC_REQUIRED); |
| 159 } |
| 154 | 160 |
| 155 // If |dtls_enabled| we must have a |dtls_identity_store_|. | 161 WebRtcSessionDescriptionFactory::WebRtcSessionDescriptionFactory( |
| 156 DCHECK(!dtls_enabled || dtls_identity_store_); | 162 rtc::Thread* signaling_thread, |
| 163 cricket::ChannelManager* channel_manager, |
| 164 MediaStreamSignaling* mediastream_signaling, |
| 165 WebRtcSession* session, |
| 166 const std::string& session_id, |
| 167 cricket::DataChannelType dct) |
| 168 : WebRtcSessionDescriptionFactory( |
| 169 signaling_thread, channel_manager, mediastream_signaling, nullptr, |
| 170 nullptr, session, session_id, dct, false) { |
| 171 LOG(LS_VERBOSE) << "DTLS-SRTP disabled."; |
| 172 } |
| 157 | 173 |
| 158 if (dtls_enabled && dtls_identity_store_) { | 174 WebRtcSessionDescriptionFactory::WebRtcSessionDescriptionFactory( |
| 159 identity_request_observer_ = | 175 rtc::Thread* signaling_thread, |
| 160 new rtc::RefCountedObject<WebRtcIdentityRequestObserver>(); | 176 cricket::ChannelManager* channel_manager, |
| 177 MediaStreamSignaling* mediastream_signaling, |
| 178 rtc::scoped_ptr<DtlsIdentityStoreInterface> dtls_identity_store, |
| 179 WebRtcSession* session, |
| 180 const std::string& session_id, |
| 181 cricket::DataChannelType dct) |
| 182 : WebRtcSessionDescriptionFactory( |
| 183 signaling_thread, |
| 184 channel_manager, |
| 185 mediastream_signaling, |
| 186 dtls_identity_store.Pass(), |
| 187 new rtc::RefCountedObject<WebRtcIdentityRequestObserver>(), |
| 188 session, |
| 189 session_id, |
| 190 dct, |
| 191 true) { |
| 192 DCHECK(dtls_identity_store_); |
| 161 | 193 |
| 162 identity_request_observer_->SignalRequestFailed.connect( | 194 certificate_request_state_ = CERTIFICATE_WAITING; |
| 163 this, &WebRtcSessionDescriptionFactory::OnIdentityRequestFailed); | |
| 164 identity_request_observer_->SignalIdentityReady.connect( | |
| 165 this, &WebRtcSessionDescriptionFactory::SetIdentity); | |
| 166 | 195 |
| 167 LOG(LS_VERBOSE) << "DTLS-SRTP enabled; sending DTLS identity request."; | 196 identity_request_observer_->SignalRequestFailed.connect( |
| 168 identity_request_state_ = IDENTITY_WAITING; | 197 this, &WebRtcSessionDescriptionFactory::OnIdentityRequestFailed); |
| 169 dtls_identity_store_->RequestIdentity(rtc::KT_DEFAULT, | 198 identity_request_observer_->SignalIdentityReady.connect( |
| 170 identity_request_observer_); | 199 this, &WebRtcSessionDescriptionFactory::SetIdentity); |
| 171 } | 200 |
| 201 rtc::KeyType key_type = rtc::KT_DEFAULT; |
| 202 LOG(LS_VERBOSE) << "DTLS-SRTP enabled; sending DTLS identity request (key " |
| 203 << "type: " << key_type << ")."; |
| 204 |
| 205 // Request identity. This happens asynchronously, so the caller will have a |
| 206 // chance to connect to SignalIdentityReady. |
| 207 dtls_identity_store_->RequestIdentity(key_type, identity_request_observer_); |
| 208 } |
| 209 |
| 210 WebRtcSessionDescriptionFactory::WebRtcSessionDescriptionFactory( |
| 211 rtc::Thread* signaling_thread, |
| 212 cricket::ChannelManager* channel_manager, |
| 213 MediaStreamSignaling* mediastream_signaling, |
| 214 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate, |
| 215 WebRtcSession* session, |
| 216 const std::string& session_id, |
| 217 cricket::DataChannelType dct) |
| 218 : WebRtcSessionDescriptionFactory( |
| 219 signaling_thread, channel_manager, mediastream_signaling, nullptr, |
| 220 nullptr, session, session_id, dct, true) { |
| 221 DCHECK(certificate); |
| 222 |
| 223 certificate_request_state_ = CERTIFICATE_WAITING; |
| 224 |
| 225 LOG(LS_VERBOSE) << "DTLS-SRTP enabled; has certificate parameter."; |
| 226 // We already have a certificate but we wait to do SetIdentity; if we do |
| 227 // it in the constructor then the caller has not had a chance to connect to |
| 228 // SignalIdentityReady. |
| 229 signaling_thread_->Post(this, MSG_USE_CONSTRUCTOR_CERTIFICATE, |
| 230 new rtc::ScopedRefMessageData<rtc::RTCCertificate>( |
| 231 certificate)); |
| 172 } | 232 } |
| 173 | 233 |
| 174 WebRtcSessionDescriptionFactory::~WebRtcSessionDescriptionFactory() { | 234 WebRtcSessionDescriptionFactory::~WebRtcSessionDescriptionFactory() { |
| 175 ASSERT(signaling_thread_->IsCurrent()); | 235 ASSERT(signaling_thread_->IsCurrent()); |
| 176 | 236 |
| 177 // Fail any requests that were asked for before identity generation completed. | 237 // Fail any requests that were asked for before identity generation completed. |
| 178 FailPendingRequests(kFailedDueToSessionShutdown); | 238 FailPendingRequests(kFailedDueToSessionShutdown); |
| 179 | 239 |
| 180 // Process all pending notifications in the message queue. If we don't do | 240 // Process all pending notifications in the message queue. If we don't do |
| 181 // this, requests will linger and not know they succeeded or failed. | 241 // this, requests will linger and not know they succeeded or failed. |
| 182 rtc::MessageList list; | 242 rtc::MessageList list; |
| 183 signaling_thread_->Clear(this, rtc::MQID_ANY, &list); | 243 signaling_thread_->Clear(this, rtc::MQID_ANY, &list); |
| 184 for (auto& msg : list) | 244 for (auto& msg : list) { |
| 185 OnMessage(&msg); | 245 if (msg.message_id != MSG_USE_CONSTRUCTOR_CERTIFICATE) { |
| 246 OnMessage(&msg); |
| 247 } else { |
| 248 // Skip MSG_USE_CONSTRUCTOR_CERTIFICATE because we don't want to trigger |
| 249 // SetIdentity-related callbacks in the destructor. This can be a problem |
| 250 // when WebRtcSession listens to the callback but it was the WebRtcSession |
| 251 // destructor that caused WebRtcSessionDescriptionFactory's destruction. |
| 252 // The callback is then ignored, leaking memory allocated by OnMessage for |
| 253 // MSG_USE_CONSTRUCTOR_CERTIFICATE. |
| 254 delete msg.pdata; |
| 255 } |
| 256 } |
| 186 | 257 |
| 187 transport_desc_factory_.set_identity(NULL); | 258 transport_desc_factory_.set_identity(NULL); |
| 188 } | 259 } |
| 189 | 260 |
| 190 void WebRtcSessionDescriptionFactory::CreateOffer( | 261 void WebRtcSessionDescriptionFactory::CreateOffer( |
| 191 CreateSessionDescriptionObserver* observer, | 262 CreateSessionDescriptionObserver* observer, |
| 192 const PeerConnectionInterface::RTCOfferAnswerOptions& options) { | 263 const PeerConnectionInterface::RTCOfferAnswerOptions& options) { |
| 193 cricket::MediaSessionOptions session_options; | 264 cricket::MediaSessionOptions session_options; |
| 194 | 265 |
| 195 std::string error = "CreateOffer"; | 266 std::string error = "CreateOffer"; |
| 196 if (identity_request_state_ == IDENTITY_FAILED) { | 267 if (certificate_request_state_ == CERTIFICATE_FAILED) { |
| 197 error += kFailedDueToIdentityFailed; | 268 error += kFailedDueToIdentityFailed; |
| 198 LOG(LS_ERROR) << error; | 269 LOG(LS_ERROR) << error; |
| 199 PostCreateSessionDescriptionFailed(observer, error); | 270 PostCreateSessionDescriptionFailed(observer, error); |
| 200 return; | 271 return; |
| 201 } | 272 } |
| 202 | 273 |
| 203 if (!mediastream_signaling_->GetOptionsForOffer(options, | 274 if (!mediastream_signaling_->GetOptionsForOffer(options, |
| 204 &session_options)) { | 275 &session_options)) { |
| 205 error += " called with invalid options."; | 276 error += " called with invalid options."; |
| 206 LOG(LS_ERROR) << error; | 277 LOG(LS_ERROR) << error; |
| 207 PostCreateSessionDescriptionFailed(observer, error); | 278 PostCreateSessionDescriptionFailed(observer, error); |
| 208 return; | 279 return; |
| 209 } | 280 } |
| 210 | 281 |
| 211 if (!ValidStreams(session_options.streams)) { | 282 if (!ValidStreams(session_options.streams)) { |
| 212 error += " called with invalid media streams."; | 283 error += " called with invalid media streams."; |
| 213 LOG(LS_ERROR) << error; | 284 LOG(LS_ERROR) << error; |
| 214 PostCreateSessionDescriptionFailed(observer, error); | 285 PostCreateSessionDescriptionFailed(observer, error); |
| 215 return; | 286 return; |
| 216 } | 287 } |
| 217 | 288 |
| 218 if (data_channel_type_ == cricket::DCT_SCTP && | 289 if (data_channel_type_ == cricket::DCT_SCTP && |
| 219 mediastream_signaling_->HasDataChannels()) { | 290 mediastream_signaling_->HasDataChannels()) { |
| 220 session_options.data_channel_type = cricket::DCT_SCTP; | 291 session_options.data_channel_type = cricket::DCT_SCTP; |
| 221 } | 292 } |
| 222 | 293 |
| 223 CreateSessionDescriptionRequest request( | 294 CreateSessionDescriptionRequest request( |
| 224 CreateSessionDescriptionRequest::kOffer, observer, session_options); | 295 CreateSessionDescriptionRequest::kOffer, observer, session_options); |
| 225 if (identity_request_state_ == IDENTITY_WAITING) { | 296 if (certificate_request_state_ == CERTIFICATE_WAITING) { |
| 226 create_session_description_requests_.push(request); | 297 create_session_description_requests_.push(request); |
| 227 } else { | 298 } else { |
| 228 ASSERT(identity_request_state_ == IDENTITY_SUCCEEDED || | 299 ASSERT(certificate_request_state_ == CERTIFICATE_SUCCEEDED || |
| 229 identity_request_state_ == IDENTITY_NOT_NEEDED); | 300 certificate_request_state_ == CERTIFICATE_NOT_NEEDED); |
| 230 InternalCreateOffer(request); | 301 InternalCreateOffer(request); |
| 231 } | 302 } |
| 232 } | 303 } |
| 233 | 304 |
| 234 void WebRtcSessionDescriptionFactory::CreateAnswer( | 305 void WebRtcSessionDescriptionFactory::CreateAnswer( |
| 235 CreateSessionDescriptionObserver* observer, | 306 CreateSessionDescriptionObserver* observer, |
| 236 const MediaConstraintsInterface* constraints) { | 307 const MediaConstraintsInterface* constraints) { |
| 237 std::string error = "CreateAnswer"; | 308 std::string error = "CreateAnswer"; |
| 238 if (identity_request_state_ == IDENTITY_FAILED) { | 309 if (certificate_request_state_ == CERTIFICATE_FAILED) { |
| 239 error += kFailedDueToIdentityFailed; | 310 error += kFailedDueToIdentityFailed; |
| 240 LOG(LS_ERROR) << error; | 311 LOG(LS_ERROR) << error; |
| 241 PostCreateSessionDescriptionFailed(observer, error); | 312 PostCreateSessionDescriptionFailed(observer, error); |
| 242 return; | 313 return; |
| 243 } | 314 } |
| 244 if (!session_->remote_description()) { | 315 if (!session_->remote_description()) { |
| 245 error += " can't be called before SetRemoteDescription."; | 316 error += " can't be called before SetRemoteDescription."; |
| 246 LOG(LS_ERROR) << error; | 317 LOG(LS_ERROR) << error; |
| 247 PostCreateSessionDescriptionFailed(observer, error); | 318 PostCreateSessionDescriptionFailed(observer, error); |
| 248 return; | 319 return; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 270 } | 341 } |
| 271 // RTP data channel is handled in MediaSessionOptions::AddStream. SCTP streams | 342 // RTP data channel is handled in MediaSessionOptions::AddStream. SCTP streams |
| 272 // are not signaled in the SDP so does not go through that path and must be | 343 // are not signaled in the SDP so does not go through that path and must be |
| 273 // handled here. | 344 // handled here. |
| 274 if (data_channel_type_ == cricket::DCT_SCTP) { | 345 if (data_channel_type_ == cricket::DCT_SCTP) { |
| 275 options.data_channel_type = cricket::DCT_SCTP; | 346 options.data_channel_type = cricket::DCT_SCTP; |
| 276 } | 347 } |
| 277 | 348 |
| 278 CreateSessionDescriptionRequest request( | 349 CreateSessionDescriptionRequest request( |
| 279 CreateSessionDescriptionRequest::kAnswer, observer, options); | 350 CreateSessionDescriptionRequest::kAnswer, observer, options); |
| 280 if (identity_request_state_ == IDENTITY_WAITING) { | 351 if (certificate_request_state_ == CERTIFICATE_WAITING) { |
| 281 create_session_description_requests_.push(request); | 352 create_session_description_requests_.push(request); |
| 282 } else { | 353 } else { |
| 283 ASSERT(identity_request_state_ == IDENTITY_SUCCEEDED || | 354 ASSERT(certificate_request_state_ == CERTIFICATE_SUCCEEDED || |
| 284 identity_request_state_ == IDENTITY_NOT_NEEDED); | 355 certificate_request_state_ == CERTIFICATE_NOT_NEEDED); |
| 285 InternalCreateAnswer(request); | 356 InternalCreateAnswer(request); |
| 286 } | 357 } |
| 287 } | 358 } |
| 288 | 359 |
| 289 void WebRtcSessionDescriptionFactory::SetSdesPolicy( | 360 void WebRtcSessionDescriptionFactory::SetSdesPolicy( |
| 290 cricket::SecurePolicy secure_policy) { | 361 cricket::SecurePolicy secure_policy) { |
| 291 session_desc_factory_.set_secure(secure_policy); | 362 session_desc_factory_.set_secure(secure_policy); |
| 292 } | 363 } |
| 293 | 364 |
| 294 cricket::SecurePolicy WebRtcSessionDescriptionFactory::SdesPolicy() const { | 365 cricket::SecurePolicy WebRtcSessionDescriptionFactory::SdesPolicy() const { |
| 295 return session_desc_factory_.secure(); | 366 return session_desc_factory_.secure(); |
| 296 } | 367 } |
| 297 | 368 |
| 298 void WebRtcSessionDescriptionFactory::OnMessage(rtc::Message* msg) { | 369 void WebRtcSessionDescriptionFactory::OnMessage(rtc::Message* msg) { |
| 299 switch (msg->message_id) { | 370 switch (msg->message_id) { |
| 300 case MSG_CREATE_SESSIONDESCRIPTION_SUCCESS: { | 371 case MSG_CREATE_SESSIONDESCRIPTION_SUCCESS: { |
| 301 CreateSessionDescriptionMsg* param = | 372 CreateSessionDescriptionMsg* param = |
| 302 static_cast<CreateSessionDescriptionMsg*>(msg->pdata); | 373 static_cast<CreateSessionDescriptionMsg*>(msg->pdata); |
| 303 param->observer->OnSuccess(param->description.release()); | 374 param->observer->OnSuccess(param->description.release()); |
| 304 delete param; | 375 delete param; |
| 305 break; | 376 break; |
| 306 } | 377 } |
| 307 case MSG_CREATE_SESSIONDESCRIPTION_FAILED: { | 378 case MSG_CREATE_SESSIONDESCRIPTION_FAILED: { |
| 308 CreateSessionDescriptionMsg* param = | 379 CreateSessionDescriptionMsg* param = |
| 309 static_cast<CreateSessionDescriptionMsg*>(msg->pdata); | 380 static_cast<CreateSessionDescriptionMsg*>(msg->pdata); |
| 310 param->observer->OnFailure(param->error); | 381 param->observer->OnFailure(param->error); |
| 311 delete param; | 382 delete param; |
| 312 break; | 383 break; |
| 313 } | 384 } |
| 385 case MSG_USE_CONSTRUCTOR_CERTIFICATE: { |
| 386 rtc::ScopedRefMessageData<rtc::RTCCertificate>* param = |
| 387 static_cast<rtc::ScopedRefMessageData<rtc::RTCCertificate>*>( |
| 388 msg->pdata); |
| 389 LOG(LS_INFO) << "Using certificate supplied to the constructor."; |
| 390 // TODO(hbos): Pass around scoped_refptr<RTCCertificate> instead of |
| 391 // SSLIdentity* (then there will be no need to do GetReference here). |
| 392 SetIdentity(param->data()->identity()->GetReference()); |
| 393 delete param; |
| 394 break; |
| 395 } |
| 314 default: | 396 default: |
| 315 ASSERT(false); | 397 ASSERT(false); |
| 316 break; | 398 break; |
| 317 } | 399 } |
| 318 } | 400 } |
| 319 | 401 |
| 320 void WebRtcSessionDescriptionFactory::InternalCreateOffer( | 402 void WebRtcSessionDescriptionFactory::InternalCreateOffer( |
| 321 CreateSessionDescriptionRequest request) { | 403 CreateSessionDescriptionRequest request) { |
| 322 cricket::SessionDescription* desc( | 404 cricket::SessionDescription* desc( |
| 323 session_desc_factory_.CreateOffer( | 405 session_desc_factory_.CreateOffer( |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 SessionDescriptionInterface* description) { | 504 SessionDescriptionInterface* description) { |
| 423 CreateSessionDescriptionMsg* msg = new CreateSessionDescriptionMsg(observer); | 505 CreateSessionDescriptionMsg* msg = new CreateSessionDescriptionMsg(observer); |
| 424 msg->description.reset(description); | 506 msg->description.reset(description); |
| 425 signaling_thread_->Post(this, MSG_CREATE_SESSIONDESCRIPTION_SUCCESS, msg); | 507 signaling_thread_->Post(this, MSG_CREATE_SESSIONDESCRIPTION_SUCCESS, msg); |
| 426 } | 508 } |
| 427 | 509 |
| 428 void WebRtcSessionDescriptionFactory::OnIdentityRequestFailed(int error) { | 510 void WebRtcSessionDescriptionFactory::OnIdentityRequestFailed(int error) { |
| 429 ASSERT(signaling_thread_->IsCurrent()); | 511 ASSERT(signaling_thread_->IsCurrent()); |
| 430 | 512 |
| 431 LOG(LS_ERROR) << "Async identity request failed: error = " << error; | 513 LOG(LS_ERROR) << "Async identity request failed: error = " << error; |
| 432 identity_request_state_ = IDENTITY_FAILED; | 514 certificate_request_state_ = CERTIFICATE_FAILED; |
| 433 | 515 |
| 434 FailPendingRequests(kFailedDueToIdentityFailed); | 516 FailPendingRequests(kFailedDueToIdentityFailed); |
| 435 } | 517 } |
| 436 | 518 |
| 437 void WebRtcSessionDescriptionFactory::SetIdentity( | 519 void WebRtcSessionDescriptionFactory::SetIdentity( |
| 438 rtc::SSLIdentity* identity) { | 520 rtc::SSLIdentity* identity) { |
| 439 LOG(LS_VERBOSE) << "Setting new identity"; | 521 LOG(LS_VERBOSE) << "Setting new identity"; |
| 440 | 522 |
| 441 identity_request_state_ = IDENTITY_SUCCEEDED; | 523 certificate_request_state_ = CERTIFICATE_SUCCEEDED; |
| 442 SignalIdentityReady(identity); | 524 SignalIdentityReady(identity); |
| 443 | 525 |
| 444 transport_desc_factory_.set_identity(identity); | 526 transport_desc_factory_.set_identity(identity); |
| 445 transport_desc_factory_.set_secure(cricket::SEC_ENABLED); | 527 transport_desc_factory_.set_secure(cricket::SEC_ENABLED); |
| 446 | 528 |
| 447 while (!create_session_description_requests_.empty()) { | 529 while (!create_session_description_requests_.empty()) { |
| 448 if (create_session_description_requests_.front().type == | 530 if (create_session_description_requests_.front().type == |
| 449 CreateSessionDescriptionRequest::kOffer) { | 531 CreateSessionDescriptionRequest::kOffer) { |
| 450 InternalCreateOffer(create_session_description_requests_.front()); | 532 InternalCreateOffer(create_session_description_requests_.front()); |
| 451 } else { | 533 } else { |
| 452 InternalCreateAnswer(create_session_description_requests_.front()); | 534 InternalCreateAnswer(create_session_description_requests_.front()); |
| 453 } | 535 } |
| 454 create_session_description_requests_.pop(); | 536 create_session_description_requests_.pop(); |
| 455 } | 537 } |
| 456 } | 538 } |
| 457 } // namespace webrtc | 539 } // namespace webrtc |
| OLD | NEW |