xbmc / xbmc/inputstream.adaptive

[Bug] [HLS] IA chooses the wrong audio stream - Ignoring the AUDIO / group-id

Open
#2,101 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Triage: Needed
Dominant language
C++
Stars
531
Forks
270
Avg merge
2d 23h
Merged PRs (30d)
3

Description

Describe the problem

With the below, IA will try to use the "233" audio even though the single video stream has AUDIO="234"
With ffmpeg will use and only show the single "234" audio stream.

It might only happen when there is a single video stream.
As if I pass the entire manifest through - IA has the 2nd audio stream listed first and it uses that.
However, it then keeps in-correctly using that for the lowest quality video stream that should use "233"

Possible fix

Remove / ignore audio streams without a matching group-id to the currently playing video stream

Steps to reproduce
  1. Create a HLS manifest with 2x audio streams with GROUP-ID="1" and GROUP-ID="2" in that order
    Have DEFAULT NO and AUTOSELECT YES on both
  2. Add single video stream with AUDIO="2"
  3. Play the HLS
  4. Observe IA will just select the first audio stream - when it should use the 2nd
  5. ffmpeg doesn't even show the first audio stream
Debug log

..

Stream manifest file(s)
#EXTM3U
#EXT-X-INDEPENDENT-SEGMENTS
#EXT-X-MEDIA:URI="https://example.com/audio/playlist/233.m3u8",TYPE="AUDIO",GROUP-ID="233",NAME="Default",DEFAULT="NO",AUTOSELECT="YES"
#EXT-X-MEDIA:URI="https://example.com/audio/playlist/234.m3u8",TYPE="AUDIO",GROUP-ID="234",NAME="Default",DEFAULT="NO",AUTOSELECT="YES"
#EXT-X-STREAM-INF:BANDWIDTH=7171631,CODECS="avc1.64002A,mp4a.40.2",RESOLUTION=1920x1080,FRAME-RATE=60,VIDEO-RANGE=SDR,AUDIO="234",CLOSED-CAPTIONS=NONE
https://manifest.googlevideo.com/api/manifest/hls_playlist/expire/1787380794/playlist/video.m3u8
Additional info

No response

Operating system(s)

Windows

Operating system version(s)

11

InputStream Adaptive version(s)

22.3.20

Kodi version(s)

22

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the issue with the supplied HLS manifest, then trace the HLS audio and video stream selection logic. Check how the video stream's AUDIO group-id is matched against available audio streams. Done means playback selects only the audio stream whose group-id matches the selected video stream, including the single-video-stream case.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
audio-video-rtc
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.