]> git.sesse.net Git - casparcg/blobdiff - modules/flash/producer/flash_producer.cpp
2.0.2: Destroy flash on "isEmpty".
[casparcg] / modules / flash / producer / flash_producer.cpp
index 13a0fa3425259423d3783322202b9ffcd482f820..a93e70f08784c6e5efc6f081e67b715a30bc0e8a 100644 (file)
@@ -238,6 +238,11 @@ public:
                return head_;\r
        }\r
 \r
+       bool is_empty() const\r
+       {\r
+               return ax_->IsEmpty();\r
+       }\r
+\r
        double fps() const\r
        {\r
                return ax_->GetFPS();   \r
@@ -281,7 +286,7 @@ public:
 \r
                fps_ = 0;\r
 \r
-               graph_ = diagnostics::create_graph([this]{return print();});\r
+               graph_ = diagnostics::create_graph(narrow(print()));\r
                graph_->set_color("output-buffer-count", diagnostics::color(1.0f, 1.0f, 0.0f));          \r
                graph_->set_color("underflow", diagnostics::color(0.6f, 0.3f, 0.9f));   \r
                \r
@@ -302,7 +307,7 @@ public:
                graph_->set_value("output-buffer-count", static_cast<float>(frame_buffer_.size())/static_cast<float>(frame_buffer_.capacity()));\r
 \r
                auto frame = core::basic_frame::late();\r
-               if(!frame_buffer_.try_pop(frame))\r
+               if(!frame_buffer_.try_pop(frame) && context_)\r
                        graph_->add_tag("underflow");\r
 \r
                return frame;\r
@@ -389,8 +394,15 @@ public:
                                        frame_buffer_.push(frame);\r
                                }\r
 \r
+                               if(context_->is_empty())\r
+                               {\r
+                                       context_.reset(nullptr);\r
+                                       return;\r
+                               }\r
+\r
                                graph_->set_value("output-buffer-count", static_cast<float>(frame_buffer_.size())/static_cast<float>(frame_buffer_.capacity()));        \r
-                               fps_.fetch_and_store(static_cast<int>(context_->fps()*100.0));\r
+                               fps_.fetch_and_store(static_cast<int>(context_->fps()*100.0));                          \r
+                               graph_->update_text(narrow(print()));\r
 \r
                                render(renderer);\r
                        }\r