Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e8298a73 authored by Ryszard Grzesica's avatar Ryszard Grzesica Committed by Rohit Yengisetty
Browse files

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 27e47ce3)
parent 57ccfe17
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -129,6 +129,11 @@ bool VideoFrameScheduler::PLL::fit(
        numSamplesToUse = mNumSamples;
        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 sumX = 0;
    int64_t sumXX = 0;
    int64_t sumXX = 0;
    int64_t sumXY = 0;
    int64_t sumXY = 0;