mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-11 12:04:39 +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]
|
* Value: original video length [streamingData.formats.approxDurationMs]
|
||||||
*/
|
*/
|
||||||
private static final Map<String, Long> approxDurationMsMap = Collections.synchronizedMap(
|
private static final Map<String, Long> approxDurationMsMap = Collections.synchronizedMap(
|
||||||
new LinkedHashMap<>(100) {
|
new LinkedHashMap<>(10) {
|
||||||
private static final int CACHE_LIMIT = 50;
|
private static final int CACHE_LIMIT = 5;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean removeEldestEntry(Entry eldest) {
|
protected boolean removeEldestEntry(Entry eldest) {
|
||||||
@ -178,6 +178,7 @@ public class SpoofStreamingDataPatch extends BlockRequestPatch {
|
|||||||
Long approxDurationMs = approxDurationMsMap.get(videoId);
|
Long approxDurationMs = approxDurationMsMap.get(videoId);
|
||||||
if (approxDurationMs != null) {
|
if (approxDurationMs != null) {
|
||||||
Logger.printDebug(() -> "Replacing video length from " + lengthMilliseconds + " to " + approxDurationMs + " , videoId: " + videoId);
|
Logger.printDebug(() -> "Replacing video length from " + lengthMilliseconds + " to " + approxDurationMs + " , videoId: " + videoId);
|
||||||
|
approxDurationMsMap.remove(videoId);
|
||||||
return approxDurationMs;
|
return approxDurationMs;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user