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 26 matching lines...) Expand all Loading... |
37 | 37 |
38 using cricket::MediaSessionOptions; | 38 using cricket::MediaSessionOptions; |
39 | 39 |
40 namespace webrtc { | 40 namespace webrtc { |
41 namespace { | 41 namespace { |
42 static const char kFailedDueToIdentityFailed[] = | 42 static const char kFailedDueToIdentityFailed[] = |
43 " failed because DTLS identity request failed"; | 43 " failed because DTLS identity request failed"; |
44 static const char kFailedDueToSessionShutdown[] = | 44 static const char kFailedDueToSessionShutdown[] = |
45 " failed because the session was shut down"; | 45 " failed because the session was shut down"; |
46 | 46 |
47 static const uint64 kInitSessionVersion = 2; | 47 static const uint64_t kInitSessionVersion = 2; |
48 | 48 |
49 static bool CompareStream(const MediaSessionOptions::Stream& stream1, | 49 static bool CompareStream(const MediaSessionOptions::Stream& stream1, |
50 const MediaSessionOptions::Stream& stream2) { | 50 const MediaSessionOptions::Stream& stream2) { |
51 return stream1.id < stream2.id; | 51 return stream1.id < stream2.id; |
52 } | 52 } |
53 | 53 |
54 static bool SameId(const MediaSessionOptions::Stream& stream1, | 54 static bool SameId(const MediaSessionOptions::Stream& stream1, |
55 const MediaSessionOptions::Stream& stream2) { | 55 const MediaSessionOptions::Stream& stream2) { |
56 return stream1.id == stream2.id; | 56 return stream1.id == stream2.id; |
57 } | 57 } |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 request.options, | 404 request.options, |
405 static_cast<cricket::BaseSession*>(session_)->local_description())); | 405 static_cast<cricket::BaseSession*>(session_)->local_description())); |
406 // RFC 3264 | 406 // RFC 3264 |
407 // When issuing an offer that modifies the session, | 407 // When issuing an offer that modifies the session, |
408 // the "o=" line of the new SDP MUST be identical to that in the | 408 // the "o=" line of the new SDP MUST be identical to that in the |
409 // previous SDP, except that the version in the origin field MUST | 409 // previous SDP, except that the version in the origin field MUST |
410 // increment by one from the previous SDP. | 410 // increment by one from the previous SDP. |
411 | 411 |
412 // Just increase the version number by one each time when a new offer | 412 // Just increase the version number by one each time when a new offer |
413 // is created regardless if it's identical to the previous one or not. | 413 // is created regardless if it's identical to the previous one or not. |
414 // The |session_version_| is a uint64, the wrap around should not happen. | 414 // The |session_version_| is a uint64_t, the wrap around should not happen. |
415 ASSERT(session_version_ + 1 > session_version_); | 415 ASSERT(session_version_ + 1 > session_version_); |
416 JsepSessionDescription* offer(new JsepSessionDescription( | 416 JsepSessionDescription* offer(new JsepSessionDescription( |
417 JsepSessionDescription::kOffer)); | 417 JsepSessionDescription::kOffer)); |
418 if (!offer->Initialize(desc, session_id_, | 418 if (!offer->Initialize(desc, session_id_, |
419 rtc::ToString(session_version_++))) { | 419 rtc::ToString(session_version_++))) { |
420 delete offer; | 420 delete offer; |
421 PostCreateSessionDescriptionFailed(request.observer, | 421 PostCreateSessionDescriptionFailed(request.observer, |
422 "Failed to initialize the offer."); | 422 "Failed to initialize the offer."); |
423 return; | 423 return; |
424 } | 424 } |
(...skipping 23 matching lines...) Expand all Loading... |
448 cricket::SessionDescription* desc(session_desc_factory_.CreateAnswer( | 448 cricket::SessionDescription* desc(session_desc_factory_.CreateAnswer( |
449 static_cast<cricket::BaseSession*>(session_)->remote_description(), | 449 static_cast<cricket::BaseSession*>(session_)->remote_description(), |
450 request.options, | 450 request.options, |
451 static_cast<cricket::BaseSession*>(session_)->local_description())); | 451 static_cast<cricket::BaseSession*>(session_)->local_description())); |
452 // RFC 3264 | 452 // RFC 3264 |
453 // If the answer is different from the offer in any way (different IP | 453 // If the answer is different from the offer in any way (different IP |
454 // addresses, ports, etc.), the origin line MUST be different in the answer. | 454 // addresses, ports, etc.), the origin line MUST be different in the answer. |
455 // In that case, the version number in the "o=" line of the answer is | 455 // In that case, the version number in the "o=" line of the answer is |
456 // unrelated to the version number in the o line of the offer. | 456 // unrelated to the version number in the o line of the offer. |
457 // Get a new version number by increasing the |session_version_answer_|. | 457 // Get a new version number by increasing the |session_version_answer_|. |
458 // The |session_version_| is a uint64, the wrap around should not happen. | 458 // The |session_version_| is a uint64_t, the wrap around should not happen. |
459 ASSERT(session_version_ + 1 > session_version_); | 459 ASSERT(session_version_ + 1 > session_version_); |
460 JsepSessionDescription* answer(new JsepSessionDescription( | 460 JsepSessionDescription* answer(new JsepSessionDescription( |
461 JsepSessionDescription::kAnswer)); | 461 JsepSessionDescription::kAnswer)); |
462 if (!answer->Initialize(desc, session_id_, | 462 if (!answer->Initialize(desc, session_id_, |
463 rtc::ToString(session_version_++))) { | 463 rtc::ToString(session_version_++))) { |
464 delete answer; | 464 delete answer; |
465 PostCreateSessionDescriptionFailed(request.observer, | 465 PostCreateSessionDescriptionFailed(request.observer, |
466 "Failed to initialize the answer."); | 466 "Failed to initialize the answer."); |
467 return; | 467 return; |
468 } | 468 } |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 if (create_session_description_requests_.front().type == | 529 if (create_session_description_requests_.front().type == |
530 CreateSessionDescriptionRequest::kOffer) { | 530 CreateSessionDescriptionRequest::kOffer) { |
531 InternalCreateOffer(create_session_description_requests_.front()); | 531 InternalCreateOffer(create_session_description_requests_.front()); |
532 } else { | 532 } else { |
533 InternalCreateAnswer(create_session_description_requests_.front()); | 533 InternalCreateAnswer(create_session_description_requests_.front()); |
534 } | 534 } |
535 create_session_description_requests_.pop(); | 535 create_session_description_requests_.pop(); |
536 } | 536 } |
537 } | 537 } |
538 } // namespace webrtc | 538 } // namespace webrtc |
OLD | NEW |