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
Fix PTS calculation on rollover. #2930
Fix PTS calculation on rollover. #2930
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's nice to have this centralized in the remuxer :)
8f0b2e5
to
aa15efa
Compare
@itsjamie we might want to look into this test failure in more detail:
|
The video PTS is getting messed up with these changes:
Our initPTS is correct at 0. The initial dts samples need to wrap down. This used to be done in ts-demuxer.
|
7c80447
to
a104506
Compare
Here's the fix: a104506#diff-14a34ee6c08b15d0e309d10c2c05f3d0R235 Normalizing |
When a rollover was occuring the timeoffset value was incorrectly calculated due to taking the minimum PTS from the new set of rollovers, this lead to a very large delta on the PTS for the audio and led to incorrect PTS values. This happened to be fixed by the silent gap code just below, which set the sample pts and dts to be the expected next value, but this now makes it so on well-formed media, the else branch is essentially a no-op because the delta is zero.
34b6811
to
cf9a969
Compare
* upstream/master: Disable flakey smooth switch test on stream with large start gap Require min cue duration of 0.25 Package lock update. Minimal Logging on Functional Tests. Handle DTS wrapping in initial AVC CTS calculation Apply PTSNormalize to ID3 and Text samples to handle timestamp rollover Add method to find start pts #2930 Fix PTS calculation on rollover. Bump netlify-cli from 2.58.0 to 2.59.0 Use ES5 in JavaScript executed by webdriver (for IE11) Fix chart fragment rendering issue Do not flush audio on audio track switch when both tracks are main variant streams #2837 Bump @types/mocha from 8.0.0 to 8.0.1 Bump @babel/plugin-proposal-optional-chaining from 7.10.4 to 7.11.0 Bump @babel/core from 7.10.5 to 7.11.0 Improve demo video size menu Clear source buffers from chart when new ones are created Show multiple demo test tabs using modifier key Configure streams for audio and video buffer descrepency in buffer length test
* upstream_hls.js/master: (30 commits) Handle detach and attach media when calling loadSource with media attached Stop loading and reset selected audio track state when reloading a stream Add comment describing additional live start gap allowance Remove cue duration warning, as this is standard for represending event vs time-ranged based metadata in TextTracks that can be signaled during playback with activeCues change events Disable flakey smooth switch test on stream with large start gap Require min cue duration of 0.25 Package lock update. Minimal Logging on Functional Tests. Handle DTS wrapping in initial AVC CTS calculation Apply PTSNormalize to ID3 and Text samples to handle timestamp rollover Add method to find start pts video-dev#2930 Fix PTS calculation on rollover. Bump netlify-cli from 2.58.0 to 2.59.0 Use ES5 in JavaScript executed by webdriver (for IE11) Fix chart fragment rendering issue Do not flush audio on audio track switch when both tracks are main variant streams video-dev#2837 Bump @types/mocha from 8.0.0 to 8.0.1 Bump @babel/plugin-proposal-optional-chaining from 7.10.4 to 7.11.0 Bump @babel/core from 7.10.5 to 7.11.0 Improve demo video size menu
This PR will...
When a rollover was occuring the timeoffset value was incorrectly calculated due to taking the minimum PTS from the new set of rollovers, this lead to a very large timeOffset delta on the audio and led to incorrect PTS values after running through PTSNormalize function.
This happened to be fixed by the silent gap code just below, which set the sample pts and dts to be the expected next value, but this now makes it so on well-formed media, the else branch is essentially a no-op because the delta is zero.
hls.js/src/remux/mp4-remuxer.js
Lines 540 to 548 in ff2646a
Why is this Pull Request needed?
Investigating #1796.
Are there any points in the code the reviewer needs to double check?
Did this against your branch @robwalch since your change fixed the time duration, this now resolves an internal issue with the PTS value because of the timeOffset on a rollover.
I think it just needs a thorough test suite run.
Behaviour prior:
First segment after PTS normalization
Contiguous Segment Prior to PTS Normalization
Contiguous Segment Post PTS Normalization
New Behaviour
Contiguous Segment Post PTS Normalization
Resolves issues:
Checklist