frameworks/av
Revision | 0182a2cba07494de4d530ef1c346cf572c83ecc1 (tree) |
---|---|
Time | 2018-05-26 03:38:53 |
Author | Ryszard Grzesica <ryszard.grzesica@sony...> |
Commiter | android-build-team Robot |
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)
@@ -129,6 +129,11 @@ bool VideoFrameScheduler::PLL::fit( | ||
129 | 129 | numSamplesToUse = mNumSamples; |
130 | 130 | } |
131 | 131 | |
132 | + if ((period >> kPrecision) == 0 ) { | |
133 | + ALOGW("Period is 0, or after including precision is 0 - would cause div0, returning"); | |
134 | + return false; | |
135 | + } | |
136 | + | |
132 | 137 | int64_t sumX = 0; |
133 | 138 | int64_t sumXX = 0; |
134 | 139 | int64_t sumXY = 0; |