mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-08 02:24:35 +02:00
chore(Spoof streaming data): Reduce the size of approxDurationMsMap
and change it to remove it from the Map immediately
This commit is contained in:
parent
698e5f2021
commit
e3128a9552
@ -34,8 +34,8 @@ public class SpoofStreamingDataPatch extends BlockRequestPatch {
|
||||
* Value: original video length [streamingData.formats.approxDurationMs]
|
||||
*/
|
||||
private static final Map<String, Long> approxDurationMsMap = Collections.synchronizedMap(
|
||||
new LinkedHashMap<>(100) {
|
||||
private static final int CACHE_LIMIT = 50;
|
||||
new LinkedHashMap<>(10) {
|
||||
private static final int CACHE_LIMIT = 5;
|
||||
|
||||
@Override
|
||||
protected boolean removeEldestEntry(Entry eldest) {
|
||||
@ -178,6 +178,7 @@ public class SpoofStreamingDataPatch extends BlockRequestPatch {
|
||||
Long approxDurationMs = approxDurationMsMap.get(videoId);
|
||||
if (approxDurationMs != null) {
|
||||
Logger.printDebug(() -> "Replacing video length from " + lengthMilliseconds + " to " + approxDurationMs + " , videoId: " + videoId);
|
||||
approxDurationMsMap.remove(videoId);
|
||||
return approxDurationMs;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user