# must fail: playlist_parse_rounding # durations truncated to the millisecond, not rounded (hls::decimal_ms) diff --git a/wai/wai-rs/src/http_binding/hls.rs b/wai/wai-rs/src/http_binding/hls.rs index 2623644b..552dbde8 100644 --- a/wai/wai-rs/src/http_binding/hls.rs +++ b/wai/wai-rs/src/http_binding/hls.rs @@ -92,7 +92,7 @@ pub fn decimal_ms(s: &str) -> Option { let digit = |i: usize| f.as_bytes().get(i).map_or(0, |b| u64::from(b - b'0')); let whole: u64 = int.parse().ok()?; let ms = whole.checked_mul(1000)?.checked_add(digit(0) * 100 + digit(1) * 10 + digit(2))?; - if digit(3) >= 5 { ms.checked_add(1) } else { Some(ms) } + if digit(3) >= 10 { ms.checked_add(1) } else { Some(ms) } } fn decimal_int(s: &str) -> Option {