-
Notifications
You must be signed in to change notification settings - Fork 411
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Live fMP4 HLS with WebVTT does not display due to timestamp adjustments overflowing int64 #1763
Comments
Thanks for the report.
If you have an easy way to repro with a local dependency on ExoPlayer, could you see if replacing the implementation of
This method is designed to be more overflow-resistant than naive arithmetic. |
Hello, |
Thanks for confirming, I have a change in review to switch to using this method - it will be linked here when submitted and published to GitHub. |
This helps avoid overflows in intermediate calculations. Verified the value in the test using `BigInteger`: ``` jshell> BigInteger.valueOf(1L << 52).multiply(BigInteger.valueOf(90000)).divide(BigInteger.valueOf(1000000)) $3 ==> 405323966463344 ``` Issue: #1763 #cherrypick PiperOrigin-RevId: 684028178
This should be fixed by b6d0540 |
Version
Media3 1.3.1
More version details
commit sha1 d833d59
Devices that reproduce the issue
Android Studio Koala Feature Drop 2024.1.2 Patch 1 Medium Phone API 35 emulator
Devices that do not reproduce the issue
No response
Reproducible in the demo app?
Yes
Reproduction steps
Given the following WebVTT content
Loading this WebVTT fragment will result in a calls to androidx.media3.exoplayer.hls.WebVttExtractor::processSample(). Debugging the following to evaluate sampleTimeUs will reveal an int64 overflow on the timestamp passed to
usToWrappedPts()
When reading fMP4 media, TimestampAdjuster's lastUnadjustedTimestampUs member has a value of 1727354212517266 at the time of the first call to processSample(). This value is in excess of 51-bits, meaning that the call to usToUnwrappedPts() will overflow due to a multiplication with 90000
Note that when the same code executes with HLS TS segments, the value of TimestampAdjuster's lastUnadjustedTimestampUs is a lot smaller: 14405760488 because the first PES header timestamp stayed within 33-bits. It will take many PCR wraparounds before reaching the magnitude seen for fMP4 TFDT 64-bit EPOCH time values above
It is possible to prevent this overflow by multiplying refactored scaling factors 9/100 and 100/9 instead of 90000/1000000 and 1000000/90000
The live HLS playout URL is not available on a permanent basis so an example segment is attached (video + webVtt) that should be enough to initialize exoplayer's TimestampAdjuster and reproduce the issue in debug mode.
A similar issue was opened in April 2023 that relates strongly to this bug report:
google/ExoPlayer#10969
The original issue highlighted a problem with adjustTsTimestamp() but did not dwell on it any further. The workaround cited in the cited issue worked by no longer calling the functions that overflow.
In our case, using scaling factors 9/100 for usToUnwrappedPts and 100/9 for ptsToUs fixes the issue
Expected result
WebVTT content displays when playing fMP4 HLS live feed (as in shakaPlayer and akamai hls.js)
Actual result
Nothing is displayed.
Media
segment_287604122.zip
`
Bug Report
adb bugreport
to [email protected] after filing this issue.The text was updated successfully, but these errors were encountered: