Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FileSystem] deprecate use of READ_CHUNKED flag #25158

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

thexai
Copy link
Member

@thexai thexai commented May 7, 2024

Description

[FileSystem] deprecate use of READ_CHUNKED flag

This is a follow up of #25128 or better alternative as fixes the same in more elaborated way. Also fixes other potential issues or "unwanted behavior changes" due the main refactor in StreamBuffer logic.

Motivation and context

As commented in the other PR, READ_AUDIO_VIDEO flag fits better into CFile::ShouldUseStreamBuffer method because same as FileCache, StreamBuffer only should be used in audio/video files.

Once replaced here results that READ_CHUNKED flag is a dead code because only is set but never read/used. Then can be deprecated.

The others changes are only small adjustments to maintain the same functionality and some potential fix.

How has this been tested?

Runtime Windows x64 and Shield

Tested that use of FileCache and StreamBuffer is maintained same as before for most habitual scenarios: tested MKV's local/network SMB, NFS. Tested Blu-Ray BDMV folders and ISOs SMB and NFS. Adequate chunk size is used same as before: 128K on network and 6144 bytes locally. Tested DVD, DVD ISOs.

Fix for external SRT is preserved without needing to use the READ_NO_BUFFER flag since when opening subtitles it does not have the READ_AUDIO_VIDEO flag and the file size >200 MB condition is not met either.

What is the effect on users?

Nothing directly but prevents other potentially cases of StreamBuffer used on file contents that are not suitable (non audio/video files).

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)
  • Student submission (PR was done for educational purposes and will be treated as such)
  • None of the above (please explain below)

Checklist:

  • My code follows the Code Guidelines of this project
  • My change requires a change to the documentation, either Doxygen or wiki
  • I have updated the documentation accordingly
  • I have read the Contributing document
  • I have added tests to cover my change
  • All new and existing tests passed

@thexai thexai added Type: Fix non-breaking change which fixes an issue Type: Improvement non-breaking change which improves existing functionality Component: FileSystem Filesystem v22 "P" labels May 7, 2024
@thexai thexai added this to the "P" 22.0 Alpha 1 milestone May 7, 2024
@thexai thexai force-pushed the deprecate-read-chunked-flag branch from 860ba73 to 240fca5 Compare May 7, 2024 17:39
@thexai thexai marked this pull request as ready for review May 8, 2024 15:20
@thexai thexai requested review from arnova and fritsch May 8, 2024 15:21
xbmc/filesystem/File.cpp Outdated Show resolved Hide resolved
xbmc/filesystem/IFileTypes.h Outdated Show resolved Hide resolved
@arnova
Copy link
Member

arnova commented May 11, 2024

@thexai : 2 remarks, perhaps you're already aware but I like to mention them to provide some inside about some of the design decisions years ago:

  • The READ_AUDIO_VIDEO-flag, from what I recall, was introduced years ago when double-caching was implemented. This allowed us on CFile-level to decide whether double-caching was required or not;
  • Keep in mind that filecaching is primarily used to provide continuous playback of video and audio files. But it's also to improve performance when files are processed which require a lot of small backward/forward seeks. I'm not sure whether this is the case for eg. iso-files, but I assume you do ;-)

@thexai thexai force-pushed the deprecate-read-chunked-flag branch from 240fca5 to b7e5c89 Compare May 11, 2024 07:07
@thexai
Copy link
Member Author

thexai commented May 11, 2024

The READ_AUDIO_VIDEO-flag, from what I recall, was introduced years ago when double-caching was implemented. This allowed us on CFile-level to decide whether double-caching was required or not;

Currently seems other flag is used for this:

// NOTE: READ_MULTI_STREAM is only used with READ_AUDIO_VIDEO
if (m_flags & READ_MULTI_STREAM)
{
// READ_MULTI_STREAM requires double buffering, so use half the amount of memory for each buffer
cacheSize /= 2;
}

@arnova
Copy link
Member

arnova commented May 11, 2024

The READ_AUDIO_VIDEO-flag, from what I recall, was introduced years ago when double-caching was implemented. This allowed us on CFile-level to decide whether double-caching was required or not;

Currently seems other flag is used for this:

// NOTE: READ_MULTI_STREAM is only used with READ_AUDIO_VIDEO
if (m_flags & READ_MULTI_STREAM)
{
// READ_MULTI_STREAM requires double buffering, so use half the amount of memory for each buffer
cacheSize /= 2;
}

Ah yes, my mistake, you're right. I confused it with the READ_MULTI_STREAM-flag.

@thexai thexai force-pushed the deprecate-read-chunked-flag branch 2 times, most recently from 2d501e3 to ed2048d Compare May 12, 2024 06:34
@thexai thexai force-pushed the deprecate-read-chunked-flag branch from ed2048d to 017897e Compare May 25, 2024 08:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: FileSystem Filesystem Type: Fix non-breaking change which fixes an issue Type: Improvement non-breaking change which improves existing functionality v22 "P"
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants