refactor Streaming strategy to allow MP4 preview and rename legacy Streaming strategy to Sequential #249
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.
code and comment by Antigravity (under supervision)
Description
This PR introduces a proper "Smart Streaming" strategy for file transfers, designed to optimize MP4 video previewing, and cleans up the legacy naming confusion.
Key Changes:
Renamed Legacy Strategy: The old "Streaming" strategy (which was actually just downloading chunks 0, 1, 2...) has been correctly renamed to "Sequential". active everywhere (Settings, Context Menus, config files).
New "Streaming" Strategy: Implemented a new Smart Preview strategy. It behaves like Sequential (downloads from the start) but prioritizes MP4 index atoms (moov/cmov), which are often located at the end of the file. This allows video players to start playback immediately.
Windows Freeze Protection: Updated tooltips and warnings to inform users that both "Random" and "Streaming" strategies (which write to the end of the file) may cause temporary UI freezes on Windows during file allocation.
Modified files:
libretroshare/src/ft/ftcontroller.cc
: Migrated old "STREAMING" config values to the new "SEQUENTIAL" enum, while mapping the new Smart Streaming to its own ID.
libretroshare/src/retroshare/rstypes.h
: Added CHUNK_STRATEGY_STREAMING enum (id 3).
libretroshare/src/ft/ftchunkmap.cc/.h
: Implemented priority chunk logic for the new strategy.
libretroshare/src/ft/ftfilecreator.cc/.h
: Added MP4 atom parsing to detect and prioritize index chunks.
libretroshare/src/ft/ftcontroller.cc
: Updated save/load logic to handle new enum mapping and persistence strings.
GUI (retroshare-gui):
retroshare-gui/src/gui/FileTransfer/TransfersDialog.cpp/.h
: Updated context menus to include all 4 strategies (Sequential, Progressive, Random, Streaming).
retroshare-gui/src/gui/settings/TransferPage.cpp
: Handled settings persistence and Windows safety warnings.
retroshare-gui/src/gui/settings/TransferPage.ui
: Updated combo box items and tooltips with detailed explanations.
Web Interface (retroshare-webui):
retroshare-webui/webui-src/app/files/files_util.js
: Added the "Streaming" strategy to the JS mapping.