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 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 break; | 359 break; |
360 } | 360 } |
361 default: | 361 default: |
362 ASSERT(false); | 362 ASSERT(false); |
363 break; | 363 break; |
364 } | 364 } |
365 } | 365 } |
366 | 366 |
367 void WebRtcSessionDescriptionFactory::InternalCreateOffer( | 367 void WebRtcSessionDescriptionFactory::InternalCreateOffer( |
368 CreateSessionDescriptionRequest request) { | 368 CreateSessionDescriptionRequest request) { |
369 cricket::SessionDescription* desc( | 369 cricket::SessionDescription* desc(session_desc_factory_.CreateOffer( |
370 session_desc_factory_.CreateOffer( | 370 request.options, session_->local_description() |
371 request.options, | 371 ? session_->local_description()->description() |
372 static_cast<cricket::BaseSession*>(session_)->local_description())); | 372 : nullptr)); |
373 // RFC 3264 | 373 // RFC 3264 |
374 // When issuing an offer that modifies the session, | 374 // When issuing an offer that modifies the session, |
375 // the "o=" line of the new SDP MUST be identical to that in the | 375 // the "o=" line of the new SDP MUST be identical to that in the |
376 // previous SDP, except that the version in the origin field MUST | 376 // previous SDP, except that the version in the origin field MUST |
377 // increment by one from the previous SDP. | 377 // increment by one from the previous SDP. |
378 | 378 |
379 // Just increase the version number by one each time when a new offer | 379 // Just increase the version number by one each time when a new offer |
380 // is created regardless if it's identical to the previous one or not. | 380 // is created regardless if it's identical to the previous one or not. |
381 // The |session_version_| is a uint64_t, the wrap around should not happen. | 381 // The |session_version_| is a uint64_t, the wrap around should not happen. |
382 ASSERT(session_version_ + 1 > session_version_); | 382 ASSERT(session_version_ + 1 > session_version_); |
(...skipping 23 matching lines...) Expand all Loading... |
406 request.options.transport_options.ice_restart = session_->IceRestartPending(); | 406 request.options.transport_options.ice_restart = session_->IceRestartPending(); |
407 // We should pass current ssl role to the transport description factory, if | 407 // We should pass current ssl role to the transport description factory, if |
408 // there is already an existing ongoing session. | 408 // there is already an existing ongoing session. |
409 rtc::SSLRole ssl_role; | 409 rtc::SSLRole ssl_role; |
410 if (session_->GetSslRole(&ssl_role)) { | 410 if (session_->GetSslRole(&ssl_role)) { |
411 request.options.transport_options.prefer_passive_role = | 411 request.options.transport_options.prefer_passive_role = |
412 (rtc::SSL_SERVER == ssl_role); | 412 (rtc::SSL_SERVER == ssl_role); |
413 } | 413 } |
414 | 414 |
415 cricket::SessionDescription* desc(session_desc_factory_.CreateAnswer( | 415 cricket::SessionDescription* desc(session_desc_factory_.CreateAnswer( |
416 static_cast<cricket::BaseSession*>(session_)->remote_description(), | 416 session_->remote_description() |
417 request.options, | 417 ? session_->remote_description()->description() |
418 static_cast<cricket::BaseSession*>(session_)->local_description())); | 418 : nullptr, |
| 419 request.options, session_->local_description() |
| 420 ? session_->local_description()->description() |
| 421 : nullptr)); |
419 // RFC 3264 | 422 // RFC 3264 |
420 // If the answer is different from the offer in any way (different IP | 423 // If the answer is different from the offer in any way (different IP |
421 // addresses, ports, etc.), the origin line MUST be different in the answer. | 424 // addresses, ports, etc.), the origin line MUST be different in the answer. |
422 // In that case, the version number in the "o=" line of the answer is | 425 // In that case, the version number in the "o=" line of the answer is |
423 // unrelated to the version number in the o line of the offer. | 426 // unrelated to the version number in the o line of the offer. |
424 // Get a new version number by increasing the |session_version_answer_|. | 427 // Get a new version number by increasing the |session_version_answer_|. |
425 // The |session_version_| is a uint64_t, the wrap around should not happen. | 428 // The |session_version_| is a uint64_t, the wrap around should not happen. |
426 ASSERT(session_version_ + 1 > session_version_); | 429 ASSERT(session_version_ + 1 > session_version_); |
427 JsepSessionDescription* answer(new JsepSessionDescription( | 430 JsepSessionDescription* answer(new JsepSessionDescription( |
428 JsepSessionDescription::kAnswer)); | 431 JsepSessionDescription::kAnswer)); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 if (create_session_description_requests_.front().type == | 499 if (create_session_description_requests_.front().type == |
497 CreateSessionDescriptionRequest::kOffer) { | 500 CreateSessionDescriptionRequest::kOffer) { |
498 InternalCreateOffer(create_session_description_requests_.front()); | 501 InternalCreateOffer(create_session_description_requests_.front()); |
499 } else { | 502 } else { |
500 InternalCreateAnswer(create_session_description_requests_.front()); | 503 InternalCreateAnswer(create_session_description_requests_.front()); |
501 } | 504 } |
502 create_session_description_requests_.pop(); | 505 create_session_description_requests_.pop(); |
503 } | 506 } |
504 } | 507 } |
505 } // namespace webrtc | 508 } // namespace webrtc |
OLD | NEW |