Bug 1304504 - Check the return value of GetIntPref() properly. r+=rjesup

This commit is contained in:
ISHIKAWA, Chiaki 2016-10-01 03:28:00 +02:00
Родитель a344a8d7c4
Коммит 365dcfe220
1 изменённых файлов: 28 добавлений и 16 удалений

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

@ -23,6 +23,8 @@
#include "webrtc/video_engine/include/vie_errors.h"
#include "webrtc/video_engine/vie_defines.h"
#include "mozilla/Unused.h"
#ifdef MOZ_WIDGET_ANDROID
#include "AndroidJNIWrapper.h"
#endif
@ -277,18 +279,24 @@ WebrtcVideoConduit::InitMain()
if (branch)
{
int32_t temp;
(void) NS_WARN_IF(NS_FAILED(branch->GetBoolPref("media.video.test_latency", &mVideoLatencyTestEnable)));
(void) NS_WARN_IF(NS_FAILED(branch->GetIntPref("media.peerconnection.video.min_bitrate", &temp)));
if (temp >= 0) {
mMinBitrate = temp;
Unused << NS_WARN_IF(NS_FAILED(branch->GetBoolPref("media.video.test_latency", &mVideoLatencyTestEnable)));
if (!NS_WARN_IF(NS_FAILED(branch->GetIntPref("media.peerconnection.video.min_bitrate", &temp))))
{
if (temp >= 0) {
mMinBitrate = temp;
}
}
(void) NS_WARN_IF(NS_FAILED(branch->GetIntPref("media.peerconnection.video.start_bitrate", &temp)));
if (temp >= 0) {
mStartBitrate = temp;
if (!NS_WARN_IF(NS_FAILED(branch->GetIntPref("media.peerconnection.video.start_bitrate", &temp))))
{
if (temp >= 0) {
mStartBitrate = temp;
}
}
(void) NS_WARN_IF(NS_FAILED(branch->GetIntPref("media.peerconnection.video.max_bitrate", &temp)));
if (temp >= 0) {
mMaxBitrate = temp;
if (!NS_WARN_IF(NS_FAILED(branch->GetIntPref("media.peerconnection.video.max_bitrate", &temp))))
{
if (temp >= 0) {
mMaxBitrate = temp;
}
}
if (mMinBitrate != 0 && mMinBitrate < webrtc::kViEMinCodecBitrate) {
mMinBitrate = webrtc::kViEMinCodecBitrate;
@ -299,14 +307,18 @@ 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;
if (!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) {
mLoadManager = LoadManagerBuild();
if (!NS_WARN_IF(NS_FAILED(branch->GetBoolPref("media.navigator.load_adapt", &use_loadmanager))))
{
if (use_loadmanager) {
mLoadManager = LoadManagerBuild();
}
}
}
}