boost::timer tick_timer_;\r
boost::timer output_timer_;\r
\r
- video_channel_context& channel_;\r
+ video_channel_context& channel_;\r
public:\r
implementation(video_channel_context& video_channel) \r
: diag_(diagnostics::create_graph(std::string("frame_producer_device")))\r
else\r
{\r
if(channel_.format_desc != other.impl_->channel_.format_desc)\r
- BOOST_THROW_EXCEPTION(invalid_operation() << msg_info("Cannot swap between channels with different formats."));\r
+ BOOST_THROW_EXCEPTION(not_supported() << msg_info("Cannot swap between channels with different formats."));\r
\r
auto func = [&]{layers_[index].swap(other.impl_->layers_[other_index]);};\r
\r
return;\r
\r
if(channel_.format_desc != other.impl_->channel_.format_desc)\r
- BOOST_THROW_EXCEPTION(invalid_operation() << msg_info("Cannot swap between channels with different formats."));\r
+ BOOST_THROW_EXCEPTION(not_supported() << msg_info("Cannot swap between channels with different formats."));\r
\r
auto func = [&]\r
{\r
std::array<blue_dma_buffer_ptr, 4> reserved_frames_; \r
tbb::concurrent_bounded_queue<std::shared_ptr<const core::read_frame>> frame_buffer_;\r
\r
+ int preroll_count_;\r
+\r
const bool embedded_audio_;\r
\r
executor executor_;\r
, mem_fmt_(MEM_FMT_ARGB_PC)\r
, upd_fmt_(UPD_FMT_FRAME)\r
, res_fmt_(RES_FMT_NORMAL) \r
- , engine_mode_(VIDEO_ENGINE_FRAMESTORE) \r
+ , engine_mode_(VIDEO_ENGINE_FRAMESTORE) \r
+ , preroll_count_(0)\r
, embedded_audio_(embedded_audio)\r
, executor_(print())\r
{\r
graph_->add_guide("frame-time", 0.5f); \r
graph_->set_color("frame-time", diagnostics::color(1.0f, 0.0f, 0.0f));\r
graph_->set_color("sync-time", diagnostics::color(0.5f, 1.0f, 0.2f));\r
+ graph_->set_color("input-buffer", diagnostics::color(1.0f, 1.0f, 0.0f));\r
\r
//Setting output Video mode\r
if(BLUE_FAIL(set_card_property(blue_, VIDEO_MODE, vid_fmt_))) \r
\r
for(size_t n = 0; n < reserved_frames_.size(); ++n)\r
reserved_frames_[n] = std::make_shared<blue_dma_buffer>(format_desc_.size, n); \r
-\r
- for(int n = 0; n < executor_.capacity(); ++n)\r
- schedule_next_video(core::read_frame::empty());\r
- \r
+ \r
CASPAR_LOG(info) << print() << L" Successfully Initialized.";\r
}\r
\r
}\r
\r
void send(const safe_ptr<const core::read_frame>& frame)\r
- { \r
+ { \r
+ if(preroll_count_ < executor_.capacity())\r
+ {\r
+ while(preroll_count_++ < executor_.capacity())\r
+ schedule_next_video(core::read_frame::empty());\r
+ }\r
+ \r
schedule_next_video(frame); \r
}\r
\r
{\r
try\r
{\r
- frame_timer_.restart();\r
+ const size_t audio_samples = format_desc_.audio_samples_per_frame;\r
+ const size_t audio_nchannels = format_desc_.audio_channels;\r
\r
- const size_t audio_samples = static_cast<size_t>(48000.0 / format_desc_.fps);\r
- const size_t audio_nchannels = 2;\r
+ frame_timer_.restart();\r
\r
if(!frame->image_data().empty())\r
fast_memcpy(reserved_frames_.front()->image_data(), frame->image_data().begin(), frame->image_data().size());\r
{\r
CASPAR_LOG_CURRENT_EXCEPTION();\r
}\r
+ graph_->set_value("input-buffer", static_cast<double>(executor_.size())/static_cast<double>(executor_.capacity()));\r
});\r
+ graph_->set_value("input-buffer", static_cast<double>(executor_.size())/static_cast<double>(executor_.capacity()));\r
}\r
\r
void encode_hanc(BLUE_UINT32* hanc_data, void* audio_data, size_t audio_samples, size_t audio_nchannels)\r