//#region src/elements/EFMedia/shared/PrecisionUtils.ts
/**
* Centralized precision utilities for consistent timing calculations across the media pipeline.
*
* The key insight is that floating-point precision errors can cause inconsistencies between:
* 1. Segment selection logic (in AssetMediaEngine.computeSegmentId)
* 2. Sample finding logic (in SampleBuffer.find)
* 3. Timeline mapping (in BufferedSeekingInput.seek)
*
* All timing calculations must use the same rounding strategy to ensure consistency.
*/
/**
* Round time to millisecond precision to handle floating-point precision issues.
* Uses Math.round for consistent behavior across the entire pipeline.
*
* This function should be used for ALL time-related calculations that need to be
* compared between different parts of the system.
*/
const roundToMilliseconds = (timeMs) => {
	return Math.round(timeMs * 1e3) / 1e3;
};
/**
* Convert media time (in seconds) to scaled time units using consistent rounding.
* This is used in segment selection to convert from milliseconds to timescale units.
*/
const convertToScaledTime = (timeMs, timescale) => {
	const scaledTime = timeMs / 1e3 * timescale;
	return Math.round(scaledTime);
};

//#endregion
export { convertToScaledTime, roundToMilliseconds };
//# sourceMappingURL=PrecisionUtils.js.map