Backed out changeset 6a57b36e6c17 (bug 1308481) for assertions, e.g. in test_peerConnection_asymmetricIsolation.html. r=backout

This commit is contained in:
Sebastian Hengst 2016-11-20 12:52:26 +01:00
Родитель 3ba0d236a1
Коммит b6d231ee51
2 изменённых файлов: 24 добавлений и 27 удалений

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

@ -49,12 +49,6 @@ static const char* logTag ="WebrtcVideoSessionConduit";
// 32 bytes is what WebRTC CodecInst expects
const unsigned int WebrtcVideoConduit::CODEC_PLNAME_SIZE = 32;
template<typename T>
T MinIgnoreZero(const T& a, const T& b)
{
return std::min(a? a:b, b? b:a);
}
/**
* Factory Method for VideoConduit
*/
@ -101,8 +95,7 @@ WebrtcVideoConduit::WebrtcVideoConduit():
mVideoLatencyAvg(0),
mMinBitrate(0),
mStartBitrate(0),
mPrefMaxBitrate(0),
mNegotiatedMaxBitrate(0),
mMaxBitrate(0),
mMinBitrateEstimate(0),
mRtpStreamIdEnabled(false),
mRtpStreamIdExtId(0),
@ -302,8 +295,7 @@ WebrtcVideoConduit::InitMain()
if (!NS_WARN_IF(NS_FAILED(branch->GetIntPref("media.peerconnection.video.max_bitrate", &temp))))
{
if (temp >= 0) {
mPrefMaxBitrate = temp;
mNegotiatedMaxBitrate = temp; // simplifies logic in SelectBitrate (don't have to do two limit tests)
mMaxBitrate = temp;
}
}
if (mMinBitrate != 0 && mMinBitrate < webrtc::kViEMinCodecBitrate) {
@ -312,8 +304,8 @@ WebrtcVideoConduit::InitMain()
if (mStartBitrate < mMinBitrate) {
mStartBitrate = mMinBitrate;
}
if (mPrefMaxBitrate && mStartBitrate > mPrefMaxBitrate) {
mStartBitrate = mPrefMaxBitrate;
if (mStartBitrate > mMaxBitrate) {
mStartBitrate = mMaxBitrate;
}
if (!NS_WARN_IF(NS_FAILED(branch->GetIntPref("media.peerconnection.video.min_bitrate_estimate", &temp))))
{
@ -751,8 +743,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;
@ -1104,6 +1094,12 @@ WebrtcVideoConduit::ConfigureRecvMediaCodecs(
return kMediaConduitNoError;
}
template<typename T>
T MinIgnoreZero(const T& a, const T& b)
{
return std::min(a? a:b, b? b:a);
}
struct ResolutionAndBitrateLimits {
uint32_t resolution_in_mb;
uint16_t min_bitrate;
@ -1182,15 +1178,13 @@ WebrtcVideoConduit::SelectBitrates(unsigned short width,
}
out_start = std::max(out_start, out_min);
// Note: mNegotiatedMaxBitrate is the max transport bitrate - it applies to
// a single codec encoding, but should also apply to the sum of all
// simulcast layers in this encoding! So sum(layers.maxBitrate) <=
// mNegotiatedMaxBitrate
// Note that out_max already has had mPrefMaxBitrate applied to it
if (mNegotiatedMaxBitrate != 0 && mNegotiatedMaxBitrate > out_max) {
out_max = mNegotiatedMaxBitrate;
// Note: mMaxBitrate is the max transport bitrate - it applies to a
// single codec encoding, but should also apply to the sum of all
// simulcast layers in this encoding!
// So sum(layers.maxBitrate) <= mMaxBitrate
if (mMaxBitrate && mMaxBitrate > out_max) {
out_max = mMaxBitrate;
}
MOZ_ASSERT(out_max <= mPrefMaxBitrate);
}
static void ConstrainPreservingAspectRatioExact(uint32_t max_fs,
@ -1975,9 +1969,7 @@ WebrtcVideoConduit::CodecConfigToWebRTCCodec(const VideoCodecConfig* codecInfo,
cinst.minBitrate = mMinBitrate ? mMinBitrate : 200;
cinst.startBitrate = mStartBitrate ? mStartBitrate : 300;
cinst.targetBitrate = cinst.startBitrate;
cinst.maxBitrate = MinIgnoreZero(2000U, codecInfo->mEncodingConstraints.maxBr)/1000;
// not mNegotiatedMaxBitrate! cinst.maxBitrate is the max for the codec, which will be overridden
cinst.maxBitrate = MinIgnoreZero(cinst.maxBitrate, mPrefMaxBitrate);
cinst.maxBitrate = mMaxBitrate ? mMaxBitrate : 2000;
if (cinst.codecType == webrtc::kVideoCodecH264)
{
@ -1989,6 +1981,12 @@ WebrtcVideoConduit::CodecConfigToWebRTCCodec(const VideoCodecConfig* codecInfo,
cinst.codecSpecific.H264.constraints = codecInfo->mConstraints;
cinst.codecSpecific.H264.level = codecInfo->mLevel;
cinst.codecSpecific.H264.packetizationMode = codecInfo->mPacketizationMode;
if (codecInfo->mEncodingConstraints.maxBr > 0) {
// webrtc.org uses kbps, we use bps
cinst.maxBitrate =
MinIgnoreZero(cinst.maxBitrate,
codecInfo->mEncodingConstraints.maxBr)/1000;
}
if (codecInfo->mEncodingConstraints.maxMbps > 0) {
// Not supported yet!
CSFLogError(logTag, "%s H.264 max_mbps not supported yet ", __FUNCTION__);

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

@ -401,8 +401,7 @@ private:
uint64_t mVideoLatencyAvg;
uint32_t mMinBitrate;
uint32_t mStartBitrate;
uint32_t mPrefMaxBitrate;
uint32_t mNegotiatedMaxBitrate;
uint32_t mMaxBitrate;
uint32_t mMinBitrateEstimate;
bool mRtpStreamIdEnabled;