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

Commit 82b657f4 authored by Wei Jia's avatar Wei Jia
Browse files

Fix bugs regarding clamping of numFrames variable.

there is a clamping value in getDurationUsIfPlayedAtSampleRate function
numFrames parameter is uint32_t type. when return value, cast uint32_t to int32_t.
that make clamp value of numFrames
Test: compiles
Bug: 123665692

Change-Id: I12e35df3030659bc10b3e86ed9d1712be6b62a88
parent bceab46b
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -1156,8 +1156,7 @@ int64_t NuPlayer2::Renderer::getDurationUsIfPlayedAtSampleRate(uint32_t numFrame
        ALOGE("sampleRate is 0 in %s mode", offloadingAudio() ? "offload" : "non-offload");
        return 0;
    }
    // TODO: remove the (int32_t) casting below as it may overflow at 12.4 hours.
    return (int64_t)((int32_t)numFrames * 1000000LL / sampleRate);
    return (int64_t)(numFrames * 1000000LL / sampleRate);
}

// Calculate duration of pending samples if played at normal rate (i.e., 1.0).