Repository navigation
Conversation
_deleteTrackCues removed cues from the native TextTrack and activeCues but kept them in allCues. The cue window re-added them, and on live streams every parsed cue stayed in memory. Remove cues in the deleted range from allCues too, and use the same range check for activeCues. Refs #5222
pruneBuffer skipped text completely, so for fragmented subtitles in live streams the text buffer and its cues were never removed. Prune text like audio and video for dynamic streams. Static streams keep the previous behaviour. Fixes #5222
Now that deleted cues are released for good, callers that delete too much cause visible caption loss: - onVideoBufferCleared ran for audio and text buffer clears as well, so an audio track switch removed CEA-608 cues of still buffered video. Only handle video buffer clears. - remove() without a range on an empty buffer passed NaN boundaries, which delete every cue of the track. Return early instead. Deleting all cues of a track now clears the interval tree directly. Refs #5222
The interval tree query excludes the range boundaries, so a zero-duration cue on a boundary was not a candidate and stayed in allCues. Widen the query slightly; cueInRange still decides which cues are deleted. Refs #5222
Pruning live text while subtitles were disabled updated the text buffer level every pruning interval and overwrote the disabled state in the metrics. Only prune text of dynamic streams while text is enabled. Refs #5222
Deleted cues are now released for good, so only delete them where the data is loaded again or the memory would otherwise grow: - Switching from an embedded CEA-608 track to a fragmented track no longer deletes the embedded cues. They come from video segments that are not appended again. - Video buffer clears delete embedded cues only in dynamic streams. In static streams they are bounded by the content duration, and a caption that started in an earlier segment is not rebuilt after a seek back. deleteAllTextTracks empties the interval trees at once instead of removing every cue before discarding them. Refs #5222
A non-fragmented subtitle file is not appended again once it is cached, so deleting its cues on a switch to a fragmented track lost them for good. Only delete the cues of a previous fragmented, non-embedded track, which is loaded again when selected. Refs #5222
- Deleted cues are exited and not entered again in manual cue processing, also when all cues of a track are deleted. - TextSourceBuffer.remove() updates the buffered ranges and deletes the cues of the removed range. - The static-stream text pruning test enables text, so the disabled text guard no longer masks it. Refs #5222
- live-text-pruning: the text buffer of live streams is pruned. - seek-back-text: subtitles are shown again after seeking back into a pruned range. - switch-text-keeps-cues: cues of an embedded track are back right after switching to a fragmented track and back. The tests run on all vectors that include text/* and skip where the stream has no suitable track or no subtitles at the checked position. Refs #5222
A cue dispatched in manual rendering mode is not necessarily in the native TextTrack, e.g. when it was dispatched on track selection while paused. Deleting it from the interval tree skipped CUE_EXIT, so the application kept showing it. Exit the dispatched cues of the track within the deleted range before releasing them.
The seek-back test now requires a buffer removal covering the reference range and waits for the seek to complete. The switch test only expects cues that were loaded before the switch and overlap the range after switching back, so sparse subtitles no longer cause false failures.
Any cue in the range after switching back could be a newly parsed one, so the test could pass although the kept track's cues were deleted. Wait for one of the cues recorded before the switch instead.
A parse error removed the whole buffered range of the fragmented track. Cue deletion now also releases the cues from the interval tree, so the correctly parsed subtitles of that range were lost until a seek. Only remove the failed sample from the buffered ranges and keep the cues.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Since v5.1.0 (#4812), every parsed subtitle cue stays in memory during live playback. Deleted cues were never removed from the cue interval tree, and the live text buffer was never pruned.
Fixes #5222
Changes
Known limitation
In live streams, a CEA-608 caption that started in the segment before a DVR seek target is not shown after seeking back into pruned video, as in v4. Keeping all cues of the DVR window would bring the leak back.
Verification
npm test: 4528 passed, 0 failed.text.json: new tests pass; the pruning and switch tests fail with the fixes reverted.