Use decodingInfo's powerEfficient property when picking streams #6061
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.
Use decodingInfo's powerEfficient property when picking streams
Pull Request Type
Description
The MediaCapabilities
decodingInfo
function can be used to query Electron/the browser if it supports playback of a certain audio and video combination and whether it thinks it can do it smoothly (without dropping frames) and power efficiently (the spec doesn't list any specifics but at least in Chromium whether the stream can be played with hardware acceleration is considered, at least according to my research). At the moment FreeTube just tells shaka-player to prefer streams that can be played smoothly (it always filters out unsupported streams). This pull request also tells it to consider the powerEfficient property.shaka-player picks the best one for each video quality/resolution option, so even if the API predicts that all 4K streams on a video will play dreadfully on a specific device, at least one of them will still be included. That means that users can't come up with complaints about missing quality options because of this :).
Testing
Unfortunately in this case I haven't been able to test the impact, as my device supports hardware accelerated playback for h264, VP9 and AV1.
Desktop