Index: third_party/WebKit/Source/platform/audio/Distance.cpp |
diff --git a/third_party/WebKit/Source/platform/audio/Distance.cpp b/third_party/WebKit/Source/platform/audio/Distance.cpp |
index af25befff1eccc38bf68af304a398c96c8f14d26..99c5a0221aa10008546f78f776b8f3ca13309ed5 100644 |
--- a/third_party/WebKit/Source/platform/audio/Distance.cpp |
+++ b/third_party/WebKit/Source/platform/audio/Distance.cpp |
@@ -67,11 +67,17 @@ double DistanceEffect::LinearGain(double distance) { |
} |
double DistanceEffect::InverseGain(double distance) { |
+ if (ref_distance_ == 0) |
+ return 0; |
+ |
return ref_distance_ / (ref_distance_ + clampTo(rolloff_factor_, 0.0) * |
(distance - ref_distance_)); |
} |
double DistanceEffect::ExponentialGain(double distance) { |
+ if (ref_distance_ == 0) |
+ return 0; |
+ |
return pow(distance / ref_distance_, -clampTo(rolloff_factor_, 0.0)); |
} |