diff options
author | dec05eba <dec05eba@protonmail.com> | 2021-06-11 17:11:13 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2021-06-11 17:11:13 +0200 |
commit | c96fdcb4d639ae52ad1d2c812a07e5667849fe71 (patch) | |
tree | 37ace7d7fbb79a211d604a9e7a3204e454ee8720 /src/plugins | |
parent | 26b593b1eac483f700c72b4195e372f4b92acc7f (diff) |
Optimize shaders, only update youtube decryption function once every 5 minutes, smoother movement with smaller card items
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/youtube/Signature.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/plugins/youtube/Signature.cpp b/src/plugins/youtube/Signature.cpp index 30093d5..2460f8a 100644 --- a/src/plugins/youtube/Signature.cpp +++ b/src/plugins/youtube/Signature.cpp @@ -5,6 +5,7 @@ #include "../../../include/StringUtils.hpp" #include "../../../include/Program.hpp" #include <regex> +#include <mutex> #include <unistd.h> namespace QuickMedia { @@ -14,7 +15,8 @@ namespace QuickMedia { }; static YoutubeSignatureDecryptor *instance = nullptr; - static const int timeout_default_sec = 60; + static std::mutex update_signature_mutex; + static const int timeout_default_sec = 60 * 5; // 5 minutes bool YoutubeSignatureDecryptor::js_code_to_operations(const std::string &function_body_str, const std::string &var_body_str, std::vector<DecryptFuncCall> &new_func_calls, std::map<std::string, DecryptFunction> &new_func_decls) { std::vector<std::string> function_body; @@ -170,6 +172,7 @@ namespace QuickMedia { // static YoutubeSignatureDecryptor& YoutubeSignatureDecryptor::get_instance() { + std::lock_guard<std::mutex> lock(update_signature_mutex); if(!instance) instance = new YoutubeSignatureDecryptor(); return *instance; @@ -183,7 +186,6 @@ namespace QuickMedia { int num_tries = 0; const int max_tries = 30; while(running && num_tries < max_tries && !program_is_dead_in_current_thread()) { // 6 seconds in total - std::lock_guard<std::mutex> lock(update_signature_mutex); if(up_to_date) break; ++num_tries; |