Bug 1641600 - Add SetRtxIsAllowed method to JsepTrack and JsepSession; r=bwc

Differential Revision: https://phabricator.services.mozilla.com/D77813
This commit is contained in:
Dan Minor 2020-06-03 20:54:58 +00:00
Родитель 51c76bb2b8
Коммит ee1ae2eb58
5 изменённых файлов: 24 добавлений и 2 удалений

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

@ -207,10 +207,16 @@ class JsepSession {
}
}
// See Bug 1642419, this can be removed when all sites are working with RTX.
void SetRtxIsAllowed(bool aRtxIsAllowed) { mRtxIsAllowed = aRtxIsAllowed; }
protected:
const std::string mName;
JsepSignalingState mState;
uint32_t mNegotiations;
// See Bug 1642419, this can be removed when all sites are working with RTX.
bool mRtxIsAllowed = true;
};
} // namespace mozilla

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

@ -407,7 +407,8 @@ std::vector<SdpExtmapAttributeList::Extmap> JsepSessionImpl::GetRtpExtensions(
AddVideoRtpExtension(webrtc::RtpExtension::kRtpStreamIdUri,
SdpDirectionAttribute::kSendonly);
if (Preferences::GetBool("media.peerconnection.video.use_rtx", false)) {
if (mRtxIsAllowed &&
Preferences::GetBool("media.peerconnection.video.use_rtx", false)) {
AddVideoRtpExtension(webrtc::RtpExtension::kRepairedRtpStreamIdUri,
SdpDirectionAttribute::kSendonly);
}
@ -1949,6 +1950,7 @@ void JsepSessionImpl::SetupDefaultCodecs() {
new JsepAudioCodecDescription("101", "telephone-event", 8000, 1));
bool useRtx =
mRtxIsAllowed &&
Preferences::GetBool("media.peerconnection.video.use_rtx", false);
// Supported video codecs.
// Note: order here implies priority for building offers!

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

@ -451,6 +451,7 @@ std::vector<UniquePtr<JsepCodecDescription>> JsepTrack::NegotiateCodecs(
JsepVideoCodecDescription* cloneVideoCodec =
static_cast<JsepVideoCodecDescription*>(clone.get());
bool useRtx =
mRtxIsAllowed &&
Preferences::GetBool("media.peerconnection.video.use_rtx", false);
videoCodec->mRtxEnabled = useRtx && cloneVideoCodec->mRtxEnabled;
videoCodec->mRtxPayloadType = cloneVideoCodec->mRtxPayloadType;

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

@ -198,7 +198,8 @@ class JsepTrack {
virtual std::vector<uint32_t> GetRtxSsrcs() const {
std::vector<uint32_t> result;
if (Preferences::GetBool("media.peerconnection.video.use_rtx", false)) {
if (mRtxIsAllowed &&
Preferences::GetBool("media.peerconnection.video.use_rtx", false)) {
std::for_each(
mSsrcToRtxSsrc.begin(), mSsrcToRtxSsrc.end(),
[&result](const auto& pair) { result.push_back(pair.second); });
@ -278,6 +279,9 @@ class JsepTrack {
sdp::Direction direction, SsrcGenerator& ssrcGenerator,
bool requireRtxSsrcs, SdpMediaSection* msection);
// See Bug 1642419, this can be removed when all sites are working with RTX.
void SetRtxIsAllowed(bool aRtxIsAllowed) { mRtxIsAllowed = aRtxIsAllowed; }
private:
std::vector<UniquePtr<JsepCodecDescription>> GetCodecClones() const;
static void EnsureNoDuplicatePayloadTypes(
@ -325,6 +329,9 @@ class JsepTrack {
std::map<uint32_t, uint32_t> mSsrcToRtxSsrc;
bool mActive;
bool mRemoteSetSendBit;
// See Bug 1642419, this can be removed when all sites are working with RTX.
bool mRtxIsAllowed = true;
};
} // namespace mozilla

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

@ -177,6 +177,12 @@ class JsepTransceiver {
return false;
}
// See Bug 1642419, this can be removed when all sites are working with RTX.
void SetRtxIsAllowed(bool aRtxIsAllowed) {
mSendTrack.SetRtxIsAllowed(aRtxIsAllowed);
mRecvTrack.SetRtxIsAllowed(aRtxIsAllowed);
}
// This is the direction JS wants. It might not actually happen.
SdpDirectionAttribute::Direction mJsDirection;