aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/youtube
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2021-11-20 09:35:17 +0100
committerdec05eba <dec05eba@protonmail.com>2021-11-20 09:35:17 +0100
commitade32bea240fa74f01d4dd4792b1069cca619bba (patch)
tree1ac13e7df419d01a3784b8421713e1bddf118b56 /src/plugins/youtube
parentb85c9839ae86247179a4adf7f2e90f194380cb93 (diff)
Improve youtube throttling by increasing youtube downloader range buffer size by 10
Diffstat (limited to 'src/plugins/youtube')
-rw-r--r--src/plugins/youtube/YoutubeMediaProxy.cpp9
1 files changed, 3 insertions, 6 deletions
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<const char*> 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;
}