Bug 1242199: Add lower-limit WebRTC bandwidth pref for testing r=pkerr

--HG--
extra : commitid : EHEwqw6bVUo
This commit is contained in:
Randell Jesup 2016-01-28 23:49:46 -05:00
Родитель fd24a3b3e7
Коммит dbf282a817
5 изменённых файлов: 35 добавлений и 2 удалений

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

@ -139,7 +139,7 @@ skip-if = toolkit == 'gonk' || buildapp == 'mulet' || (android_version == '18' &
[test_peerConnection_promiseSendOnly.html]
skip-if = toolkit == 'gonk' || buildapp == 'mulet' || (android_version == '18' && debug) # b2g(Bug 960442, video support for WebRTC is disabled on b2g), android(Bug 1189784, timeouts on 4.3 emulator)
[test_peerConnection_simulcastOffer.html]
skip-if = toolkit == 'gonk' || buildapp == 'mulet' || android_version || (os == 'linux' && debug) # b2g(Bug 960442, video support for WebRTC is disabled on b2g), no simulcast support on android, linux (bug 1242058)
skip-if = toolkit == 'gonk' || buildapp == 'mulet' || android_version # b2g(Bug 960442, video support for WebRTC is disabled on b2g), no simulcast support on android
#[test_peerConnection_relayOnly.html]
#skip-if = toolkit == 'gonk' || buildapp == 'mulet' # b2g(Bug 960442, video support for WebRTC is disabled on b2g)
[test_peerConnection_callbacks.html]

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

@ -52,7 +52,9 @@
]);
runNetworkTest(() =>
pushPrefs(['media.peerconnection.simulcast', true]).then(() => {
pushPrefs(['media.peerconnection.simulcast', true],
['media.peerconnection.video.min_bitrate_estimate', 100*1000]).then(() => {
SimpleTest.requestCompleteLog();
var stream;
var helper = new CaptureStreamTestHelper2D(50,50);
var canvas = helper.createAndAppendElement('canvas', 'source_canvas');

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

@ -93,6 +93,7 @@ WebrtcVideoConduit::WebrtcVideoConduit():
mMinBitrate(0),
mStartBitrate(0),
mMaxBitrate(0),
mMinBitrateEstimate(0),
mCodecMode(webrtc::kRealtimeVideo)
{}
@ -295,6 +296,10 @@ WebrtcVideoConduit::InitMain()
if (mStartBitrate > mMaxBitrate) {
mStartBitrate = mMaxBitrate;
}
(void) NS_WARN_IF(NS_FAILED(branch->GetIntPref("media.peerconnection.video.min_bitrate_estimate", &temp)));
if (temp >= 0) {
mMinBitrateEstimate = temp;
}
bool use_loadmanager = false;
(void) NS_WARN_IF(NS_FAILED(branch->GetBoolPref("media.navigator.load_adapt", &use_loadmanager)));
if (use_loadmanager) {
@ -721,6 +726,15 @@ WebrtcVideoConduit::ConfigureSendMediaCodec(const VideoCodecConfig* codecConfig)
return kMediaConduitUnknownError;
}
if (mMinBitrateEstimate != 0) {
mPtrViENetwork->SetBitrateConfig(mChannel,
mMinBitrateEstimate,
std::max(video_codec.startBitrate,
mMinBitrateEstimate),
std::max(video_codec.maxBitrate,
mMinBitrateEstimate));
}
if (!mVideoCodecStat) {
mVideoCodecStat = new VideoCodecStatistics(mChannel, mPtrViECodec);
}
@ -1040,6 +1054,12 @@ WebrtcVideoConduit::SelectBandwidth(webrtc::VideoCodec& vie_codec,
if (mStartBitrate && mStartBitrate > vie_codec.startBitrate) {
vie_codec.startBitrate = mStartBitrate;
}
vie_codec.startBitrate = std::max(vie_codec.startBitrate, vie_codec.minBitrate);
// 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 > vie_codec.maxBitrate) {
vie_codec.maxBitrate = mMaxBitrate;
}
@ -1307,6 +1327,15 @@ WebrtcVideoConduit::ReconfigureSendCodec(unsigned short width,
__FUNCTION__, width, height, err);
return NS_ERROR_FAILURE;
}
if (mMinBitrateEstimate != 0) {
mPtrViENetwork->SetBitrateConfig(mChannel,
mMinBitrateEstimate,
std::max(vie_codec.startBitrate,
mMinBitrateEstimate),
std::max(vie_codec.maxBitrate,
mMinBitrateEstimate));
}
CSFLogDebug(logTag, "%s: Encoder resolution changed to %ux%u @ %ufps, bitrate %u:%u",
__FUNCTION__, width, height, mSendingFramerate,
vie_codec.minBitrate, vie_codec.maxBitrate);

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

@ -402,6 +402,7 @@ private:
uint32_t mMinBitrate;
uint32_t mStartBitrate;
uint32_t mMaxBitrate;
uint32_t mMinBitrateEstimate;
static const unsigned int sAlphaNum = 7;
static const unsigned int sAlphaDen = 8;

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

@ -415,6 +415,7 @@ pref("media.getusermedia.browser.enabled", true);
pref("media.peerconnection.video.min_bitrate", 0);
pref("media.peerconnection.video.start_bitrate", 0);
pref("media.peerconnection.video.max_bitrate", 0);
pref("media.peerconnection.video.min_bitrate_estimate", 0);
pref("media.navigator.audio.fake_frequency", 1000);
pref("media.navigator.permission.disabled", false);
pref("media.peerconnection.simulcast", true);