Repository navigation
Drop video track for HLS streams with separate audio when nothing is on screen - #6439
Draft
joashrajin wants to merge 4 commits into
Draft
joashrajin wants to merge 4 commits into
joashrajin wants to merge 4 commits into
Conversation
Contributor
|
Claude finished @joashrajin's task in 2m 9s —— View job Checking Blocking
Non-blocking
|
Collaborator
Generated by 🚫 Danger |
…ected audio group
Collaborator
|
Version |
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.
Description
When playing an HLS podcast stream that has a separate audio rendition, the player now stops downloading and decoding video whenever no video surface is on screen, and restores video as soon as the video view returns.
Previously, all HLS streams were exempted from background video track disabling because muxed HLS streams carry audio inside the video segments and cannot play audio if video is disabled. However, streams published with independent audio renditions (such as
podcast:alternateEnclosureHLS streams) ended up fetching full video (e.g., 1080p) even during background or screen-off listening.In Media3, muxed HLS audio tracks always set
Format.primaryTrackGroupIdto their parent video track group, whereas independent audio renditions (#EXT-X-MEDIA:TYPE=AUDIOwith aURI) haveprimaryTrackGroupId == null.SimplePlayernow checkshasIndependentAudioTrack(tracks)viacurrentTracks:primaryTrackGroupId == null,shouldDisableVideoTrackdisablesC.TRACK_TYPE_VIDEOafter the existing 10-secondVIDEO_TRACK_DISABLE_GRACE_MSgrace period when no surface is attached (both on startup without a surface and after surface detach, giving the UI time to mountVideoViewwithout flushing buffered audio) and re-enables it when a surface attaches.primaryTrackGroupId != null), the video track stays enabled as before so audio playback is unaffected and background listeners are never silently switched to an alternate-language or audio-description rendition.applyVideoTrackSelectionalso skips redundant parameter updates when the video disabled state is unchanged and avoids reading stale tracks duringprepare().Fixes #6365
Testing Instructions
HLS_STREAMINGfeature flag, and play an episode with an HLS stream that has a separate audio rendition (e.g., a Buzzsproutpodcast:alternateEnclosureHLS stream)../gradlew :modules:services:repositories:testDebugUnitTest --tests "au.com.shiftyjelly.pocketcasts.repositories.playback.VideoTrackSelectionTest".Screenshots or Screencast
Not applicable (no UI changes).
Checklist
./gradlew spotlessApplyto automatically apply formatting/linting)modules/services/localization/src/main/res/values/strings.xmlI have tested any UI changes...