Skip to content

Commit 6fd2fb9

Browse files
committed
MeasuringStream fix rounding error
1 parent 6263ad9 commit 6fd2fb9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/AudioTools/CoreAudio/AudioStreams.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -783,13 +783,13 @@ class MeasuringStream : public ModifyingStream {
783783
/// Provides the estimated runtime in milliseconds for the indicated total
784784
uint32_t estimatedTotalTimeFor(uint32_t totalBytes) {
785785
if (bytesSinceBegin()==0) return 0;
786-
return timeSinceBegin() / bytesSinceBegin() * totalBytes;
786+
return static_cast<float>(timeSinceBegin()) / bytesSinceBegin() * totalBytes;
787787
}
788788

789789
/// Provides the estimated time from now to the end in ms
790790
uint32_t estimatedOpenTimeFor(uint32_t totalBytes) {
791791
if (bytesSinceBegin()==0) return 0;
792-
return estimatedTotalTimeFor(totalBytes) -timeSinceBegin();
792+
return estimatedTotalTimeFor(totalBytes) - timeSinceBegin();
793793
}
794794

795795
/// Alternative update method: e.g report actual file positon: returns true if the file position was increased

0 commit comments

Comments
 (0)