graph_ = diagnostics::create_graph([this]{return print();});\r
graph_->set_color("buffer-count", diagnostics::color(0.4f, 0.8f, 0.8f));\r
\r
- frame_buffer_.set_capacity(1);\r
- \r
- context_.reset([&]{return new flash_renderer(safe_ptr<diagnostics::graph>(graph_), frame_factory_, filename_, width_, height_);});\r
- while(frame_buffer_.try_push(core::basic_frame::empty())){} \r
- render(); \r
+ frame_buffer_.set_capacity(1); \r
+ initialize();\r
}\r
\r
~flash_producer()\r
frame_buffer_.clear();\r
}\r
\r
+ void initialize()\r
+ { \r
+ context_.reset(nullptr);\r
+ context_.reset([&]{return new flash_renderer(safe_ptr<diagnostics::graph>(graph_), frame_factory_, filename_, width_, height_);});\r
+ while(frame_buffer_.try_push(core::basic_frame::empty())){} \r
+ render(); \r
+ }\r
+\r
// frame_producer\r
\r
virtual safe_ptr<core::basic_frame> receive(int)\r
try\r
{\r
context_->param(param); \r
-\r
- const auto& format_desc = frame_factory_->get_video_format_desc();\r
- if(abs(context_->fps() - format_desc.fps) > 2.0 && abs(context_->fps()/2.0 - format_desc.fps) > 2.0)\r
- CASPAR_LOG(warning) << print() << " Invalid frame-rate: " << context_->fps() << L". Should be either " << format_desc.fps << L" or " << format_desc.fps*2.0 << L".";\r
}\r
catch(...)\r
{\r
- CASPAR_LOG_CURRENT_EXCEPTION();\r
- context_.reset(nullptr);\r
+ try\r
+ {\r
+ CASPAR_LOG_CURRENT_EXCEPTION();\r
+ CASPAR_LOG(error) << print() << L" param failed. Trying to re-initialize flash and re-execute param.";\r
\r
- tbb::spin_mutex::scoped_lock lock(exception_mutex_);\r
- exception_ = std::current_exception();\r
+ initialize(); \r
+ context_->param(param); \r
+ }\r
+ catch(...)\r
+ {\r
+ CASPAR_LOG_CURRENT_EXCEPTION();\r
+\r
+ context_.reset(nullptr);\r
+\r
+ tbb::spin_mutex::scoped_lock lock(exception_mutex_);\r
+ exception_ = std::current_exception();\r
+ }\r
}\r
+\r
+ const auto& format_desc = frame_factory_->get_video_format_desc();\r
+ if(abs(context_->fps() - format_desc.fps) > 2.0 && abs(context_->fps()/2.0 - format_desc.fps) > 2.0)\r
+ CASPAR_LOG(warning) << print() << " Invalid frame-rate: " << context_->fps() << L". Should be either " << format_desc.fps << L" or " << format_desc.fps*2.0 << L".";\r
});\r
}\r
\r