Bug 1808053: Throw if a non-rejected answer msection contains no codec in common with offer. r=mjf

Differential Revision: https://phabricator.services.mozilla.com/D165993
This commit is contained in:
Byron Campen [:bwc] 2023-01-04 21:23:20 +00:00
Родитель 9725c758e2
Коммит f1234c9cce
3 изменённых файлов: 23 добавлений и 8 удалений

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

@ -1172,11 +1172,21 @@ nsresult JsepSessionImpl::MakeNegotiatedTransceiver(
NS_ENSURE_SUCCESS(rv, rv);
transceiver->mSendTrack.SetActive(sending);
transceiver->mSendTrack.Negotiate(answer, remote, local);
rv = transceiver->mSendTrack.Negotiate(answer, remote, local);
if (NS_FAILED(rv)) {
JSEP_SET_ERROR("Answer had no codecs in common with offer in m-section "
<< local.GetLevel());
return rv;
}
JsepTrack& recvTrack = transceiver->mRecvTrack;
recvTrack.SetActive(receiving);
recvTrack.Negotiate(answer, remote, local);
rv = recvTrack.Negotiate(answer, remote, local);
if (NS_FAILED(rv)) {
JSEP_SET_ERROR("Answer had no codecs in common with offer in m-section "
<< local.GetLevel());
return rv;
}
if (transceiver->HasBundleLevel() && recvTrack.GetSsrcs().empty() &&
recvTrack.GetMediaType() != SdpMediaSection::kApplication) {

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

@ -576,12 +576,16 @@ std::vector<UniquePtr<JsepCodecDescription>> JsepTrack::NegotiateCodecs(
return negotiatedCodecs;
}
void JsepTrack::Negotiate(const SdpMediaSection& answer,
nsresult JsepTrack::Negotiate(const SdpMediaSection& answer,
const SdpMediaSection& remote,
const SdpMediaSection& local) {
std::vector<UniquePtr<JsepCodecDescription>> negotiatedCodecs =
NegotiateCodecs(remote, &answer != &remote, SomeRef(local));
if (negotiatedCodecs.empty()) {
return NS_ERROR_FAILURE;
}
UniquePtr<JsepTrackNegotiatedDetails> negotiatedDetails =
MakeUnique<JsepTrackNegotiatedDetails>();
@ -603,6 +607,7 @@ void JsepTrack::Negotiate(const SdpMediaSection& answer,
mInHaveRemote = false;
mNegotiatedDetails = std::move(negotiatedDetails);
return NS_OK;
}
// When doing bundle, if all else fails we can try to figure out which m-line a

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

@ -200,7 +200,7 @@ class JsepTrack {
SsrcGenerator& ssrcGenerator,
SdpMediaSection* answer);
virtual void Negotiate(const SdpMediaSection& answer,
virtual nsresult Negotiate(const SdpMediaSection& answer,
const SdpMediaSection& remote,
const SdpMediaSection& local);
static void SetUniquePayloadTypes(std::vector<JsepTrack*>& tracks);