OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2012 Google Inc. | 3 * Copyright 2012 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 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
564 if (data_channel_ && session_->data_channel_type() == cricket::DCT_RTP) { | 564 if (data_channel_ && session_->data_channel_type() == cricket::DCT_RTP) { |
565 session_options->AddSendStream(cricket::MEDIA_TYPE_DATA, | 565 session_options->AddSendStream(cricket::MEDIA_TYPE_DATA, |
566 data_channel_->label(), | 566 data_channel_->label(), |
567 data_channel_->label()); | 567 data_channel_->label()); |
568 } | 568 } |
569 } | 569 } |
570 | 570 |
571 void GetOptionsForOffer( | 571 void GetOptionsForOffer( |
572 const PeerConnectionInterface::RTCOfferAnswerOptions& rtc_options, | 572 const PeerConnectionInterface::RTCOfferAnswerOptions& rtc_options, |
573 cricket::MediaSessionOptions* session_options) { | 573 cricket::MediaSessionOptions* session_options) { |
| 574 ASSERT_TRUE(ConvertRtcOptionsForOffer(rtc_options, session_options)); |
| 575 |
574 AddStreamsToOptions(session_options); | 576 AddStreamsToOptions(session_options); |
575 ASSERT_TRUE(ConvertRtcOptionsForOffer(rtc_options, session_options)); | 577 if (rtc_options.offer_to_receive_audio == |
| 578 RTCOfferAnswerOptions::kUndefined) { |
| 579 session_options->recv_audio = |
| 580 session_options->HasSendMediaStream(cricket::MEDIA_TYPE_AUDIO); |
| 581 } |
| 582 if (rtc_options.offer_to_receive_video == |
| 583 RTCOfferAnswerOptions::kUndefined) { |
| 584 session_options->recv_video = |
| 585 session_options->HasSendMediaStream(cricket::MEDIA_TYPE_VIDEO); |
| 586 } |
| 587 session_options->bundle_enabled = |
| 588 session_options->bundle_enabled && |
| 589 (session_options->has_audio() || session_options->has_video() || |
| 590 session_options->has_data()); |
576 | 591 |
577 if (session_->data_channel_type() == cricket::DCT_SCTP && data_channel_) { | 592 if (session_->data_channel_type() == cricket::DCT_SCTP && data_channel_) { |
578 session_options->data_channel_type = cricket::DCT_SCTP; | 593 session_options->data_channel_type = cricket::DCT_SCTP; |
579 } | 594 } |
580 } | 595 } |
581 | 596 |
582 void GetOptionsForAnswer(const webrtc::MediaConstraintsInterface* constraints, | 597 void GetOptionsForAnswer(const webrtc::MediaConstraintsInterface* constraints, |
583 cricket::MediaSessionOptions* session_options) { | 598 cricket::MediaSessionOptions* session_options) { |
584 AddStreamsToOptions(session_options); | |
585 session_options->recv_audio = false; | 599 session_options->recv_audio = false; |
586 session_options->recv_video = false; | 600 session_options->recv_video = false; |
587 ASSERT_TRUE(ParseConstraintsForAnswer(constraints, session_options)); | 601 ASSERT_TRUE(ParseConstraintsForAnswer(constraints, session_options)); |
588 | 602 |
| 603 AddStreamsToOptions(session_options); |
| 604 session_options->bundle_enabled = |
| 605 session_options->bundle_enabled && |
| 606 (session_options->has_audio() || session_options->has_video() || |
| 607 session_options->has_data()); |
| 608 |
589 if (session_->data_channel_type() == cricket::DCT_SCTP) { | 609 if (session_->data_channel_type() == cricket::DCT_SCTP) { |
590 session_options->data_channel_type = cricket::DCT_SCTP; | 610 session_options->data_channel_type = cricket::DCT_SCTP; |
591 } | 611 } |
592 } | 612 } |
593 | 613 |
594 // Creates a local offer and applies it. Starts ICE. | 614 // Creates a local offer and applies it. Starts ICE. |
595 // Call SendAudioVideoStreamX() before this function | 615 // Call SendAudioVideoStreamX() before this function |
596 // to decide which streams to create. | 616 // to decide which streams to create. |
597 void InitiateCall() { | 617 void InitiateCall() { |
598 SessionDescriptionInterface* offer = CreateOffer(); | 618 SessionDescriptionInterface* offer = CreateOffer(); |
(...skipping 3591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4190 } | 4210 } |
4191 | 4211 |
4192 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test | 4212 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test |
4193 // currently fails because upon disconnection and reconnection OnIceComplete is | 4213 // currently fails because upon disconnection and reconnection OnIceComplete is |
4194 // called more than once without returning to IceGatheringGathering. | 4214 // called more than once without returning to IceGatheringGathering. |
4195 | 4215 |
4196 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests, | 4216 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests, |
4197 WebRtcSessionTest, | 4217 WebRtcSessionTest, |
4198 testing::Values(ALREADY_GENERATED, | 4218 testing::Values(ALREADY_GENERATED, |
4199 DTLS_IDENTITY_STORE)); | 4219 DTLS_IDENTITY_STORE)); |
OLD | NEW |