From: ronag Date: Fri, 6 Apr 2012 17:31:39 +0000 (+0000) Subject: git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/branches... X-Git-Tag: 2.1.0_Beta1~533 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=fe931de54f41fb350c1b795d9cc95e99f8604f16;p=casparcg git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/branches/2.1.0@2802 362d55ac-95cf-4e76-9f9a-cbaa9c17b72d --- diff --git a/accelerator/ogl/util/buffer.cpp b/accelerator/ogl/util/buffer.cpp index 5efdd2f4c..fa4e18005 100644 --- a/accelerator/ogl/util/buffer.cpp +++ b/accelerator/ogl/util/buffer.cpp @@ -66,7 +66,7 @@ public: CASPAR_THROW_EXCEPTION(caspar_exception() << msg_info("Failed to allocate buffer.")); if(timer.elapsed() > 0.02) - CASPAR_LOG(debug) << L"[buffer] Performance warning. Buffer allocation blocked more than 20 ms: " << timer.elapsed(); + CASPAR_LOG(debug) << L"[buffer] Performance warning. Buffer allocation blocked: " << timer.elapsed(); //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"); } @@ -80,17 +80,17 @@ public: { if(data_ != nullptr) return data_; + + boost::timer timer; GL(glBindBuffer(target_, pbo_)); if(usage_ == GL_STREAM_DRAW) GL(glBufferData(target_, size_, NULL, usage_)); // Notify OpenGL that we don't care about previous data. - boost::timer timer; - data_ = (uint8_t*)GL2(glMapBuffer(target_, usage_ == GL_STREAM_DRAW ? GL_WRITE_ONLY : GL_READ_ONLY)); if(timer.elapsed() > 0.02) - CASPAR_LOG(debug) << L"[buffer] Performance warning. Buffer mapping blocked more than 20 ms: " << timer.elapsed(); + CASPAR_LOG(debug) << L"[buffer] Performance warning. Buffer mapping blocked: " << timer.elapsed(); GL(glBindBuffer(target_, 0)); if(!data_) diff --git a/accelerator/ogl/util/device.cpp b/accelerator/ogl/util/device.cpp index f09c0ad9a..8d2dab92b 100644 --- a/accelerator/ogl/util/device.cpp +++ b/accelerator/ogl/util/device.cpp @@ -155,10 +155,15 @@ struct device::impl : public std::enable_shared_from_this std::shared_ptr buf; if(!pool->try_pop(buf)) { + boost::timer timer; + buf = executor_.invoke([&] { return spl::make_shared(size, usage); }, task_priority::high_priority); + + if(timer.elapsed() > 0.02) + CASPAR_LOG(debug) << L"[device] Performance warning. Buffer allocation blocked: " << timer.elapsed(); } auto self = shared_from_this(); // buffers can leave the device context, take a hold on life-time. @@ -210,7 +215,7 @@ struct device::impl : public std::enable_shared_from_this texture->copy_from(*buf); texture_cache_.insert(std::make_pair(buf.get(), texture)); - + return texture; }, task_priority::high_priority); } @@ -222,7 +227,8 @@ struct device::impl : public std::enable_shared_from_this return executor_.begin_invoke([=]() -> spl::shared_ptr { auto texture = create_texture(width, height, stride, false); - texture->copy_from(*buf); + texture->copy_from(*buf); + return texture; }, task_priority::high_priority); } diff --git a/core/producer/layer.cpp b/core/producer/layer.cpp index d53f28242..205aad1da 100644 --- a/core/producer/layer.cpp +++ b/core/producer/layer.cpp @@ -111,13 +111,8 @@ public: { try { - boost::timer timer; - auto frame = foreground_->receive(); - - if(timer.elapsed() > 1.0/format_desc.fps*0.9) - CASPAR_LOG(trace) << foreground_->print() << L" Is slowing down channel."; - + if(frame == core::draw_frame::late()) return foreground_->last_frame(); diff --git a/core/video_channel.cpp b/core/video_channel.cpp index 57753c077..febf5da57 100644 --- a/core/video_channel.cpp +++ b/core/video_channel.cpp @@ -108,7 +108,6 @@ public: { try { - boost::timer t; auto format_desc = video_format_desc(); @@ -117,34 +116,19 @@ public: // Produce auto stage_frames = stage_(format_desc); - - if(t.elapsed() > 1.0/format_desc.fps*0.9) - CASPAR_LOG(trace) << print() << L" Stage is slowing down channel: " << t.elapsed(); - - t.restart(); + // Mix auto mixed_frame = mixer_(std::move(stage_frames), format_desc); - if(t.elapsed() > 1.0/format_desc.fps*0.9) - CASPAR_LOG(trace) << print() << L"Mixer is slowing down channel: " << t.elapsed(); - - t.restart(); // Consume output_(std::move(mixed_frame), format_desc); - t.restart(); - graph_->set_value("tick-time", frame_timer.elapsed()*format_desc.fps*0.5); event_subject_ << monitor::event("profiler/time") % frame_timer.elapsed() % (1.0/format_desc_.fps) << monitor::event("format") % format_desc.name; - - if(t.elapsed() > 0.001) - CASPAR_LOG(trace) << L"4## " << t.elapsed(); - - t.restart(); } catch(...) { diff --git a/modules/ffmpeg/producer/input/input.cpp b/modules/ffmpeg/producer/input/input.cpp index f356aa3fa..a8a5d8be4 100644 --- a/modules/ffmpeg/producer/input/input.cpp +++ b/modules/ffmpeg/producer/input/input.cpp @@ -148,6 +148,9 @@ struct input::impl : boost::noncopyable graph_->set_color("audio-buffer", diagnostics::color(0.7f, 0.4f, 0.4f)); graph_->set_color("video-buffer", diagnostics::color(1.0f, 1.0f, 0.0f)); + for(int n = 0; n < 8; ++n) + tick(); + thread_ = boost::thread([this]{run();}); }