Compare the answer's media type against offer to make sure they are match. Otherwise we should return failure.
BUG=2687 R=mallinath@webrtc.org Review URL: https://webrtc-codereview.appspot.com/11079005 git-svn-id: http://webrtc.googlecode.com/svn/trunk@5858 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
413d001132
commit
4e393070be
@ -86,6 +86,15 @@ static bool VerifyMediaDescriptions(
|
||||
if ((offer->contents()[i].name) != answer->contents()[i].name) {
|
||||
return false;
|
||||
}
|
||||
const MediaContentDescription* offer_mdesc =
|
||||
static_cast<const MediaContentDescription*>(
|
||||
offer->contents()[i].description);
|
||||
const MediaContentDescription* answer_mdesc =
|
||||
static_cast<const MediaContentDescription*>(
|
||||
answer->contents()[i].description);
|
||||
if (offer_mdesc->type() != answer_mdesc->type()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -2611,22 +2611,31 @@ TEST_F(WebRtcSessionTest, TestIncorrectMLinesInRemoteAnswer) {
|
||||
answer->session_version()));
|
||||
SetRemoteDescriptionAnswerExpectError(kMlineMismatch, modified_answer);
|
||||
|
||||
// Modifying content names.
|
||||
// Different content names.
|
||||
std::string sdp;
|
||||
EXPECT_TRUE(answer->ToString(&sdp));
|
||||
const std::string kAudioMid = "a=mid:audio";
|
||||
const std::string kAudioMidReplaceStr = "a=mid:audio_content_name";
|
||||
|
||||
// Replacing |audio| with |audio_content_name|.
|
||||
talk_base::replace_substrs(kAudioMid.c_str(), kAudioMid.length(),
|
||||
kAudioMidReplaceStr.c_str(),
|
||||
kAudioMidReplaceStr.length(),
|
||||
&sdp);
|
||||
|
||||
SessionDescriptionInterface* modified_answer1 =
|
||||
CreateSessionDescription(JsepSessionDescription::kAnswer, sdp, NULL);
|
||||
SetRemoteDescriptionAnswerExpectError(kMlineMismatch, modified_answer1);
|
||||
|
||||
// Different media types.
|
||||
EXPECT_TRUE(answer->ToString(&sdp));
|
||||
const std::string kAudioMline = "m=audio";
|
||||
const std::string kAudioMlineReplaceStr = "m=video";
|
||||
talk_base::replace_substrs(kAudioMline.c_str(), kAudioMline.length(),
|
||||
kAudioMlineReplaceStr.c_str(),
|
||||
kAudioMlineReplaceStr.length(),
|
||||
&sdp);
|
||||
SessionDescriptionInterface* modified_answer2 =
|
||||
CreateSessionDescription(JsepSessionDescription::kAnswer, sdp, NULL);
|
||||
SetRemoteDescriptionAnswerExpectError(kMlineMismatch, modified_answer2);
|
||||
|
||||
SetRemoteDescriptionWithoutError(answer.release());
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user