Fix undefined reference to log2 on android

R=nisse@webrtc.org
TBR=sakal@webrtc.org, sprang@webrtc.org

Review URL: https://codereview.webrtc.org/2341433004 .

Cr-Commit-Position: refs/heads/master@{#14225}
This commit is contained in:
Kári Tristan Helgason
2016-09-15 10:56:19 +02:00
parent 89fb9201b7
commit 5a20ed36e6

View File

@ -10,8 +10,15 @@
#include "webrtc/modules/video_coding/utility/quality_scaler.h"
#include <math.h>
#include <algorithm>
#include <cmath>
// TODO(kthelgason): Some versions of Android have issues with log2.
// See https://code.google.com/p/android/issues/detail?id=212634 for details
#if defined(WEBRTC_ANDROID)
#define log2(x) (log(x) / log(2))
#endif
namespace webrtc {
@ -182,7 +189,7 @@ void QualityScaler::UpdateTargetResolution(int width, int height) {
maximum_shift_ = 0;
} else {
maximum_shift_ = static_cast<int>(
std::log2(std::min(width, height) / kMinDownscaleDimension));
log2(std::min(width, height) / kMinDownscaleDimension));
}
target_res_ = Resolution{width, height};
}