]> git.sesse.net Git - casparcg/blobdiff - modules/html/producer/html_producer.cpp
#433 Removed late-frame tag from html_producer since it is not possible to know wheth...
[casparcg] / modules / html / producer / html_producer.cpp
index f911bc4ea92035a7a6e2f1f2895be162065b0d83..78ca18fc7be036b8bfd073925316ea79aa108ef1 100644 (file)
@@ -44,6 +44,7 @@
 #include <common/prec_timer.h>
 #include <common/linq.h>
 #include <common/os/filesystem.h>
+#include <common/memcpy.h>
 
 #include <boost/algorithm/string/predicate.hpp>
 #include <boost/filesystem.hpp>
@@ -90,7 +91,6 @@ class html_client
        tbb::concurrent_queue<std::wstring>             javascript_before_load_;
        tbb::atomic<bool>                                               loaded_;
        tbb::atomic<bool>                                               removed_;
-       tbb::atomic<bool>                                               animation_frame_requested_;
        std::queue<core::draw_frame>                    frames_;
        mutable boost::mutex                                    frames_mutex_;
 
@@ -117,13 +117,12 @@ public:
        {
                graph_->set_color("browser-tick-time", diagnostics::color(0.1f, 1.0f, 0.1f));
                graph_->set_color("tick-time", diagnostics::color(0.0f, 0.6f, 0.9f));
-               graph_->set_color("late-frame", diagnostics::color(0.6f, 0.3f, 0.9f));
+               graph_->set_color("dropped-frame", diagnostics::color(0.3f, 0.6f, 0.3f));
                graph_->set_text(print());
                diagnostics::register_graph(graph_);
 
                loaded_ = false;
                removed_ = false;
-               animation_frame_requested_ = false;
                executor_.begin_invoke([&]{ update(); });
        }
 
@@ -162,11 +161,6 @@ public:
 
        void close()
        {
-               if (!animation_frame_requested_)
-                       CASPAR_LOG(warning) << print()
-                                       << " window.requestAnimationFrame() never called. "
-                                       << "Animations might have been laggy";
-
                html::invoke([=]
                {
                        if (browser_ != nullptr)
@@ -212,13 +206,12 @@ private:
                paint_timer_.restart();
                CASPAR_ASSERT(CefCurrentlyOn(TID_UI));
 
-               boost::timer copy_timer;
                core::pixel_format_desc pixel_desc;
                        pixel_desc.format = core::pixel_format::bgra;
                        pixel_desc.planes.push_back(
                                core::pixel_format_desc::plane(width, height, 4));
                auto frame = frame_factory_->create_frame(this, pixel_desc, core::audio_channel_layout::invalid());
-               A_memcpy(frame.image_data().begin(), buffer, width * height * 4);
+               fast_memcpy(frame.image_data().begin(), buffer, width * height * 4);
 
                lock(frames_mutex_, [&]
                {
@@ -232,10 +225,6 @@ private:
                                graph_->set_tag(diagnostics::tag_severity::WARNING, "dropped-frame");
                        }
                });
-               graph_->set_value("copy-time", copy_timer.elapsed()
-                               * format_desc_.fps
-                               * format_desc_.field_count
-                               * 0.5);
        }
 
        void OnAfterCreated(CefRefPtr<CefBrowser> browser) override
@@ -289,15 +278,7 @@ private:
        {
                auto name = message->GetName().ToString();
 
-               if (name == ANIMATION_FRAME_REQUESTED_MESSAGE_NAME)
-               {
-                       CASPAR_LOG(trace)
-                                       << print() << L" Requested animation frame";
-                       animation_frame_requested_ = true;
-
-                       return true;
-               }
-               else if (name == REMOVE_MESSAGE_NAME)
+               if (name == REMOVE_MESSAGE_NAME)
                {
                        remove();
 
@@ -325,6 +306,7 @@ private:
                        browser_->SendProcessMessage(
                                        CefProcessId::PID_RENDERER,
                                        CefProcessMessage::Create(TICK_MESSAGE_NAME));
+
                graph_->set_value("tick-time", tick_timer_.elapsed()
                                * format_desc_.fps
                                * format_desc_.field_count
@@ -416,8 +398,6 @@ private:
                }
                else
                {
-                       graph_->set_tag(diagnostics::tag_severity::INFO, "late-frame");
-
                        if (format_desc_.field_mode != core::field_mode::progressive)
                                lock(last_frame_mutex_, [&]
                                {