diff --git a/talk/app/webrtc/webrtcsession.cc b/talk/app/webrtc/webrtcsession.cc index 9d0a8e4c2a..f235cd5eb3 100644 --- a/talk/app/webrtc/webrtcsession.cc +++ b/talk/app/webrtc/webrtcsession.cc @@ -1599,14 +1599,13 @@ bool WebRtcSession::CreateChannels(const SessionDescription* desc) { // Enable bundle before when kMaxBundle policy is in effect. if (bundle_policy_ == PeerConnectionInterface::kBundlePolicyMaxBundle) { - const cricket::ContentGroup* local_bundle_group = - BaseSession::local_description()->GetGroupByName( - cricket::GROUP_TYPE_BUNDLE); - if (!local_bundle_group) { + const cricket::ContentGroup* bundle_group = desc->GetGroupByName( + cricket::GROUP_TYPE_BUNDLE); + if (!bundle_group) { LOG(LS_WARNING) << "max-bundle specified without BUNDLE specified"; return false; } - if (!BaseSession::BundleContentGroup(local_bundle_group)) { + if (!BaseSession::BundleContentGroup(bundle_group)) { LOG(LS_WARNING) << "max-bundle failed to enable bundling."; return false; } diff --git a/talk/app/webrtc/webrtcsession_unittest.cc b/talk/app/webrtc/webrtcsession_unittest.cc index 4e0066b0f5..3efc112c6a 100644 --- a/talk/app/webrtc/webrtcsession_unittest.cc +++ b/talk/app/webrtc/webrtcsession_unittest.cc @@ -2595,7 +2595,7 @@ TEST_F(WebRtcSessionTest, TestSetRemoteDescriptionInvalidIceCredentials) { EXPECT_FALSE(session_->SetRemoteDescription(modified_offer, &error)); } -// kBundlePolicyBalanced bundle policy with and answer contains BUNDLE. +// kBundlePolicyBalanced bundle policy and answer contains BUNDLE. TEST_F(WebRtcSessionTest, TestBalancedBundleInAnswer) { InitWithBundlePolicy(PeerConnectionInterface::kBundlePolicyBalanced); mediastream_signaling_.SendAudioVideoStream1(); @@ -2622,6 +2622,7 @@ TEST_F(WebRtcSessionTest, TestBalancedBundleInAnswer) { TEST_F(WebRtcSessionTest, TestBalancedNoBundleInAnswer) { InitWithBundlePolicy(PeerConnectionInterface::kBundlePolicyBalanced); mediastream_signaling_.SendAudioVideoStream1(); + PeerConnectionInterface::RTCOfferAnswerOptions options; options.use_rtp_mux = true; @@ -2674,6 +2675,7 @@ TEST_F(WebRtcSessionTest, TestMaxBundleBundleInAnswer) { TEST_F(WebRtcSessionTest, TestMaxBundleNoBundleInAnswer) { InitWithBundlePolicy(PeerConnectionInterface::kBundlePolicyMaxBundle); mediastream_signaling_.SendAudioVideoStream1(); + PeerConnectionInterface::RTCOfferAnswerOptions options; options.use_rtp_mux = true; @@ -2699,7 +2701,7 @@ TEST_F(WebRtcSessionTest, TestMaxBundleNoBundleInAnswer) { session_->GetTransportProxy("video")->impl()); } -// kBundlePolicyMaxCompat bundle policy with and answer contains BUNDLE. +// kBundlePolicyMaxCompat bundle policy and answer contains BUNDLE. TEST_F(WebRtcSessionTest, TestMaxCompatBundleInAnswer) { InitWithBundlePolicy(PeerConnectionInterface::kBundlePolicyMaxCompat); mediastream_signaling_.SendAudioVideoStream1(); @@ -2753,6 +2755,21 @@ TEST_F(WebRtcSessionTest, TestMaxCompatNoBundleInAnswer) { session_->GetTransportProxy("video")->impl()); } +// kBundlePolicyMaxbundle and then we call SetRemoteDescription first. +TEST_F(WebRtcSessionTest, TestMaxBundleWithSetRemoteDescriptionFirst) { + InitWithBundlePolicy(PeerConnectionInterface::kBundlePolicyMaxBundle); + mediastream_signaling_.SendAudioVideoStream1(); + + PeerConnectionInterface::RTCOfferAnswerOptions options; + options.use_rtp_mux = true; + + SessionDescriptionInterface* offer = CreateOffer(options); + SetRemoteDescriptionWithoutError(offer); + + EXPECT_EQ(session_->GetTransportProxy("audio")->impl(), + session_->GetTransportProxy("video")->impl()); +} + // This test verifies that SetLocalDescription and SetRemoteDescription fails // if BUNDLE is enabled but rtcp-mux is disabled in m-lines. TEST_F(WebRtcSessionTest, TestDisabledRtcpMuxWithBundleEnabled) { diff --git a/webrtc/p2p/base/session.cc b/webrtc/p2p/base/session.cc index 136f3919ab..38c9836893 100644 --- a/webrtc/p2p/base/session.cc +++ b/webrtc/p2p/base/session.cc @@ -665,15 +665,6 @@ bool BaseSession::BundleContentGroup(const ContentGroup* bundle_group) { return true; } - const ContentInfo* content = - local_description_->GetContentByName(*content_name); - if (!content) { - LOG(LS_WARNING) << "Content \"" << *content_name - << "\" referenced in BUNDLE group" - << " not present in local description"; - return false; - } - TransportProxy* selected_proxy = GetTransportProxy(*content_name); if (!selected_proxy) { LOG(LS_WARNING) << "No transport found for content \""