jellyfin-chromecast
jellyfin-chromecast copied to clipboard
HLS+passthrough not working
EDIT: I'm hijacking this issue to continue with this problem
Describe the bug When chromecast gen2 is set to stereo only / auto mode with 2ch screen, it's still detected as 6ch and ends up with aac 6ch which it doesn't seem to deal with.
The symptoms of this bug is that it seems to play but just skips super fast through. If you're one of the lucky few with access to logs, you'll see: "media_player.js:87 [ 14.293s] [cast.player.api.Host] error: cast.player.api.ErrorCode.PLAYBACK/104"
To Reproduce
- chromecast gen2
- 2 channel only tv (maybe?)
- play something where the source has 6 channels or more
Expected behavior Honestly I expected either aac/mp3 2ch or ac-3 6ch. I was thinking something like this:
if deviceType == GEN1GEN2:
if numChannels > 2:
codecs = ac-3
else:
codecs = aac,mp3
System (please complete the following information):
- OS: debian
- Browser: chromium
- Jellyfin Version: 10.6.4
- Cast client: gen2
Additional context am available for debugging :) What's needed for ac-3 and can I help with that?
May be you can add conditions here the limit channels for GEN1/GEN2. https://github.com/jellyfin/jellyfin-chromecast/blob/7ca38e2978400d274c1cd431912cdebe7373b522/src/components/deviceprofileBuilder.ts#L180-L196
I suppose we could do like this in codecSupportHelper.ts
export function hasEAC3Support(): boolean {
return castContext.canDisplayType("audio/mp4", "ec-3");
}
export function hasAC3Support(): boolean {
return castContext.canDisplayType("audio/mp4", "ac-3");
}
Then use those functions to try to get some directplay running, or to transcode to the best one available.
There lacks some support for figuring out if non-passthrough codecs can use more than two channels.
The problem is that I don't think canDisplayType can tell if you have something to passthrough or not so I think it returns true no matter what. I think eac-3 is checked for when we decide the number of channels (in maincontroller.js)
It changed its output according to my chromecast settings, so in stereo mode it returned false. In AC-3 mode I still can't figure out why it fails...
AC-3 is checked in maincontroller.js but I moved it over to codecSupportHelper because it works equally well and is much cleaner.
So assuming the chromecast behaved properly, I think this method works perfectly well.
However, newer chromecast models seems to accept aac 6ch, by sending PCM 6ch over HDMI. I guess that would just have to be a version/generation check.
Then the only task left is to figure out if (e)ac-3 passthrough should be prioritized or not, I think maybe ac3/eac3 whenever it's direct stream but aac would be much better per bitrate.
- https://stackoverflow.com/questions/34468980/hls-streams-with-ac3-audio-not-working-on-chromecast
- https://github.com/googlecast/CastReceiver/issues/7
I'm starting to worry if one would have to ditch HLS to get AC-3 working :(
I've posted this: https://stackoverflow.com/questions/65152677/ac-3-and-e-ac-3-passthrough-with-hls
Linking here for reference
https://support.google.com/chromecast/thread/362511?hl=en It also seems like chromecast across the board will become sad with 6 ch aac.
#100
Great suggestion from @cvium is that the google API only returns 411 two places so we can try to debug inside of the javascript api to figure out what it's doing.
I have reported it upstream at: https://issuetracker.google.com/issues/174837344
See the issue for example code and detailed problem description