]> 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 8f3f957590bd165afb46a2ec07c0494379ae3324..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
@@ -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,6 +394,12 @@ 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
                                graph_->update_text(narrow(print()));\r