Implement live VOD switching when discontinuities are detected #138
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.
This PR implements automatic live VOD switching when stream discontinuities are detected, addressing playback issues during ad breaks and stream quality problems. The implementation follows the approach used in TwitchLink for handling discontinuous streams.
Key Features
Smart Discontinuity Handling: The system now monitors discontinuities across playlist refresh cycles (not just individual segments) and automatically switches between live HLS and VOD-style playlists to maintain smooth playback.
Configurable Thresholds:
Seamless Integration: Built on top of the existing TX-Queue IPC streaming architecture and TSDuck HLS discontinuity detection, requiring minimal changes to the codebase.
Implementation Details
Extended Twitch API (
twitch_api.h/cpp)GenerateVodPlaylistUrl()function that creates VOD-style URLs when discontinuities persistfast_bread=false, cache busting, etc.)Enhanced TX-Queue Stream Manager (
tx_queue_ipc.h/cpp)Core Logic Flow
Debug Output
The feature provides clear logging to monitor its operation:
Testing
This implementation provides a robust solution for handling stream discontinuities while maintaining compatibility with all existing functionality and streaming modes.
Fixes #137.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.