Skip to content

Keep the codec set when emergency switching down - #8209

Open
Yahiro025 wants to merge 1 commit into
video-dev:masterfrom
Yahiro025:fix-emergency-switch-codec-set
Open

Yahiro025 wants to merge 1 commit into
video-dev:masterfrom
Yahiro025:fix-emergency-switch-codec-set

Conversation

@Yahiro025

Copy link
Copy Markdown

This PR will...

Keep the emergency switch-down within the codec set of the fragment that is currently loading, instead of choosing a level by bitrate alone.

Why is this Pull Request needed?

_abandonRulesCheck() picks the next level by maxBitrate only. When findBestLevel() rejects that candidate because of its codec set, the rejected level is still used, and the abort fallback goes to minAutoLevel regardless of codec set. On a ladder that mixes codec sets this can change the audio or video codec mid-playback and break the SourceBuffer, as reported in #8208.

The candidate loop now skips levels whose codecSet differs from the loading level, the findBestLevel() result is only used when it keeps that codec set, and the abort fallback picks the lowest level in the same codec set.

Are there any points in the code the reviewer needs to double check?

The filter uses levels[loadingFragForLevel].codecSet because that is the stream being played, while findBestLevel() derives its codec set from lastLoadedFragLevel. The two can differ after a switch, so the result is checked again before it is used.

Resolves issues:

Fixes #8208

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

The emergency switch-down candidate loop only compared bitrates, and its fallbacks used minAutoLevel directly. A level from another codec set could be selected, changing the audio or video codec mid-playback.

Only consider levels with the codec set of the fragment being loaded, and keep that filter on the findBestLevel result and on the abort fallback.

Added an AbrController case with a mixed codec ladder; it selects an avc1 level on the previous code and a hevc level after the change.

This branch has not been deployed

No deployments
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.

Emergency switch down can select a level with a different CODECS set

1 participant