jellyfin / jellyfin-roku

The Official Roku Client for Jellyfin
https://jellyfin.org
GNU General Public License v2.0
412 stars 129 forks source link

buffer loop exception:Reserve size (61100564) exceeds max_allocation (46976204) #1554

Open atomheartother opened 7 months ago

atomheartother commented 7 months ago

Software Versions

Describe the bug

When viewing a very long movie in 4k, the roku video client crashes after a long time ( 2h4min on the specific video I use as test). Trying to resume at this time plays the video for a second or two max before the client crashes again. Neither the server nor client print anything in the logs, it just exits.

How To Reproduce

Expected behavior

Logs

There's nothing printed in the logs at the time of the crash. I took a second and edited VideoPlayerView.bs to add some logging. This prints the following values at run time when the crash occurs:

Connection Information

Some more info about the file I'm using to reproduce if that could help:

Video
Title: 4K HEVC HDR
Codec: HEVC
Profile: Main 10
Level: 153
Resolution: 3840x2160
Aspect ratio: 16:9
Interlaced: No
Framerate: 23.976025
Bitrate: 20287 kbps
Bit depth: 10 bit
Video range: HDR
Video range type: HDR10
Color space: bt2020nc
Color transfer: smpte2084
Color primaries: bt2020
Pixel format: yuv420p10le
Ref frames: 1

Audio
Title: English - DTS-HD MA - 5.1 - Default
Language: eng
Codec: DTS
Profile: DTS-HD MA
Layout: 5.1
Channels: 6 ch
Bitrate: 3814 kbps
Sample rate: 48000 Hz
Bit depth: 24 bit
Default: Yes
Forced: No
External: No

Since I really don't know much about Brightscript or roku development I'm not quite sure where to go from there but if someone wants to point me in the right direction, I'm a dev fueled by rage so I'll do anything to get to the bottom of this one.

atomheartother commented 7 months ago

After staring at this error message long enough, I feel like this is essentially telling me my TV literally cannot load this file into its internal buffer because it's too large, does this interpretation make sense? I should mention it's not the highest quality tv.

1hitsong commented 7 months ago

After staring at this error message long enough, I feel like this is essentially telling me my TV literally cannot load this file into its internal buffer because it's too large, does this interpretation make sense? I should mention it's not the highest quality tv.

That's exactly what this is. I had the exact same issue and asked the Roku devs what the error message means since it's not exactly in helpful terms.

They said this is an error thrown from deep within the Roku device that essentially means "Out of Memory."

I personally only had this on my older Roku device. Playing the same file on the 4K Roku sticks had no problems.

atomheartother commented 7 months ago

@1hitsong I figured as much. Ah well at least I learned how to debug jellyfin on my tv. It's a shame it can't handle my power level.

While I'm at it, would you be ok with an MR adding some logging in case of playback errors? I have the code right here, I can clean it up and commit.

cewert commented 7 months ago
  1. Did you guys try playing the files using the Roku Media Player app? It's a media player made by roku and works with jellyfin over DLNA. If the file does the same thing then there's nothing we can do. If the file plays fine that would indicate we might be doing something wrong
  2. Can you guys list your device model# in case this is a device specific thing? It should be in the debug logs as well as on the web client admin dashboard if using unstable. It's a 5 digit code and should match up with one of the devices listed here: https://developer.roku.com/docs/specs/hardware.md
atomheartother commented 7 months ago

@cewert Isn't DLNA just for home networks? My jellyfin instance is remote I'm afraid.

atomheartother commented 7 months ago

Found my model in the jellyfin dashboard, thanks for the tip :)

It's C000X

cewert commented 7 months ago

@atomheartother afaik yea it's local only. It also works with the roku device's USB if that's available and you can get your hands on the file.

If I remember correctly, 1hitsong has a TCL roku TV as well but I'll wait for him to report back before jumping to conclusions :)

Devices that reported this issue:

atomheartother commented 7 months ago

I guess it's time to download this file and set up a local server. Thanks for the pointers, I will be back with results.

1hitsong commented 7 months ago

Video works when playing off USB thumb drive.

Video works when playing over DLNA.

Video stops mid-play with the error when playing through JF Roku client.

32S331 (32 TCL Roku TV) Jellyfin Roku 1.6.6

atomheartother commented 7 months ago

Ok well I wasn't getting any sound, i think because my local server wasn't transcoding, but the file did play after the 2h mark and well into the zone where it failed via Jellyfin, using Roku Media Player over DLNA.

cewert commented 7 months ago

@atomheartother 1hitsong and I were talking and we might have figured this out. The fix in #1557 prevents the crash for him. If you get a chance can you test your file with the PR too? 🤞

atomheartother commented 7 months ago

Nope! I just tried it with that branch and it failed still. I also printed errorStr and it's the same message.

I also tried to ignore the tv's max resolution and set MaxVideoDecodeResolution to 1920x1080, that also did not solve it unfortunately.

atomheartother commented 7 months ago

So, I'm looking at stream & transcoding information, if this helps at all the way the stream works is that the audio is being transcoded (because the original stream is 5.1) but the video is being direct played in 4K HEVC HDR.

1hitsong commented 7 months ago

@atomheartother In the web client, go to the Administration Dashboard. Click on users and then your user account. Under Media playback, what do you have and not have checked?

image

atomheartother commented 7 months ago

Here it is: image