Don't crash if SetRemoteDescription is called first with BundlePolicy=max-bundle.
BUG= R=decurtis@webrtc.org, juberti@google.com Review URL: https://webrtc-codereview.appspot.com/46149004 Cr-Commit-Position: refs/heads/master@{#9124}
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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 \""
|
||||
|
||||
Reference in New Issue
Block a user