From d93b25248f6fe26069350a512f29327ce59fd95b Mon Sep 17 00:00:00 2001 From: ronag Date: Mon, 31 Oct 2011 08:56:26 +0000 Subject: [PATCH] 2.0.2: Destroy flash on "isEmpty". git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/branches/2.0.0.2@1524 362d55ac-95cf-4e76-9f9a-cbaa9c17b72d --- modules/flash/producer/flash_producer.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/modules/flash/producer/flash_producer.cpp b/modules/flash/producer/flash_producer.cpp index 8f3f95759..a93e70f08 100644 --- a/modules/flash/producer/flash_producer.cpp +++ b/modules/flash/producer/flash_producer.cpp @@ -238,6 +238,11 @@ public: return head_; } + bool is_empty() const + { + return ax_->IsEmpty(); + } + double fps() const { return ax_->GetFPS(); @@ -302,7 +307,7 @@ public: graph_->set_value("output-buffer-count", static_cast(frame_buffer_.size())/static_cast(frame_buffer_.capacity())); auto frame = core::basic_frame::late(); - if(!frame_buffer_.try_pop(frame)) + if(!frame_buffer_.try_pop(frame) && context_) graph_->add_tag("underflow"); return frame; @@ -389,6 +394,12 @@ public: frame_buffer_.push(frame); } + if(context_->is_empty()) + { + context_.reset(nullptr); + return; + } + graph_->set_value("output-buffer-count", static_cast(frame_buffer_.size())/static_cast(frame_buffer_.capacity())); fps_.fetch_and_store(static_cast(context_->fps()*100.0)); graph_->update_text(narrow(print())); -- 2.39.2