Skip to content

Conversation

TomVarga
Copy link
Contributor

@TomVarga TomVarga commented Oct 7, 2025

This issue is spawned from #2484 (comment)

summary:

at

long segmentIndex =
min(
positionInPlaylistUs / mediaPlaylist.targetDurationUs,
mediaPlaylist.segments.size() - 1);

using mediaPlaylist.targetDurationUs can lead to identifying the wrong index as it's not guranteed that all segments will match the target duration. Especially around interstitial boundaries it's happens often that the actual segment duration is vastly different. This happening a lot of time in a stream can lead to identifying the wrong target segment.

The proposed solution instead looks at the actual segment duration to find the best match.

I went with a binary search to try and improve performance for long streams. Our live sliding window streams have more than 1500 segments per playlist.

@TomVarga
Copy link
Contributor Author

TomVarga commented Oct 7, 2025

@marcbaechinger do please let me know if you think this needs further improvement.

@marcbaechinger
Copy link
Contributor

Thanks Tamás! Yup, will take that asap.

@marcbaechinger marcbaechinger self-requested a review October 8, 2025 12:41
@marcbaechinger marcbaechinger self-assigned this Oct 8, 2025
@marcbaechinger marcbaechinger force-pushed the tv/public-strict-matching-of-segment-boundary branch from 1f2e1d0 to 4613ca5 Compare October 14, 2025 19:59
@marcbaechinger
Copy link
Contributor

Looks nice, thank you!

I'm going to send this for internal review now. You may see some more commits being added as I make changes in response to review feedback. Please refrain from pushing any more substantive changes as it will complicate the internal review - thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants