mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-21 01:05:45 +00:00
Bug 1531803 - Part 3: Only set track id on JsepTrack if we're configured to emit track ids in SDP, and simplify some code. r=mjf
Differential Revision: https://phabricator.services.mozilla.com/D25796 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
ef7c16372d
commit
46627d3af8
@ -127,8 +127,8 @@ class JsepTrackTest : public ::testing::Test {
|
||||
SdpMediaSection& GetAnswer() { return mAnswer->GetMediaSection(0); }
|
||||
|
||||
void CreateOffer() {
|
||||
mSendOff.AddToOffer(mSsrcGenerator, true, &GetOffer());
|
||||
mRecvOff.AddToOffer(mSsrcGenerator, true, &GetOffer());
|
||||
mSendOff.AddToOffer(mSsrcGenerator, &GetOffer());
|
||||
mRecvOff.AddToOffer(mSsrcGenerator, &GetOffer());
|
||||
}
|
||||
|
||||
void CreateAnswer() {
|
||||
@ -136,8 +136,8 @@ class JsepTrackTest : public ::testing::Test {
|
||||
mRecvAns.UpdateRecvTrack(*mOffer, GetOffer());
|
||||
}
|
||||
|
||||
mSendAns.AddToAnswer(GetOffer(), mSsrcGenerator, true, &GetAnswer());
|
||||
mRecvAns.AddToAnswer(GetOffer(), mSsrcGenerator, true, &GetAnswer());
|
||||
mSendAns.AddToAnswer(GetOffer(), mSsrcGenerator, &GetAnswer());
|
||||
mRecvAns.AddToAnswer(GetOffer(), mSsrcGenerator, &GetAnswer());
|
||||
}
|
||||
|
||||
void Negotiate() {
|
||||
|
@ -107,7 +107,7 @@ nsresult JsepSessionImpl::AddTransceiver(RefPtr<JsepTransceiver> transceiver) {
|
||||
|
||||
// Make sure we have identifiers for send track, just in case.
|
||||
// (man I hate this)
|
||||
if (transceiver->mSendTrack.GetTrackId().empty()) {
|
||||
if (mEncodeTrackId) {
|
||||
std::string trackId;
|
||||
if (!mUuidGen->Generate(&trackId)) {
|
||||
JSEP_SET_ERROR("Failed to generate UUID for JsepTrack");
|
||||
@ -257,8 +257,8 @@ nsresult JsepSessionImpl::CreateOfferMsection(const JsepOfferOptions& options,
|
||||
nsresult rv = AddTransportAttributes(msection, SdpSetupAttribute::kActpass);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
transceiver.mSendTrack.AddToOffer(mSsrcGenerator, mEncodeTrackId, msection);
|
||||
transceiver.mRecvTrack.AddToOffer(mSsrcGenerator, mEncodeTrackId, msection);
|
||||
transceiver.mSendTrack.AddToOffer(mSsrcGenerator, msection);
|
||||
transceiver.mRecvTrack.AddToOffer(mSsrcGenerator, msection);
|
||||
|
||||
AddExtmap(msection);
|
||||
|
||||
@ -538,10 +538,8 @@ nsresult JsepSessionImpl::CreateAnswerMsection(
|
||||
rv = AddTransportAttributes(&msection, role);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
transceiver.mSendTrack.AddToAnswer(remoteMsection, mSsrcGenerator,
|
||||
mEncodeTrackId, &msection);
|
||||
transceiver.mRecvTrack.AddToAnswer(remoteMsection, mSsrcGenerator,
|
||||
mEncodeTrackId, &msection);
|
||||
transceiver.mSendTrack.AddToAnswer(remoteMsection, mSsrcGenerator, &msection);
|
||||
transceiver.mRecvTrack.AddToAnswer(remoteMsection, mSsrcGenerator, &msection);
|
||||
|
||||
// Add extmap attributes. This logic will probably be moved to the track,
|
||||
// since it can be specified on a per-sender basis in JS.
|
||||
|
@ -106,9 +106,9 @@ void JsepTrack::PopulateCodecs(
|
||||
EnsureNoDuplicatePayloadTypes(&mPrototypeCodecs);
|
||||
}
|
||||
|
||||
void JsepTrack::AddToOffer(SsrcGenerator& ssrcGenerator, bool encodeTrackId,
|
||||
void JsepTrack::AddToOffer(SsrcGenerator& ssrcGenerator,
|
||||
SdpMediaSection* offer) {
|
||||
AddToMsection(mPrototypeCodecs, encodeTrackId, offer);
|
||||
AddToMsection(mPrototypeCodecs, offer);
|
||||
|
||||
if (mDirection == sdp::kSend) {
|
||||
std::vector<JsConstraints> constraints;
|
||||
@ -120,7 +120,7 @@ void JsepTrack::AddToOffer(SsrcGenerator& ssrcGenerator, bool encodeTrackId,
|
||||
}
|
||||
|
||||
void JsepTrack::AddToAnswer(const SdpMediaSection& offer,
|
||||
SsrcGenerator& ssrcGenerator, bool encodeTrackId,
|
||||
SsrcGenerator& ssrcGenerator,
|
||||
SdpMediaSection* answer) {
|
||||
// We do not modify mPrototypeCodecs here, since we're only creating an
|
||||
// answer. Once offer/answer concludes, we will update mPrototypeCodecs.
|
||||
@ -130,7 +130,7 @@ void JsepTrack::AddToAnswer(const SdpMediaSection& offer,
|
||||
return;
|
||||
}
|
||||
|
||||
AddToMsection(codecs, encodeTrackId, answer);
|
||||
AddToMsection(codecs, answer);
|
||||
|
||||
if (mDirection == sdp::kSend) {
|
||||
std::vector<JsConstraints> constraints;
|
||||
@ -169,7 +169,7 @@ bool JsepTrack::SetJsConstraints(
|
||||
|
||||
void JsepTrack::AddToMsection(
|
||||
const std::vector<UniquePtr<JsepCodecDescription>>& codecs,
|
||||
bool encodeTrackId, SdpMediaSection* msection) {
|
||||
SdpMediaSection* msection) {
|
||||
MOZ_ASSERT(msection->GetMediaType() == mType);
|
||||
MOZ_ASSERT(!codecs.empty());
|
||||
|
||||
@ -180,10 +180,10 @@ void JsepTrack::AddToMsection(
|
||||
if ((mDirection == sdp::kSend) && (mType != SdpMediaSection::kApplication) &&
|
||||
msection->IsSending()) {
|
||||
if (mStreamIds.empty()) {
|
||||
msection->AddMsid("-", encodeTrackId ? mTrackId : "");
|
||||
msection->AddMsid("-", mTrackId);
|
||||
} else {
|
||||
for (const std::string& streamId : mStreamIds) {
|
||||
msection->AddMsid(streamId, encodeTrackId ? mTrackId : "");
|
||||
msection->AddMsid(streamId, mTrackId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -186,10 +186,9 @@ class JsepTrack {
|
||||
}
|
||||
|
||||
// These two are non-const because this is where ssrcs are chosen.
|
||||
virtual void AddToOffer(SsrcGenerator& ssrcGenerator, bool encodeTrackId,
|
||||
SdpMediaSection* offer);
|
||||
virtual void AddToOffer(SsrcGenerator& ssrcGenerator, SdpMediaSection* offer);
|
||||
virtual void AddToAnswer(const SdpMediaSection& offer,
|
||||
SsrcGenerator& ssrcGenerator, bool encodeTrackId,
|
||||
SsrcGenerator& ssrcGenerator,
|
||||
SdpMediaSection* answer);
|
||||
|
||||
virtual void Negotiate(const SdpMediaSection& answer,
|
||||
@ -243,7 +242,7 @@ class JsepTrack {
|
||||
const std::vector<UniquePtr<JsepCodecDescription>>& codecs,
|
||||
std::vector<uint16_t>* pts);
|
||||
void AddToMsection(const std::vector<UniquePtr<JsepCodecDescription>>& codecs,
|
||||
bool encodeTrackId, SdpMediaSection* msection);
|
||||
SdpMediaSection* msection);
|
||||
void GetRids(const SdpMediaSection& msection, sdp::Direction direction,
|
||||
std::vector<SdpRidAttributeList::Rid>* rids) const;
|
||||
void CreateEncodings(
|
||||
|
Loading…
Reference in New Issue
Block a user