X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fhtml%2Fproducer%2Fhtml_producer.cpp;h=78ca18fc7be036b8bfd073925316ea79aa108ef1;hb=0b5b222f19eaa060db90dbe3d2dce1b8d43b816f;hp=fba02d353891cbbc37c94991015150e80e2f8528;hpb=0fec7ff21328c7a7a652add35d52dd5ff6795a85;p=casparcg diff --git a/modules/html/producer/html_producer.cpp b/modules/html/producer/html_producer.cpp index fba02d353..78ca18fc7 100644 --- a/modules/html/producer/html_producer.cpp +++ b/modules/html/producer/html_producer.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -43,6 +44,7 @@ #include #include #include +#include #include #include @@ -53,10 +55,13 @@ #include #include +#pragma warning(push) +#pragma warning(disable: 4458) #include #include #include #include +#pragma warning(pop) #include @@ -86,7 +91,6 @@ class html_client tbb::concurrent_queue javascript_before_load_; tbb::atomic loaded_; tbb::atomic removed_; - tbb::atomic animation_frame_requested_; std::queue frames_; mutable boost::mutex frames_mutex_; @@ -113,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(); }); } @@ -158,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) @@ -208,30 +206,25 @@ 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); - A_memcpy(frame.image_data().begin(), buffer, width * height * 4); + auto frame = frame_factory_->create_frame(this, pixel_desc, core::audio_channel_layout::invalid()); + fast_memcpy(frame.image_data().begin(), buffer, width * height * 4); lock(frames_mutex_, [&] { frames_.push(core::draw_frame(std::move(frame))); - size_t max_in_queue = format_desc_.field_count; + size_t max_in_queue = format_desc_.field_count + 1; while (frames_.size() > max_in_queue) { frames_.pop(); - graph_->set_tag("dropped-frame"); + 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 browser) override @@ -285,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(); @@ -321,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 @@ -350,7 +336,7 @@ private: if (!try_pop(frame)) { - BOOST_THROW_EXCEPTION(caspar_exception() << msg_info(u8(print()) + " No frame in buffer")); + CASPAR_THROW_EXCEPTION(caspar_exception() << msg_info(u8(print()) + " No frame in buffer")); } return frame; @@ -398,7 +384,7 @@ private: } else if (num_frames == 1) // Interlaced but only one frame { // available. Probably the last frame - // of some animation sequence. + // of some animation sequence. auto frame = pop(); lock(last_frame_mutex_, [&] @@ -412,18 +398,11 @@ private: } else { - graph_->set_tag("late-frame"); - if (format_desc_.field_mode != core::field_mode::progressive) - { lock(last_frame_mutex_, [&] { last_frame_ = last_progressive_frame_; }); - - timer.tick(1.0 / (format_desc_.fps * format_desc_.field_count)); - invoke_requested_animation_frames(); - } } } @@ -482,6 +461,7 @@ public: //window_info.SetAsWindowless(nullptr, true); CefBrowserSettings browser_settings; + browser_settings.web_security = cef_state_t::STATE_DISABLED; CefBrowserHost::CreateBrowser(window_info, client_.get(), url, browser_settings, nullptr); }); }