Bug 1320101 - Differentiate between b=TIAS and simulcast stream max-br. r=bwc,jesup

MozReview-Commit-ID: HPnOvwtawwV

--HG--
extra : rebase_source : 9133afc61b48d25f466c0e4a65a743f26eba48c5
This commit is contained in:
Andreas Pehrson 2016-12-07 08:38:13 -10:00
parent 54dd33be82
commit 25fe54f71c
6 changed files with 22 additions and 14 deletions

View File

@ -261,6 +261,9 @@ JsepTrack::CreateEncodings(
const std::vector<JsepCodecDescription*>& negotiatedCodecs,
JsepTrackNegotiatedDetails* negotiatedDetails)
{
negotiatedDetails->mTias = remote.GetBandwidth("TIAS");
// TODO add support for b=AS if TIAS is not set (bug 976521)
std::vector<SdpRidAttributeList::Rid> rids;
GetRids(remote, sdp::kRecv, &rids); // Get rids we will send
NegotiateRids(rids, &mJsEncodeConstraints);
@ -294,8 +297,6 @@ JsepTrack::CreateEncodings(
encoding->mConstraints = jsConstraints.constraints;
}
}
encoding->UpdateMaxBitrate(remote);
}
}

View File

@ -28,6 +28,10 @@ namespace mozilla {
class JsepTrackNegotiatedDetails
{
public:
JsepTrackNegotiatedDetails() :
mTias(0)
{}
size_t
GetEncodingCount() const
{
@ -56,12 +60,18 @@ public:
return mUniquePayloadTypes;
}
uint32_t GetTias() const
{
return mTias;
}
private:
friend class JsepTrack;
std::map<std::string, SdpExtmapAttributeList::Extmap> mExtmap;
std::vector<uint8_t> mUniquePayloadTypes;
PtrVector<JsepTrackEncoding> mEncodings;
uint32_t mTias; // bits per second
};
class JsepTrack

View File

@ -39,16 +39,6 @@ public:
return false;
}
void UpdateMaxBitrate(const SdpMediaSection& remote)
{
uint32_t tias = remote.GetBandwidth("TIAS");
// select minimum of the two which is not zero
mConstraints.maxBr = std::min(tias ? tias : mConstraints.maxBr,
mConstraints.maxBr ? mConstraints.maxBr :
tias);
// TODO add support for b=AS if TIAS is not set (bug 976521)
}
EncodingConstraints mConstraints;
std::string mRid;

View File

@ -90,6 +90,7 @@ public:
bool mRembFbSet;
bool mFECFbSet;
uint32_t mTias;
EncodingConstraints mEncodingConstraints;
struct SimulcastEncoding {
std::string rid;
@ -110,6 +111,7 @@ public:
mType(type),
mName(name),
mFECFbSet(false),
mTias(0),
mEncodingConstraints(constraints),
mProfile(0x42),
mConstraints(0xE0),

View File

@ -732,6 +732,10 @@ WebrtcVideoConduit::ConfigureSendMediaCodec(const VideoCodecConfig* codecConfig)
CSFLogError(logTag, "%s Codec Mismatch ", __FUNCTION__);
return kMediaConduitInvalidSendCodec;
}
// So we can comply with b=TIAS/b=AS/maxbr=X when input resolution changes
mNegotiatedMaxBitrate = codecConfig->mTias / 1000;
// Note: only for overriding parameters from GetCodec()!
CodecConfigToWebRTCCodec(codecConfig, video_codec);
if (mSendingWidth != 0) {
@ -751,8 +755,6 @@ WebrtcVideoConduit::ConfigureSendMediaCodec(const VideoCodecConfig* codecConfig)
mSendingHeight = 0;
mSendingFramerate = video_codec.maxFramerate;
}
// So we can comply with b=TIAS/b=AS/maxbr=X when input resolution changes
mNegotiatedMaxBitrate = MinIgnoreZero(mPrefMaxBitrate, video_codec.maxBitrate);
video_codec.mode = mCodecMode;

View File

@ -167,6 +167,8 @@ NegotiatedDetailsToVideoCodecConfigs(const JsepTrackNegotiatedDetails& aDetails,
return NS_ERROR_INVALID_ARG;
}
config->mTias = aDetails.GetTias();
for (size_t i = 0; i < aDetails.GetEncodingCount(); ++i) {
const JsepTrackEncoding& jsepEncoding(aDetails.GetEncoding(i));
if (jsepEncoding.HasFormat(codec->mDefaultPt)) {
@ -176,6 +178,7 @@ NegotiatedDetailsToVideoCodecConfigs(const JsepTrackNegotiatedDetails& aDetails,
config->mSimulcastEncodings.push_back(encoding);
}
}
aConfigs->values.push_back(config);
}