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

Commit 4cf75592 authored by Andy Hung's avatar Andy Hung Committed by Gerrit Code Review
Browse files

Merge "frameCountFromDurationUs: Avoid integer overflow" into main

parents 2000d673 76f06f2c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -175,7 +175,7 @@ constexpr U makeBitPositionFlagMask(std::initializer_list<E> flags) {
}

constexpr int32_t frameCountFromDurationUs(long durationUs, int32_t sampleRateHz) {
    return (durationUs * sampleRateHz) / 1000000LL;
    return (static_cast<long long>(durationUs) * sampleRateHz) / 1000000LL;
}

constexpr int32_t frameCountFromDurationMs(int32_t durationMs, int32_t sampleRateHz) {