diff options
Diffstat (limited to 'src/plugins/youtube')
-rw-r--r-- | src/plugins/youtube/YoutubeMediaProxy.cpp | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/plugins/youtube/YoutubeMediaProxy.cpp b/src/plugins/youtube/YoutubeMediaProxy.cpp index cba4a1d..2296d1a 100644 --- a/src/plugins/youtube/YoutubeMediaProxy.cpp +++ b/src/plugins/youtube/YoutubeMediaProxy.cpp @@ -77,7 +77,7 @@ namespace QuickMedia { stop(); } - bool YoutubeStaticMediaProxy::start(const std::string &youtube_media_url, int content_length) { + bool YoutubeStaticMediaProxy::start(const std::string &youtube_media_url, int64_t content_length) { if(socket_fd != -1) return false; @@ -251,15 +251,15 @@ namespace QuickMedia { int new_start_range = header_extract_start_range(client_request_buffer); //fprintf(stderr, "got new range from client: %d\n", new_start_range); - if(new_start_range >= 0) { - if(downloader_read_program.pid != -1) { - kill(downloader_read_program.pid, SIGTERM); - wait_program(downloader_read_program.pid); - downloader_read_program.pid = -1; - } - clear_download_state(); - update_download_program_status(false, new_start_range, true); + //if(new_start_range >= 0) { + if(downloader_read_program.pid != -1) { + kill(downloader_read_program.pid, SIGTERM); + wait_program(downloader_read_program.pid); + downloader_read_program.pid = -1; } + clear_download_state(); + return update_download_program_status(false, new_start_range, true); + //} } else { if(client_request_buffer.size() > MAX_BUFFER_SIZE) { client_request_finished = true; @@ -278,13 +278,13 @@ namespace QuickMedia { download_header_written_offset = 0; } - YoutubeStaticMediaProxy::Error YoutubeStaticMediaProxy::update_download_program_status(bool client_disconnected, int new_range_start, bool restart_download) { + YoutubeStaticMediaProxy::Error YoutubeStaticMediaProxy::update_download_program_status(bool client_disconnected, int64_t new_range_start, bool restart_download) { int program_status = 0; if(downloader_read_program.pid != -1) { if(client_disconnected) { wait_program(downloader_read_program.pid); } else { - if(!wait_program_non_blocking(downloader_read_program.pid, &program_status)) + if(wait_program_non_blocking(downloader_read_program.pid, &program_status) == 0) return Error::OK; } downloader_read_program.pid = -1; @@ -353,7 +353,7 @@ namespace QuickMedia { return Error::OK; } - static void header_replace_content_length(std::string &header, size_t header_size, int new_content_length) { + static void header_replace_content_length(std::string &header, size_t header_size, int64_t new_content_length) { if(new_content_length < 0) new_content_length = 0; @@ -536,7 +536,7 @@ namespace QuickMedia { stop(); } - bool YoutubeLiveStreamMediaProxy::start(const std::string &youtube_media_url, int) { + bool YoutubeLiveStreamMediaProxy::start(const std::string &youtube_media_url, int64_t) { fd[0] = -1; fd[1] = -1; if(pipe(fd) == -1) { @@ -587,7 +587,7 @@ namespace QuickMedia { YoutubeMediaProxy::Error YoutubeLiveStreamMediaProxy::update_download_program_status() { int program_status = 0; - if(!wait_program_non_blocking(downloader_read_program.pid, &program_status)) + if(wait_program_non_blocking(downloader_read_program.pid, &program_status) == 0) return Error::OK; downloader_read_program.pid = -1; |