Fix to avoid Kodi core to reopen same stream twice times #1931
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The root of the issue appears to have been introduced with PR xbmc/xbmc#10097
when "changes" var differs from the stored value, it force to reopen all streams,
where in the past was reopening only the associated stream
The request to reopen a stream at least for binary addons is unclear,
there is no reason to open a stream already opened, because the
EnableStream
(to false) callback was never sentso the state of the addon is still unchanged, this translates into a useless operation.
Looks like that the
CDemuxStream
"changes" var is modified byCDVDDemuxClient::ParsePacket
while in playbackhttps://github.com/xbmc/xbmc/blob/d1a1d48c3cb3722d39264ffdd8132f755ffecd27/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxClient.cpp#L119
maybe this is required for some other
CDVDInputStream
interface(?) but not forCInputStreamAddon
, this should be at least optionalsince can easily leads to playback problems such as stuttering because reopening all streams can be an heavy task to do while playback as can be seen on this log of following Issue:
#757 (comment)
moreover for subtitles case this is even more messed up, since they can be disabled... (
EnableStream
callback)The workaround consist in to detect the first stream opened twice times to skip all the following
OpenStream
callbacksMotivation and context
Long standing todo
where subtitles stream was reopened twice times,
users dont see nothing but this can cause side effects and unnecessary operations that can cause delays
It is somewhere between a workaround and a fix,
as it is currently unclear why Kodi core force binary addons to opens all the streams twice times
How has this been tested?
its more easy catch this problem by playing an HLS TS
then check on the log
OpenStream(xxxx): The stream has already been opened
for each stream IDuse cases to be tested:
Case 1:
OpenStream(xxxx): The stream has already been opened
dont appears for subtitles (PR fix it)Case 2: this can be tested with streams having multiple chapters/periods
OpenStream(xxxx): The stream has already been opened
dont appears for subtitles (PR fix it)Case 3: stream quality change
DEMUX_SPECIALID_STREAMCHANGE
event from log)Case 4: user enable/disable subtitles
Screenshots (if appropriate):
Types of change
Checklist: