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 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 request.options, | 408 request.options, |
409 static_cast<cricket::BaseSession*>(session_)->local_description())); | 409 static_cast<cricket::BaseSession*>(session_)->local_description())); |
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, 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_); |
420 JsepSessionDescription* offer(new JsepSessionDescription( | 420 JsepSessionDescription* offer(new JsepSessionDescription( |
421 JsepSessionDescription::kOffer)); | 421 JsepSessionDescription::kOffer)); |
422 if (!offer->Initialize(desc, session_id_, | 422 if (!offer->Initialize(desc, session_id_, |
423 rtc::ToString(session_version_++))) { | 423 rtc::ToString(session_version_++))) { |
424 delete offer; | 424 delete offer; |
425 PostCreateSessionDescriptionFailed(request.observer, | 425 PostCreateSessionDescriptionFailed(request.observer, |
426 "Failed to initialize the offer."); | 426 "Failed to initialize the offer."); |
427 return; | 427 return; |
428 } | 428 } |
(...skipping 23 matching lines...) Expand all Loading... |
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 static_cast<cricket::BaseSession*>(session_)->remote_description(), |
454 request.options, | 454 request.options, |
455 static_cast<cricket::BaseSession*>(session_)->local_description())); | 455 static_cast<cricket::BaseSession*>(session_)->local_description())); |
456 // RFC 3264 | 456 // RFC 3264 |
457 // If the answer is different from the offer in any way (different IP | 457 // 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. | 458 // 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 | 459 // 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. | 460 // unrelated to the version number in the o line of the offer. |
461 // Get a new version number by increasing the |session_version_answer_|. | 461 // Get a new version number by increasing the |session_version_answer_|. |
462 // The |session_version_| is a uint64, the wrap around should not happen. | 462 // The |session_version_| is a uint64_t, the wrap around should not happen. |
463 ASSERT(session_version_ + 1 > session_version_); | 463 ASSERT(session_version_ + 1 > session_version_); |
464 JsepSessionDescription* answer(new JsepSessionDescription( | 464 JsepSessionDescription* answer(new JsepSessionDescription( |
465 JsepSessionDescription::kAnswer)); | 465 JsepSessionDescription::kAnswer)); |
466 if (!answer->Initialize(desc, session_id_, | 466 if (!answer->Initialize(desc, session_id_, |
467 rtc::ToString(session_version_++))) { | 467 rtc::ToString(session_version_++))) { |
468 delete answer; | 468 delete answer; |
469 PostCreateSessionDescriptionFailed(request.observer, | 469 PostCreateSessionDescriptionFailed(request.observer, |
470 "Failed to initialize the answer."); | 470 "Failed to initialize the answer."); |
471 return; | 471 return; |
472 } | 472 } |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 if (create_session_description_requests_.front().type == | 533 if (create_session_description_requests_.front().type == |
534 CreateSessionDescriptionRequest::kOffer) { | 534 CreateSessionDescriptionRequest::kOffer) { |
535 InternalCreateOffer(create_session_description_requests_.front()); | 535 InternalCreateOffer(create_session_description_requests_.front()); |
536 } else { | 536 } else { |
537 InternalCreateAnswer(create_session_description_requests_.front()); | 537 InternalCreateAnswer(create_session_description_requests_.front()); |
538 } | 538 } |
539 create_session_description_requests_.pop(); | 539 create_session_description_requests_.pop(); |
540 } | 540 } |
541 } | 541 } |
542 } // namespace webrtc | 542 } // namespace webrtc |
OLD | NEW |