You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fixes parsing of clock-time expressions with fractional seconds (hh:mm:ss.fraction) in TTML2SRT::GetTime. The digits after the decimal point were added to the timestamp as a raw integer, without taking their count or m_timescale into account. The fraction is now parsed as digits, padded to 9 digits (nanosecond precision, longer fractions are truncated) and scaled by m_timescale. Plain hh:mm:ss without a fraction is handled by its own branch.
Motivation and context
The TTML2 clock-time grammar allows hh:mm:ss.fraction, where the fraction is a fraction of a second with any number of digits. The old code treated the digits as an integer count of timescale units:
00:00:01.5 gave 1 s + 5 units instead of 1.5 s
.05 and .5 both parsed to 5, so leading zeros were lost
the result was only correct by accident for exactly 3 digits at a timescale of 1000
This resulted in wrong cue timings for TTML subtitles with fractional seconds, whenever the fraction did not have exactly 3 digits or the timescale was not 1000.
How has this been tested?
Checked the parsing by hand with m_timescale = 1000 and m_timescale = 90000:
No actionable comments were generated in the recent review. 🎉
ℹ️ Recent review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 446efadd-4360-4a60-b83b-fab1537a4fd1
📥 Commits
Reviewing files that changed from the base of the PR and between 84bdb35 and 9ef9fbb.
📒 Files selected for processing: 1
src/codechandler/ttml/TTML.cpp
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.
📝 Walkthrough
TTML clock-time parsing now reads fractional seconds to nanosecond precision, pads fractions shorter than nine digits, and scales them to the configured timescale.
Changes: TTML clock-time fraction parsing
Layer / File(s)
Summary
Parse and scale clock-time fractions src/codechandler/ttml/TTML.cpp
The fraction accumulator now stores fractional seconds. Clock-time fractions are padded to nine digits and scaled by m_timescale.
Clock-time fractions are now scaled to the configured timescale. The inspected call paths keep the conversion within safe arithmetic bounds, and no concrete merge-blocking risk remains.
### Architecture Summary
Architecture risk:🔵 Low · up to 9ef9f
The change affects 1 system.
Changed systems:src
Architecture concerns
No architecture-level concerns identified.
Review details
Systems and components
observed — src (service) was modified; 1 changed file maps to changed impact.
Before / after behavior
observed — Modified behavior in src/codechandler/ttml/TTML.cpp: The clock-time fraction accumulator changes from milliseconds to fractional seconds (fs).
observed — Modified behavior in src/codechandler/ttml/TTML.cpp: Clock-time fractions are now read with up to nine digits and padded to nanosecond precision before being scaled by m_timescale. Previously, the parsed fraction was added directly to the timestamp, regardless of timescale.
Pre-merge checks: 4 · 1
Failed checks: 1 warning
Check name
Status
Explanation
Resolution
Docstring Coverage
Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files.
Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed checks: 4 passed
Check name
Status
Explanation
Title check
The title clearly and concisely describes the main change: fixing fractional-second parsing for TTML clock-time expressions.
Description check
The description covers the change, motivation, test results, change type, and checklist. It provides concrete examples and test environments. No critical section is missing.
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Fix all pre-merge checks with AI
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes parsing of clock-time expressions with fractional seconds (
hh:mm:ss.fraction) inTTML2SRT::GetTime. The digits after the decimal point were added to the timestamp as a raw integer, without taking their count orm_timescaleinto account. The fraction is now parsed as digits, padded to 9 digits (nanosecond precision, longer fractions are truncated) and scaled bym_timescale. Plainhh:mm:sswithout a fraction is handled by its own branch.Motivation and context
The TTML2 clock-time grammar allows
hh:mm:ss.fraction, where the fraction is a fraction of a second with any number of digits. The old code treated the digits as an integer count of timescale units:00:00:01.5gave 1 s + 5 units instead of 1.5 s.05and.5both parsed to 5, so leading zeros were lostThis resulted in wrong cue timings for TTML subtitles with fractional seconds, whenever the fraction did not have exactly 3 digits or the timescale was not 1000.
How has this been tested?
Checked the parsing by hand with
m_timescale = 1000andm_timescale = 90000:00:00:01.500:00:01.0500:00:01.05000:00:01.500:00:01Tested with real TTML Dash in VRT MAX Add-on: https://github.com/add-ons/plugin.video.vrt.nu
Screenshots (if appropriate):
Types of change
Checklist:
Summary by CodeRabbit