auto it = consumers_.begin();\r
while(it != consumers_.end())\r
{\r
- try\r
- {\r
- auto consumer = it->second;\r
+ auto consumer = it->second;\r
\r
- if(consumer->get_video_format_desc() != channel_.get_format_desc())\r
- consumer->initialize(channel_.get_format_desc());\r
+ if(consumer->get_video_format_desc() != channel_.get_format_desc())\r
+ consumer->initialize(channel_.get_format_desc());\r
\r
- if(consumer->send(consumer->key_only() ? key : fill))\r
- ++it;\r
- else\r
- consumers_.erase(it++);\r
- }\r
- catch(...)\r
- {\r
- CASPAR_LOG_CURRENT_EXCEPTION();\r
- CASPAR_LOG(error) << print() << L" " << it->second->print() << L" Removed.";\r
+ if(consumer->send(consumer->key_only() ? key : fill))\r
+ ++it;\r
+ else\r
consumers_.erase(it++);\r
- }\r
}\r
}\r
\r
diag_->set_color("produce-time", diagnostics::color(0.0f, 1.0f, 0.0f));\r
diag_->set_color("tick-time", diagnostics::color(0.0f, 0.6f, 0.9f)); \r
diag_->set_color("output-time", diagnostics::color(1.0f, 0.5f, 0.0f));\r
- diag_->set_color("mix-time", diagnostics::color(1.0f, 1.0f, 0.1f));\r
+ diag_->set_color("mix-time", diagnostics::color(1.0f, 1.0f, 0.9f));\r
\r
CASPAR_LOG(info) << print() << " Successfully Initialized.";\r
context_.execution().begin_invoke([this]{tick();});\r
const size_t device_index_;\r
const bool embedded_audio_;\r
const bool key_only_;\r
+ core::video_format_desc format_desc_;\r
+ size_t fail_count_;\r
public:\r
\r
bluefish_consumer_proxy(size_t device_index, bool embedded_audio, bool key_only)\r
: device_index_(device_index)\r
, embedded_audio_(embedded_audio)\r
- , key_only_(key_only){}\r
+ , key_only_(key_only)\r
+ , fail_count_(0)\r
+ {\r
+ }\r
\r
virtual void initialize(const core::video_format_desc& format_desc)\r
{\r
- consumer_.reset();\r
+ format_desc_ = format_desc;\r
consumer_.reset(new bluefish_consumer(format_desc, device_index_, embedded_audio_));\r
}\r
\r
virtual bool send(const safe_ptr<core::read_frame>& frame)\r
{\r
- consumer_->send(frame);\r
+ if(!consumer_)\r
+ consumer_.reset(new bluefish_consumer(format_desc_, device_index_, embedded_audio_));\r
+\r
+ try\r
+ {\r
+ consumer_->send(frame);\r
+ fail_count_ = 0;\r
+ }\r
+ catch(...)\r
+ {\r
+ consumer_.reset();\r
+\r
+ if(fail_count_++ > 3)\r
+ return false; // Outside didn't handle exception properly, just give up.\r
+\r
+ throw;\r
+ }\r
+\r
return true;\r
}\r
\r
\r
std::shared_ptr<core::read_frame> frame; \r
video_frame_buffer_.pop(frame); \r
- schedule_next_video(make_safe(frame)); \r
+ schedule_next_video(make_safe(frame)); \r
}\r
catch(...)\r
{\r
\r
struct decklink_consumer_proxy : public core::frame_consumer\r
{\r
- const configuration config_;\r
-\r
- com_context<decklink_consumer> context_;\r
+ const configuration config_;\r
+ com_context<decklink_consumer> context_;\r
+ core::video_format_desc format_desc_;\r
+ size_t fail_count_;\r
public:\r
\r
decklink_consumer_proxy(const configuration& config)\r
: config_(config)\r
- , context_(L"decklink_consumer[" + boost::lexical_cast<std::wstring>(config.device_index) + L"]"){}\r
+ , context_(L"decklink_consumer[" + boost::lexical_cast<std::wstring>(config.device_index) + L"]")\r
+ , fail_count_(0)\r
+ {\r
+ }\r
\r
virtual void initialize(const core::video_format_desc& format_desc)\r
{\r
- context_.reset([&]{return new decklink_consumer(config_, format_desc);});\r
+ format_desc_ = format_desc;\r
+ context_.reset([&]{return new decklink_consumer(config_, format_desc_);});\r
}\r
\r
virtual bool send(const safe_ptr<core::read_frame>& frame)\r
{\r
- context_->send(frame);\r
+ if(!context_)\r
+ context_.reset([&]{return new decklink_consumer(config_, format_desc_);});\r
+\r
+ try\r
+ {\r
+ context_->send(frame);\r
+ fail_count_ = 0;\r
+ }\r
+ catch(...)\r
+ {\r
+ context_.reset();\r
+\r
+ if(fail_count_++ > 3)\r
+ return false; // Outside didn't handle exception properly, just give up.\r
+ \r
+ throw;\r
+ }\r
+\r
return true;\r
}\r
\r
\r
virtual const core::video_format_desc& get_video_format_desc() const\r
{\r
- return context_->get_video_format_desc();\r
+ return format_desc_;\r
}\r
}; \r
\r
</producers>\r
<channels>\r
<channel>\r
- <video-mode>1080p5000</video-mode>\r
+ <video-mode>1080i5000</video-mode>\r
<consumers>\r
<decklink>\r
<device>1</device>\r
</consumers>\r
</channel>\r
<channel>\r
- <video-mode>1080p5000</video-mode>\r
+ <video-mode>1080i5000</video-mode>\r
<consumers>\r
<decklink>\r
<device>2</device>\r