aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/youtube
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/youtube')
-rw-r--r--src/plugins/youtube/YoutubeMediaProxy.cpp34
1 files changed, 1 insertions, 33 deletions
diff --git a/src/plugins/youtube/YoutubeMediaProxy.cpp b/src/plugins/youtube/YoutubeMediaProxy.cpp
index b33c122..9efd7ac 100644
--- a/src/plugins/youtube/YoutubeMediaProxy.cpp
+++ b/src/plugins/youtube/YoutubeMediaProxy.cpp
@@ -47,8 +47,6 @@ static ssize_t write_all(int fd, const void *buffer, size_t size) {
namespace QuickMedia {
static const int MAX_BUFFER_SIZE = 65536;
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[] =
"HTTP/1.1 500 Internal Server Error\r\n"
"Content-Length: 0\r\n\r\n";
@@ -101,7 +99,7 @@ namespace QuickMedia {
return true;
}
- YoutubeStaticMediaProxy::YoutubeStaticMediaProxy(ThrottleHandler throttle_handler) : throttle_handler(std::move(throttle_handler)) {
+ YoutubeStaticMediaProxy::YoutubeStaticMediaProxy() {
}
@@ -226,7 +224,6 @@ namespace QuickMedia {
client_request_buffer.clear();
client_request_finished = false;
download_started = false;
- throttle_started = false;
if(client_fd != -1) {
close(client_fd);
@@ -283,7 +280,6 @@ namespace QuickMedia {
client_request_buffer.erase(header_end + 4);
client_request_finished = true;
download_started = false;
- throttle_started = false;
download_read_buffer_offset = 0;
const int64_t new_start_range = header_extract_start_range(client_request_buffer);
@@ -489,40 +485,12 @@ namespace QuickMedia {
if(!download_started) {
total_downloaded_bytes = 0;
download_started = true;
- throttle_started = false;
download_start_time = get_boottime_milliseconds();
}
total_downloaded_bytes += downloader_num_read_bytes;
}
}
-#if 0
- if(download_started) {
- const int64_t time_elapsed_sec = (get_boottime_milliseconds() - download_start_time) / 1000;
- int64_t download_speed_kb_sec = 0;
- if(time_elapsed > 0)
- download_speed_kb_sec = (total_downloaded_bytes / time_elapsed) / 1024;
-
- if(download_speed_kb_sec < THROTTLED_DOWNLOAD_LIMIT_KB) {
- if(throttle_started) {
- if(tp.tv_sec - throttle_start_time >= THROTTLED_DURATION_SECS && !throttle_callback_called) {
- total_downloaded_bytes = 0;
- download_started = false;
- throttle_started = false;
- throttle_callback_called = true;
- if(throttle_handler)
- throttle_handler();
- }
- } else {
- throttle_started = true;
- throttle_start_time = tp.tv_sec;
- }
- } else {
- throttle_started = false;
- }
- }
-#endif
-
// TODO: Remove this code and instead create the header ourselves and send it to the client. Then pipe the curl output directly to the client input.
if(!download_header_finished) {
download_header.append(download_read_buffer, downloader_num_read_bytes);