summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyszard Grzesica <ryszard.grzesica@sonymobile.com>2015-12-29 06:28:44 +0100
committerandroid-build-team Robot <android-build-team-robot@google.com>2018-06-04 21:51:10 +0000
commit7f8febede196d364fa62ce7feafe9e118162dd10 (patch)
tree389c83311b814cccf18a55fcbc64cc781a8594b6
parent24fc7488580dfab28c286a5be20f83221c3af6a4 (diff)
downloadav-7f8febede196d364fa62ce7feafe9e118162dd10.tar.gz
Add check preventing div0 issue
There might be a scenario while period is zero or after including precision would be zero, prevent from division in that case and return false (to use previously used period). Bug: 73898703 bug: 74067957 Test: run playback as stability test Change-Id: I3fad1060b095b7b5ea4c1f9cb3f9d42a4c503560 (cherry picked from commit 27e47ce3c3bbc0b4dc629163de7ebbba7e80b149)
-rw-r--r--media/libstagefright/VideoFrameScheduler.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/media/libstagefright/VideoFrameScheduler.cpp b/media/libstagefright/VideoFrameScheduler.cpp
index 03226c753e..6819bba40c 100644
--- a/media/libstagefright/VideoFrameScheduler.cpp
+++ b/media/libstagefright/VideoFrameScheduler.cpp
@@ -129,6 +129,11 @@ bool VideoFrameScheduler::PLL::fit(
numSamplesToUse = mNumSamples;
}
+ if ((period >> kPrecision) == 0 ) {
+ ALOGW("Period is 0, or after including precision is 0 - would cause div0, returning");
+ return false;
+ }
+
int64_t sumX = 0;
int64_t sumXX = 0;
int64_t sumXY = 0;