From 45740b230e58fa6f13a3f311dd39509e153f555d Mon Sep 17 00:00:00 2001 From: LisoUseInAIKyrios <118716522+LisoUseInAIKyrios@users.noreply.github.com> Date: Mon, 9 Sep 2024 21:04:16 -0400 Subject: [PATCH] Comments --- .../patches/spoof/requests/StreamingDataRequest.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/app/revanced/integrations/youtube/patches/spoof/requests/StreamingDataRequest.java b/app/src/main/java/app/revanced/integrations/youtube/patches/spoof/requests/StreamingDataRequest.java index e9b53e1f61..304bf3f692 100644 --- a/app/src/main/java/app/revanced/integrations/youtube/patches/spoof/requests/StreamingDataRequest.java +++ b/app/src/main/java/app/revanced/integrations/youtube/patches/spoof/requests/StreamingDataRequest.java @@ -25,6 +25,15 @@ import app.revanced.integrations.youtube.patches.spoof.ClientType; import app.revanced.integrations.youtube.settings.Settings; +/** + * Video streaming data. Fetching is tied to the behavior YT uses, + * where this class fetches the streams only when YT fetches. + * + * Effectively the cache expiration of these fetches is the same as the stock app, + * since the stock app would not use expired streams and therefor + * the integrations replace stream hook is called only if YT + * would have used it's own client streams. + */ public class StreamingDataRequest { private static final ClientType[] CLIENT_ORDER_TO_USE; @@ -150,7 +159,7 @@ private static ByteBuffer fetch(String videoId, Map playerHeader if (connection.getContentLength() != 0) { try (InputStream inputStream = new BufferedInputStream(connection.getInputStream())) { try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) { - byte[] buffer = new byte[8192]; + byte[] buffer = new byte[2048]; int bytesRead; while ((bytesRead = inputStream.read(buffer)) >= 0) { baos.write(buffer, 0, bytesRead);