X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=cef_capture.h;h=30cc4879593eaece48df9e315f755d51c38de3bf;hb=b9feb66845bf24465b7671ac9ff7a52b88f6032b;hp=311076eb9afd0fcaf2942e9d218086c1e9673539;hpb=4ed8afda0ec060a66ca6af76d15afe62af543849;p=nageru diff --git a/cef_capture.h b/cef_capture.h index 311076e..30cc487 100644 --- a/cef_capture.h +++ b/cef_capture.h @@ -86,6 +86,7 @@ public: void set_max_fps(int max_fps); void execute_javascript_async(const std::string &js); void resize(unsigned width, unsigned height); + void request_new_frame(); // Callbacks from NageruCEFClient. void OnPaint(const void *buffer, int width, int height); @@ -166,7 +167,7 @@ public: uint32_t get_current_audio_input() const override { return 0; } private: - void post_to_cef_ui_thread(std::function &&func); + void post_to_cef_ui_thread(std::function &&func, int64_t delay_ms = 0); CefRefPtr cef_client; @@ -189,7 +190,9 @@ private: std::string description, start_url; std::atomic max_fps{60}; - std::mutex browser_mutex; + // Needs to be recursive because the lambda in OnPaint could cause + // OnPaint itself to be called. + std::recursive_mutex browser_mutex; CefRefPtr browser; // Under . // Tasks waiting for to get ready. Under .