-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Improve audio stream selection for video-only streams in the downloader #10446
Improve audio stream selection for video-only streams in the downloader #10446
Conversation
… some typos in the class
Instead of searching for the first audio stream matching a compatible media format, this change makes SecondaryStreamHelper.getAudioStreamFor use methods isLimitingDataUsage, getAudioFormatComparator and getAudioIndexByHighestRank of ListHelper to get an audio stream which can be muxed into a video-only stream, if available. This allows users to download videos with the highest audio quality available if no resolution limit on mobile data usage has been set. The order of formats used to search a compatible audio stream has been kept.
Kudos, SonarCloud Quality Gate passed! |
Please add information about the strategy that is used to get the AudioStream to the method. That should help us to easily determine whether to use the method and/or how to modify it if the requirements change in the future. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Videos are usually downloaded to be kept for later, so most of the times the audio quality the user wants is unrelated to whether they are connected to mobile data or not. The optimal way would be to add a secondary menu in the download dialog for choosing the audio quality separately. But for now this is ok.
app/src/main/java/org/schabi/newpipe/util/SecondaryStreamHelper.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested by downloading a video under wifi and under mobile data with the setting on, and they turned out to have two different sizes, so I guess it counts as a succeeded test. Thanks!
What is it?
Description of the changes in your PR
Instead of searching for the first audio stream compatible with a media format, this change makes the method to get audio-only streams for video-only streams in the downloader (
SecondaryStreamHelper.getAudioStreamFor
) use some methods used to get available audio streams for playback (isLimitingDataUsage
,getAudioFormatComparator
andgetAudioIndexByHighestRank
ofListHelper
class).This means that the audio stream quality selection in the downloader will now follow the setting of a default video resolution on mobile data: if a resolution is set, the lowest audio stream should be selected, otherwise the highest audio stream should be selected. This behavior should be already applied for playback.
Fixes the following issue(s)
APK testing
The APK can be found by going to the "Checks" tab below the title. On the left pane, click on "CI", scroll down to "artifacts" and click "app" to download the zip file which contains the debug APK of this PR. You can find more info and a video demonstration on this wiki page.
Due diligence