Bug 1144432 - Part 2: Allow mid to change in renegotiation, check that mid doesn't change in answer, and disable some checking when the m-section was previously disabled. r=mt

--HG--
extra : rebase_source : d30168d73f9a911aa31773a3ccf3383739125a92
This commit is contained in:
Byron Campen [:bwc] 2015-03-18 14:52:24 -07:00
Родитель e714980d71
Коммит e3708a8bd3
1 изменённых файлов: 15 добавлений и 11 удалений

Просмотреть файл

@ -1870,7 +1870,7 @@ JsepSessionImpl::CopyStickyParams(const SdpMediaSection& source,
new SdpFlagAttribute(SdpAttribute::kRtcpMuxAttribute));
}
// mid must stay the same
// mid should stay the same
if (sourceAttrs.HasAttribute(SdpAttribute::kMidAttribute)) {
destAttrs.SetAttribute(
new SdpStringAttribute(SdpAttribute::kMidAttribute,
@ -2154,7 +2154,8 @@ JsepSessionImpl::ValidateRemoteDescription(const Sdp& description)
for (size_t i = 0;
i < mCurrentRemoteDescription->GetMediaSectionCount();
++i) {
if (MsectionIsDisabled(description.GetMediaSection(i))) {
if (MsectionIsDisabled(description.GetMediaSection(i)) ||
MsectionIsDisabled(mCurrentRemoteDescription->GetMediaSection(i))) {
continue;
}
@ -2163,15 +2164,7 @@ JsepSessionImpl::ValidateRemoteDescription(const Sdp& description)
const SdpAttributeList& oldAttrs(
mCurrentRemoteDescription->GetMediaSection(i).GetAttributeList());
// We have already verified the presence of these attributes in ParseSdp.
if (newAttrs.GetMid() != oldAttrs.GetMid()) {
JSEP_SET_ERROR("New remote description changes mid for level " << i
<< ", was \'" << oldAttrs.GetMid()
<< "\" now \'" << newAttrs.GetMid() << "\'");
return NS_ERROR_INVALID_ARG;
}
if (oldBundleMids.count(newAttrs.GetMid()) &&
if (oldBundleMids.count(oldAttrs.GetMid()) &&
!newBundleMids.count(newAttrs.GetMid())) {
JSEP_SET_ERROR("Removing m-sections from a bundle group is unsupported "
"at this time.");
@ -2223,6 +2216,17 @@ JsepSessionImpl::ValidateAnswer(const Sdp& offer, const Sdp& answer)
JSEP_SET_ERROR("Answer tried to set send when offer did not set recv");
return NS_ERROR_INVALID_ARG;
}
if (!MsectionIsDisabled(answerMsection)) {
if (offerMsection.GetAttributeList().GetMid() !=
answerMsection.GetAttributeList().GetMid()) {
JSEP_SET_ERROR("Answer changes mid for level, was \'"
<< offerMsection.GetAttributeList().GetMid()
<< "\', now \'"
<< answerMsection.GetAttributeList().GetMid() << "\'");
return NS_ERROR_INVALID_ARG;
}
}
}
return NS_OK;