Skip to content

Conversation

CastagnaIT
Copy link
Collaborator

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 sent
so the state of the addon is still unchanged, this translates into a useless operation.

Looks like that the CDemuxStream "changes" var is modified by CDVDDemuxClient::ParsePacket while in playback
https://github.com/xbmc/xbmc/blob/d1a1d48c3cb3722d39264ffdd8132f755ffecd27/xbmc/cores/VideoPlayer/DVDDemuxers/DVDDemuxClient.cpp#L119
maybe this is required for some other CDVDInputStream interface(?) but not for CInputStreamAddon, this should be at least optional
since 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 callbacks

Motivation 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 ID

use cases to be tested:

Case 1:

  1. start the stream with subtitles disabled
  2. look at log, the log print 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

  1. start the stream
  2. disable subtitles
  3. while playing, wait for the chapter/period change
  4. look at log, the log print OpenStream(xxxx): The stream has already been opened dont appears for subtitles (PR fix it)

Case 3: stream quality change

  1. Set "stream selection type" on ISA settings to "Test"
  2. Wait stream video quality change (DEMUX_SPECIALID_STREAMCHANGE event from log)
  3. The stream quality change, will force VP to request again all streams, the OpenStream on subtitles must be kept consistent

Case 4: user enable/disable subtitles

  1. from kodi OSD enable/disable subtitles
  2. the OpenStream on subtitles must be kept consistent

Screenshots (if appropriate):

Types of change

  • Bug fix (non-breaking change which fixes an issue)
  • Clean up (non-breaking change which removes non-working, unmaintained functionality)
  • Improvement (non-breaking change which improves existing functionality)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that will cause existing functionality to change)
  • Cosmetic change (non-breaking change that doesn't touch code)
  • None of the above (please explain below)

Checklist:

  • I have read the Contributing document
  • My code follows the Code Guidelines of this project
  • My change requires a change to the Wiki documentation
  • I have updated the documentation accordingly

@CastagnaIT CastagnaIT added Type: Fix non-breaking change which fixes an issue v22 Piers labels Oct 12, 2025
@CastagnaIT CastagnaIT merged commit 7e8d2c9 into xbmc:Piers Oct 14, 2025
11 checks passed
@CastagnaIT CastagnaIT deleted the fix_stream_open branch October 14, 2025 11:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type: Fix non-breaking change which fixes an issue v22 Piers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant