xbmc / xbmc

Kodi is an award-winning free and open source home theater/media center software and entertainment hub for digital media. With its beautiful interface and powerful skinning engine, it's available for Android, BSD, Linux, macOS, iOS, tvOS and Windows.
https://kodi.tv/
Other
18.29k stars 6.29k forks source link

[Kodi 20][InputStream][Demuxer] DEMUX_SPECIALID_STREAMCHANGE reinitialize and disable the subtitles #20404

Closed CastagnaIT closed 2 years ago

CastagnaIT commented 2 years ago

Bug report

Describe the bug

Here is a clear and concise description of what the problem is:

I am working to the new webvtt subtitles handler, then i have done several tests in various ways, and i noticed a problem that cause subtitles to be disabled without apparently reasons when you play a video with ISAdaptive add-on.

I have not a full picture in how all demuxer thing works, but there is something wrong somewhere, i try explain how i can

The InputStreamAdaptive add-on (on Nexus branch), has now the new feature to switch streams based on available bandwidth, then in theory should send this DEMUX_SPECIALID_STREAMCHANGE empty packet to kodi demuxer every time that a stream change.

As i have read here https://github.com/xbmc/xbmc/blob/master/xbmc/addons/kodi-dev-kit/include/kodi/addon-instance/Inputstream.h#L1522-L1534 explains that this reinitialize kodi player every time, then kodi request all streams again

The problem happen that, if you are playing a video with subtitles enabled and ISA do the DEMUX_SPECIALID_STREAMCHANGE callback, kodi disable the current subtitles displayed, then every time you have to open the GUI menu and re-enable the subtitles, again, again and again...infinitely...

OFC this, cause the resettings also of the current subtitle overlay instance loaded (from the log you can see CDVDSubtitlesLibass reloaded and the subs data is reparsed every time), this means that every time that a stream change, the full subtitle data will be reparsed in full every time, i find this behaviour excessive...

Maybe a possible solution could be to create a new different "DEMUX_SPECIALID_STREAMCHANGE" that allow resetting only audio/video streams and do not touch the subtitles streams, in order to keep the currently used subtitle overlay instance without recreate it from scratch and then avoid reparse whole subtitle data every time this callback happen

Expected Behavior

Here is a clear and concise description of what was expected to happen:

Actual Behavior

Possible Fix

To Reproduce

Steps to reproduce the behavior:

Hard to reproduce in automatically way depends on bandwitch, type of stream used, server provider speed, in my case this happen every time with Neftx non-DRM streams so with trailers videos, then in the log you can see DEMUX_SPECIALID_STREAMCHANGE text output

But i think that another similar way could be set in the ISAdaptive settings manual video stream selection then when you play a non-DRM video, you can switch manually via GUI the video streams, in this way you can get the DEMUX_SPECIALID_STREAMCHANGE problem

I have always said of non-DRM videos because i cannot test "manual video stream switch" with Netfx DRM-videos, because currently ISA has something broken (at least on Windows build) and if i try switch the video image will be permanently freezed.

Since this problem can also affect the selection of subtitles language another way to reproduce the problem is with a Dash stream by using regular Kodi20 build/ISA build:

Debuglog

The debuglog can be found here: kodi_specialix.log.txt

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:

In the InputStream Adaptive the DEMUX_SPECIALID_STREAMCHANGE callback happen here: https://github.com/xbmc/inputstream.adaptive/blob/Nexus/src/main.cpp#L3846-L3852

Your Environment

Used Operating system:

note: Once the issue is made we require you to update it with new information or Kodi versions should that be required. Team Kodi will consider your problem report however, we will not make any promises the problem will be solved.

glennguy commented 2 years ago

I have always said of non-DRM videos because i cannot test "manual video stream switch" with Netfx DRM-videos, because currently ISA has something broken (at least on Windows build) and if i try switch the video image will be permanently freezed.

Some additional context on this in case anyone is wondering - auto bitrate switching in adaptive is the same stream in Kodi being opened again, and the VideoCodec (used in some DRM videos) continues on - with the 'manual' mode the current stream is closed and a new one is opened - old VideoCodec is destroyed and the remaining buffer with it. So not a problem with 'normal' (auto) use of adaptive but multiple chapter content will see the last few seconds of a chapter lose video (again with some DRM streams only)