Files
laoyyuandlaoyyu 3faf821870 fix(webvtt): keep a sub-millisecond cue serializable (#1014)
* fix(webvtt): keep a sub-millisecond cue serializable

TrackSource accepts any end_time greater than start_time, but a WebVTT
timestamp only carries milliseconds. Rounding both ends of a sub-millisecond
segment onto the same timestamp produced a zero-length WebVTTCueTimings, whose
validator rejects it, so exporting the document raised ValidationError instead
of emitting the cue.

Build the cue timings through one helper that extends the end by the smallest
representable step when rounding collapsed the range.

Signed-off-by: laoyyu <laoyyu@users.noreply.github.com>

* fix(webvtt): keep a sub-millisecond cue serializable

TrackSource accepts any end_time greater than start_time, but a WebVTT
timestamp only carries milliseconds. Rounding both ends of a sub-millisecond
segment onto the same timestamp produced a zero-length WebVTTCueTimings, whose
validator rejects it, so exporting the document raised ValidationError instead
of emitting the cue.

Build the cue timings through one helper that extends the end by the smallest
representable step when rounding collapsed the range, and log a warning when
that happens, so the loss of precision is visible instead of the timings being
silently rewritten.

Signed-off-by: laoyyu <laoyyu@foxmail.com>

---------

Signed-off-by: laoyyu <laoyyu@users.noreply.github.com>
Signed-off-by: laoyyu <laoyyu@foxmail.com>
Co-authored-by: laoyyu <laoyyu@users.noreply.github.com>
2026-11-14 07:52:54 +01:00
..