From 21c50903a68c253fa5fcb9ed5ac8ba5abb1142b9 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Mon, 7 Mar 2022 19:02:28 +0100 Subject: Attempt to fix youtube video issue where video stops playing because audio finishes download Remove youtube livestream code --- plugins/youtube/YoutubeMediaProxy.hpp | 32 +++----------------------------- 1 file changed, 3 insertions(+), 29 deletions(-) (limited to 'plugins') diff --git a/plugins/youtube/YoutubeMediaProxy.hpp b/plugins/youtube/YoutubeMediaProxy.hpp index eaef898..0fb2d6a 100644 --- a/plugins/youtube/YoutubeMediaProxy.hpp +++ b/plugins/youtube/YoutubeMediaProxy.hpp @@ -22,7 +22,7 @@ namespace QuickMedia { virtual Error update() = 0; virtual bool get_address(std::string &address) = 0; - bool start_download(const std::string &media_url, ReadProgram &read_program, int64_t range_start, bool include_header, bool is_livestream = false, int livestream_sequence = -1); + bool start_download(const std::string &media_url, ReadProgram &read_program, int64_t range_start, int64_t end_range, bool include_header); }; class YoutubeStaticMediaProxy : public YoutubeMediaProxy { @@ -57,7 +57,9 @@ namespace QuickMedia { ssize_t downloader_num_read_bytes = 0; int64_t download_range_start = 0; int64_t current_download_range = 0; + int64_t next_range_length = 0; std::string download_header; + bool end_of_file = false; bool download_header_finished = false; bool download_header_sent = false; bool download_header_remaining_sent = false; @@ -70,32 +72,4 @@ namespace QuickMedia { std::string client_request_buffer; char download_read_buffer[16384]; }; - - class YoutubeLiveStreamMediaProxy : public YoutubeMediaProxy { - public: - YoutubeLiveStreamMediaProxy() = default; - YoutubeLiveStreamMediaProxy(YoutubeLiveStreamMediaProxy&) = delete; - YoutubeLiveStreamMediaProxy&operator=(YoutubeLiveStreamMediaProxy&) = delete; - ~YoutubeLiveStreamMediaProxy(); - - bool start(const std::string &youtube_media_url, int64_t content_length) override; - void stop() override; - Error update() override; - bool get_address(std::string &address) override; - private: - Error update_download_program_status(); - Error continue_send(const char *buffer_start, size_t total_bytes_to_write, int &buffer_offset); - private: - ReadProgram downloader_read_program; - std::string youtube_media_url; - int fd[2]; - int64_t livestream_sequence_num = -1; - std::string download_header; - bool download_header_finished = false; - bool download_header_remaining_sent = false; - int download_header_written_offset = 0; - int download_read_buffer_offset = 0; - ssize_t downloader_num_read_bytes = 0; - char download_read_buffer[16384]; - }; } \ No newline at end of file -- cgit v1.2.3