CASPAR_THROW_EXCEPTION(caspar_exception() << msg_info("Failed to allocate buffer."));\r
\r
if(timer.elapsed() > 0.02)\r
- CASPAR_LOG(debug) << L"[buffer] Performance warning. Buffer allocation blocked more than 20 ms: " << timer.elapsed();\r
+ CASPAR_LOG(debug) << L"[buffer] Performance warning. Buffer allocation blocked: " << timer.elapsed();\r
\r
//CASPAR_LOG(trace) << "[buffer] [" << ++(usage_ == buffer::usage::write_only ? g_w_total_count : g_r_total_count) << L"] allocated size:" << size_ << " usage: " << (usage == buffer::usage::write_only ? "write_only" : "read_only");\r
} \r
{\r
if(data_ != nullptr)\r
return data_;\r
+ \r
+ boost::timer timer;\r
\r
GL(glBindBuffer(target_, pbo_));\r
if(usage_ == GL_STREAM_DRAW) \r
GL(glBufferData(target_, size_, NULL, usage_)); // Notify OpenGL that we don't care about previous data.\r
\r
- boost::timer timer;\r
-\r
data_ = (uint8_t*)GL2(glMapBuffer(target_, usage_ == GL_STREAM_DRAW ? GL_WRITE_ONLY : GL_READ_ONLY)); \r
\r
if(timer.elapsed() > 0.02)\r
- CASPAR_LOG(debug) << L"[buffer] Performance warning. Buffer mapping blocked more than 20 ms: " << timer.elapsed();\r
+ CASPAR_LOG(debug) << L"[buffer] Performance warning. Buffer mapping blocked: " << timer.elapsed();\r
\r
GL(glBindBuffer(target_, 0));\r
if(!data_)\r
std::shared_ptr<buffer> buf;\r
if(!pool->try_pop(buf)) \r
{\r
+ boost::timer timer;\r
+\r
buf = executor_.invoke([&]\r
{\r
return spl::make_shared<buffer>(size, usage);\r
}, task_priority::high_priority);\r
+ \r
+ if(timer.elapsed() > 0.02)\r
+ CASPAR_LOG(debug) << L"[device] Performance warning. Buffer allocation blocked: " << timer.elapsed();\r
}\r
\r
auto self = shared_from_this(); // buffers can leave the device context, take a hold on life-time.\r
texture->copy_from(*buf); \r
\r
texture_cache_.insert(std::make_pair(buf.get(), texture));\r
-\r
+ \r
return texture;\r
}, task_priority::high_priority);\r
}\r
return executor_.begin_invoke([=]() -> spl::shared_ptr<texture>\r
{\r
auto texture = create_texture(width, height, stride, false);\r
- texture->copy_from(*buf); \r
+ texture->copy_from(*buf); \r
+ \r
return texture;\r
}, task_priority::high_priority);\r
}\r
{ \r
try\r
{ \r
- boost::timer timer;\r
-\r
auto frame = foreground_->receive();\r
-\r
- if(timer.elapsed() > 1.0/format_desc.fps*0.9)\r
- CASPAR_LOG(trace) << foreground_->print() << L" Is slowing down channel.";\r
-\r
+ \r
if(frame == core::draw_frame::late())\r
return foreground_->last_frame();\r
\r
{\r
try\r
{\r
- boost::timer t;\r
\r
auto format_desc = video_format_desc();\r
\r
// Produce\r
\r
auto stage_frames = stage_(format_desc);\r
-\r
- if(t.elapsed() > 1.0/format_desc.fps*0.9)\r
- CASPAR_LOG(trace) << print() << L" Stage is slowing down channel: " << t.elapsed();\r
-\r
- t.restart();\r
+ \r
// Mix\r
\r
auto mixed_frame = mixer_(std::move(stage_frames), format_desc);\r
\r
- if(t.elapsed() > 1.0/format_desc.fps*0.9)\r
- CASPAR_LOG(trace) << print() << L"Mixer is slowing down channel: " << t.elapsed();\r
-\r
- t.restart();\r
// Consume\r
\r
output_(std::move(mixed_frame), format_desc);\r
\r
- t.restart();\r
-\r
graph_->set_value("tick-time", frame_timer.elapsed()*format_desc.fps*0.5);\r
\r
event_subject_ << monitor::event("profiler/time") % frame_timer.elapsed() % (1.0/format_desc_.fps)\r
<< monitor::event("format") % format_desc.name;\r
- \r
- if(t.elapsed() > 0.001)\r
- CASPAR_LOG(trace) << L"4## " << t.elapsed();\r
-\r
- t.restart();\r
}\r
catch(...)\r
{\r
graph_->set_color("audio-buffer", diagnostics::color(0.7f, 0.4f, 0.4f));\r
graph_->set_color("video-buffer", diagnostics::color(1.0f, 1.0f, 0.0f)); \r
\r
+ for(int n = 0; n < 8; ++n)\r
+ tick();\r
+\r
thread_ = boost::thread([this]{run();});\r
}\r
\r