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

Handle PTS rollover on initial sample of video or audio #3083

Merged

Conversation

robwalch
Copy link
Collaborator

@robwalch robwalch commented Oct 8, 2020

This PR will...

Normalize first audio and video PTS/DTS when comparing the two and determining initPTS to ensure elementary media streams are aligned on start.

Why is this Pull Request needed?

In a stream where the first video PTS is a wrapped unsigned integer as seen below, we don't want to base initPTS on this value and attempt to align audio to it.

videoTrack.samples
0: {key: true, pts: 8589933243, dts: 8589933243, units: Array(3), debug: "", …}
1: {key: false, pts: 1711, dts: 1711, units: Array(1), debug: "", …}
2: {key: false, pts: 4681, dts: 4681, units: Array(1), debug: "", …}
3: {key: false, pts: 7651, dts: 7651, units: Array(1), debug: "", …}
4: {key: false, pts: 10711, dts: 10711, units: Array(1), debug: "", …}
5: {key: false, pts: 13681, dts: 13681, units: Array(1), debug: "", …}
6: {key: false, pts: 16651, dts: 16651, units: Array(1), debug: "", …}
audioTrack.samples
0: {unit: Uint8Array(243), pts: 1, dts: 1}
1: {unit: Uint8Array(243), pts: 1921, dts: 1921}
2: {unit: Uint8Array(244), pts: 3841, dts: 3841}
3: {unit: Uint8Array(265), pts: 5761, dts: 5761}
4: {unit: Uint8Array(242), pts: 7681, dts: 7681}
5: {unit: Uint8Array(255), pts: 9601, dts: 9601}
6: {unit: Uint8Array(243), pts: 11521, dts: 11521}

Resolves issues:

#3082

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 0.14.14 milestone Oct 8, 2020
@robwalch
Copy link
Collaborator Author

robwalch commented Oct 8, 2020

@stevendesu please have a look at this fix and let me know if it resolved #3082 for you.

@robwalch robwalch merged commit 3dc13ed into master Oct 8, 2020
@robwalch robwalch deleted the bugfix/handle-pts-rollover-at-start-of-elementary-stream branch October 8, 2020 22:48
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.

None yet

1 participant