Skip to content
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 handling of negative composition timestamps #4885

Merged
merged 5 commits into from
Sep 9, 2022

Conversation

robwalch
Copy link
Collaborator

@robwalch robwalch commented Sep 8, 2022

This PR will...

Fix handling of negative composition timestamps in MPEG-2 TS remuxing.

Remove loading of "partial" segments. If MSE doesn't append the full segment duration this is likely an issue with the media. This avoids loop loading. Reloading of ejected media is still covered by the fragment tracker.

Why is this Pull Request needed?

This change eliminates the "PTS < DTS" warnings and workarounds. The mp4 "trun" box version is set to 1 to signal that composition timestamps are signed.

Resolves issues:

Fixes #4878

Checklist

  • changes have been done against master branch, and PR does not conflict
  • new unit / functional tests have been added (whenever applicable)
  • API or design changes are documented in API.md

@robwalch robwalch added this to the 1.2.2 milestone Sep 8, 2022
@robwalch robwalch requested a review from itsjamie September 8, 2022 01:11
@@ -1084,7 +1084,7 @@ class MP4 {
offset += 8 + arraylen;
array.set(
[
0x00, // version 0
0x01, // version 1 to signal signed ctts
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we discussed in Slack, given we are producing a track for audio and a separate track for video, according to CMAF we should only use v1 trun for the video track to allow reordering I/P/B frames.

The offset we record should make the composition time match the first media sample decode time.

@robwalch robwalch force-pushed the bugfix/signed-composition-timestamps branch from ca86969 to 50ceebf Compare September 9, 2022 20:22
@robwalch robwalch merged commit 6216ab9 into master Sep 9, 2022
@robwalch robwalch deleted the bugfix/signed-composition-timestamps branch September 9, 2022 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Playback of clear media with 50 FPS is jittering seems like frame dropped
2 participants