inputstream.adaptive
inputstream.adaptive copied to clipboard
Kodi crashes if segment isn't within the current timeshift buffer window
Bug report
Describe the bug
Here is a clear and concise description of what the problem is:
As per the title
Expected Behavior
Here is a clear and concise description of what was expected to happen:
No crash
Actual Behavior
Crash
Possible Fix
To Reproduce
Steps to reproduce the behavior:
- Run this stream:
#KODIPROP:inputstream=inputstream.adaptive
#KODIPROP:inputstream.adaptive.manifest_type=hls
https://cph-p2p-msl.akamaized.net/hls/live/2000341/test/master.m3u8
- Pause for a few minutes or so
- Resume playback
- inputstream.adaptive crashes - vector subscript out of range
Debuglog
The debuglog can be found here: Not needed - place of crash detailed below
MPD/M3U8s/ISM
An example or copy of a manifest (or manifests for HLS - master and variants) can be found here: As above
Screenshots
Here are some links or screenshots to help explain the problem:
Additional context or screenshots (if appropriate)
Here is some additional context or explanation that might help:
https://github.com/xbmc/inputstream.adaptive/blob/9484e974ad1f21a051682b72dbb8647a5a45e3ff/src/common/AdaptiveStream.cpp#L771-L772
After pausing for some time, segment 0 remains the same while the tree (i.e the representation) continues to be updated in the background. Once playback resumes, Kodi wants to read more data and ensureSegment
enters the above code. Due to playlist/rep refreshes, start_number_
has been continually incrementing in the background. The expression underflows and get_segment
is given a number well outside the bounds of segments_
causing the exception.
Your Environment
Used Operating system:
-
[ ] Android
-
[ ] iOS
-
[ ] tvOS
-
[ ] Linux
-
[ ] OSX
-
[ x] Windows
-
[ ] Windows UWP
-
Operating system version/name:
-
Kodi version: 20 - 2022-05-09
-
inputstream.adaptive version: 20.2.0
note: Once the issue is made we require you to update it with new information should that be required. Team Kodi will consider your problem report however, we will not make any promises the problem will be solved.
Then the fix for crash itself is not let the expression underflow? I.e assume 0 if it's negative?
Probably. This code path is new since the adaptive rework and just wanted to find time to understand properly before jumping in.
i have tested but looks like that this has been already fixed on Kodi 21 at least im not able to reproduce it
if you can confirm you can close the issue no one will take care to fix the obsolete code of nexus branch