From ade32bea240fa74f01d4dd4792b1069cca619bba Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sat, 20 Nov 2021 09:35:17 +0100 Subject: Improve youtube throttling by increasing youtube downloader range buffer size by 10 --- src/plugins/youtube/YoutubeMediaProxy.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/youtube/YoutubeMediaProxy.cpp b/src/plugins/youtube/YoutubeMediaProxy.cpp index 913fb77..6e2c5c4 100644 --- a/src/plugins/youtube/YoutubeMediaProxy.cpp +++ b/src/plugins/youtube/YoutubeMediaProxy.cpp @@ -20,7 +20,7 @@ namespace QuickMedia { static const int MAX_BUFFER_SIZE = 65536; - static const int64_t RANGE = 524287; + static const int64_t RANGE = 5242870; static const int64_t THROTTLED_DOWNLOAD_LIMIT_KB = 80; // TODO: What about people with really slow internet? What if the video player cache is not working and download is stuck, leading to false download speed calculation? static const int64_t THROTTLED_DURATION_SECS = 3; static const char download_error_response_msg[] = @@ -39,9 +39,9 @@ namespace QuickMedia { bool YoutubeMediaProxy::start_download(const std::string &media_url, ReadProgram &read_program, int64_t range_start, bool include_header, bool is_livestream, int livestream_sequence) { std::string r = std::to_string(range_start) + "-" + std::to_string(range_start + RANGE); - std::string url = media_url + "&rn=" + std::to_string(rn) + "&rbuf=" + std::to_string(rbuf); + std::string url = media_url;; std::vector args = { "curl", - //"-H", "Accept-Language: en-US,en;q=0.5", "-H", "Connection: keep-alive", + "-H", "Accept-Language: en-US,en;q=0.5", "-H", "Connection: keep-alive", "--no-buffer", "-H", "user-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36", "-g", "-s", "-L", "-f" }; @@ -72,9 +72,6 @@ namespace QuickMedia { return false; } - ++rn; - rbuf += 3000; - if(rbuf > 75000) rbuf = 75000; return true; } -- cgit v1.2.3