mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2026-01-11 13:46:17 +00:00
fix(YouTube - Video quality): Fix additional incorrect quality resolutions used by YouTube
This commit is contained in:
@@ -474,11 +474,22 @@ public final class VideoInformation {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Injection point. Fixes bad data used by YouTube.
|
* Injection point. Fixes bad data used by YouTube.
|
||||||
|
* Issue can be reproduced by selecting 480p quality on any Short,
|
||||||
|
* and occasionally with random regular videos.
|
||||||
*/
|
*/
|
||||||
public static int fixVideoQualityResolution(String name, int quality) {
|
public static int fixVideoQualityResolution(String name, int quality) {
|
||||||
final int correctQuality = 480;
|
try {
|
||||||
if (name.equals("480p") && quality != correctQuality) {
|
if (!name.startsWith(Integer.toString(quality))) {
|
||||||
return correctQuality;
|
final int suffixIndex = name.indexOf('p');
|
||||||
|
if (suffixIndex > 0) {
|
||||||
|
final int fixedQuality = Integer.parseInt(name.substring(0, suffixIndex));
|
||||||
|
Logger.printDebug(() -> "Fixing wrong quality resolution from: " +
|
||||||
|
name + "(" + quality + ") to: " + name + ")" + fixedQuality + ")");
|
||||||
|
return fixedQuality;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception ex) {
|
||||||
|
Logger.printException(() -> "fixVideoQualityResolution failed", ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
return quality;
|
return quality;
|
||||||
|
|||||||
Reference in New Issue
Block a user