Skip to content

Commit

Permalink
Do not use "levelCodec" to instantiate SourceBuffer when multiple aud…
Browse files Browse the repository at this point in the history
…io codec strings are present in the Multivariant Playlist variant CODECS attribute with muxed content (#6341)

Fixes #6337
  • Loading branch information
robwalch committed Apr 10, 2024
1 parent 54d62c7 commit 380076a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/controller/buffer-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -929,8 +929,11 @@ export default class BufferController implements ComponentAPI {
`source buffer exists for track ${trackName}, however track does not`,
);
}
// use levelCodec as first priority
let codec = track.levelCodec || track.codec;
// use levelCodec as first priority unless it contains multiple comma-separated codec values
let codec =
track.levelCodec?.indexOf(',') === -1
? track.levelCodec
: track.codec;
if (codec) {
if (trackName.slice(0, 5) === 'audio') {
codec = getCodecCompatibleName(codec, this.appendSource);
Expand Down
2 changes: 1 addition & 1 deletion src/utils/codecs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ export function pickMostCompleteCodecName(
if (parsedCodec && parsedCodec !== 'mp4a') {
return parsedCodec;
}
return levelCodec;
return levelCodec ? levelCodec.split(',')[0] : levelCodec;
}

export function convertAVC1ToAVCOTI(codec: string) {
Expand Down

0 comments on commit 380076a

Please sign in to comment.