| 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 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 break; | 396 break; |
| 397 } | 397 } |
| 398 default: | 398 default: |
| 399 ASSERT(false); | 399 ASSERT(false); |
| 400 break; | 400 break; |
| 401 } | 401 } |
| 402 } | 402 } |
| 403 | 403 |
| 404 void WebRtcSessionDescriptionFactory::InternalCreateOffer( | 404 void WebRtcSessionDescriptionFactory::InternalCreateOffer( |
| 405 CreateSessionDescriptionRequest request) { | 405 CreateSessionDescriptionRequest request) { |
| 406 cricket::SessionDescription* desc( | 406 cricket::SessionDescription* desc(session_desc_factory_.CreateOffer( |
| 407 session_desc_factory_.CreateOffer( | 407 request.options, session_->local_description() |
| 408 request.options, | 408 ? session_->local_description()->description() |
| 409 static_cast<cricket::BaseSession*>(session_)->local_description())); | 409 : nullptr)); |
| 410 // RFC 3264 | 410 // RFC 3264 |
| 411 // When issuing an offer that modifies the session, | 411 // When issuing an offer that modifies the session, |
| 412 // the "o=" line of the new SDP MUST be identical to that in the | 412 // the "o=" line of the new SDP MUST be identical to that in the |
| 413 // previous SDP, except that the version in the origin field MUST | 413 // previous SDP, except that the version in the origin field MUST |
| 414 // increment by one from the previous SDP. | 414 // increment by one from the previous SDP. |
| 415 | 415 |
| 416 // Just increase the version number by one each time when a new offer | 416 // Just increase the version number by one each time when a new offer |
| 417 // is created regardless if it's identical to the previous one or not. | 417 // is created regardless if it's identical to the previous one or not. |
| 418 // The |session_version_| is a uint64_t, the wrap around should not happen. | 418 // The |session_version_| is a uint64_t, the wrap around should not happen. |
| 419 ASSERT(session_version_ + 1 > session_version_); | 419 ASSERT(session_version_ + 1 > session_version_); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 443 request.options.transport_options.ice_restart = session_->IceRestartPending(); | 443 request.options.transport_options.ice_restart = session_->IceRestartPending(); |
| 444 // We should pass current ssl role to the transport description factory, if | 444 // We should pass current ssl role to the transport description factory, if |
| 445 // there is already an existing ongoing session. | 445 // there is already an existing ongoing session. |
| 446 rtc::SSLRole ssl_role; | 446 rtc::SSLRole ssl_role; |
| 447 if (session_->GetSslRole(&ssl_role)) { | 447 if (session_->GetSslRole(&ssl_role)) { |
| 448 request.options.transport_options.prefer_passive_role = | 448 request.options.transport_options.prefer_passive_role = |
| 449 (rtc::SSL_SERVER == ssl_role); | 449 (rtc::SSL_SERVER == ssl_role); |
| 450 } | 450 } |
| 451 | 451 |
| 452 cricket::SessionDescription* desc(session_desc_factory_.CreateAnswer( | 452 cricket::SessionDescription* desc(session_desc_factory_.CreateAnswer( |
| 453 static_cast<cricket::BaseSession*>(session_)->remote_description(), | 453 session_->remote_description() |
| 454 request.options, | 454 ? session_->remote_description()->description() |
| 455 static_cast<cricket::BaseSession*>(session_)->local_description())); | 455 : nullptr, |
| 456 request.options, session_->local_description() |
| 457 ? session_->local_description()->description() |
| 458 : nullptr)); |
| 456 // RFC 3264 | 459 // RFC 3264 |
| 457 // If the answer is different from the offer in any way (different IP | 460 // If the answer is different from the offer in any way (different IP |
| 458 // addresses, ports, etc.), the origin line MUST be different in the answer. | 461 // addresses, ports, etc.), the origin line MUST be different in the answer. |
| 459 // In that case, the version number in the "o=" line of the answer is | 462 // In that case, the version number in the "o=" line of the answer is |
| 460 // unrelated to the version number in the o line of the offer. | 463 // unrelated to the version number in the o line of the offer. |
| 461 // Get a new version number by increasing the |session_version_answer_|. | 464 // Get a new version number by increasing the |session_version_answer_|. |
| 462 // The |session_version_| is a uint64_t, the wrap around should not happen. | 465 // The |session_version_| is a uint64_t, the wrap around should not happen. |
| 463 ASSERT(session_version_ + 1 > session_version_); | 466 ASSERT(session_version_ + 1 > session_version_); |
| 464 JsepSessionDescription* answer(new JsepSessionDescription( | 467 JsepSessionDescription* answer(new JsepSessionDescription( |
| 465 JsepSessionDescription::kAnswer)); | 468 JsepSessionDescription::kAnswer)); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 if (create_session_description_requests_.front().type == | 536 if (create_session_description_requests_.front().type == |
| 534 CreateSessionDescriptionRequest::kOffer) { | 537 CreateSessionDescriptionRequest::kOffer) { |
| 535 InternalCreateOffer(create_session_description_requests_.front()); | 538 InternalCreateOffer(create_session_description_requests_.front()); |
| 536 } else { | 539 } else { |
| 537 InternalCreateAnswer(create_session_description_requests_.front()); | 540 InternalCreateAnswer(create_session_description_requests_.front()); |
| 538 } | 541 } |
| 539 create_session_description_requests_.pop(); | 542 create_session_description_requests_.pop(); |
| 540 } | 543 } |
| 541 } | 544 } |
| 542 } // namespace webrtc | 545 } // namespace webrtc |
| OLD | NEW |