From 80b4afc342bbee97b10b72e99e427c5978bc415a Mon Sep 17 00:00:00 2001 From: ronag Date: Mon, 3 Jan 2011 14:35:04 +0000 Subject: [PATCH] git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/branches/2.0.0.2@316 362d55ac-95cf-4e76-9f9a-cbaa9c17b72d --- core/core.vcxproj | 2 +- core/processor/draw_frame.cpp | 2 +- core/producer/flash/flash_producer.cpp | 30 ++++++++++++++------------ shell/shell.vcxproj | 1 + shell/shell.vcxproj.filters | 3 +++ 5 files changed, 22 insertions(+), 16 deletions(-) diff --git a/core/core.vcxproj b/core/core.vcxproj index dc303fc69..801a97000 100644 --- a/core/core.vcxproj +++ b/core/core.vcxproj @@ -20,7 +20,7 @@ StaticLibrary Unicode - true + false StaticLibrary diff --git a/core/processor/draw_frame.cpp b/core/processor/draw_frame.cpp index d1aa70855..ddc53532f 100644 --- a/core/processor/draw_frame.cpp +++ b/core/processor/draw_frame.cpp @@ -92,7 +92,7 @@ void draw_frame::alpha(double value){impl_->image_transform_.alpha = value;} safe_ptr draw_frame::interlace(const safe_ptr& frame1, const safe_ptr& frame2, video_mode::type mode) { - if(frame1 == frame2) + if(frame1 == frame2 || mode == video_mode::progressive) return frame1; auto my_frame1 = make_safe(frame1); diff --git a/core/producer/flash/flash_producer.cpp b/core/producer/flash/flash_producer.cpp index 03d788170..07c2848fb 100644 --- a/core/producer/flash/flash_producer.cpp +++ b/core/producer/flash/flash_producer.cpp @@ -46,7 +46,7 @@ extern __declspec(selectany) CAtlModule* _pAtlModule = &_AtlModule; class flash_renderer { public: - flash_renderer() : last_frame_(draw_frame::empty()), current_frame_(draw_frame::empty()), bmp_data_(nullptr), ax_(nullptr) {} + flash_renderer() : tail_(draw_frame::empty()), head_(draw_frame::empty()), bmp_data_(nullptr), ax_(nullptr) {} ~flash_renderer() { @@ -138,22 +138,24 @@ public: auto frame = frame_processor_->create_frame(); std::copy_n(bmp_data_, format_desc_.size, frame->image_data().begin()); - current_frame_ = frame; + head_ = frame; } - frame_buffer_.try_push(current_frame_); + if(!frame_buffer_.try_push(head_)) + CASPAR_LOG(trace) << print() << " overflow"; } - safe_ptr get_frame(video_mode::type mode) + safe_ptr get_frame() { - frame_buffer_.try_pop(last_frame_); - auto frame1 = last_frame_; - auto frame2 = frame1; - if(mode != video_mode::progressive && frame_buffer_.size() > frame_buffer_.capacity()/2) // Regulate between interlaced and progressive + if(!frame_buffer_.try_pop(tail_)) + CASPAR_LOG(trace) << print() << " underflow"; + + auto frame = tail_; + if(frame_buffer_.size() > frame_buffer_.capacity()/2) // Regulate between interlaced and progressive { - frame_buffer_.try_pop(last_frame_); - frame2 = last_frame_; + frame_buffer_.try_pop(tail_); + frame = draw_frame::interlace(frame, tail_, format_desc_.mode); } - return draw_frame::interlace(frame1, frame2, mode); + return frame; } void stop() @@ -177,8 +179,8 @@ private: CComObject* ax_; tbb::concurrent_bounded_queue> frame_buffer_; - safe_ptr last_frame_; - safe_ptr current_frame_; + safe_ptr tail_; + safe_ptr head_; tbb::concurrent_queue params_; }; @@ -237,7 +239,7 @@ struct flash_producer::implementation virtual safe_ptr receive() { - return renderer_->get_frame(frame_processor_->get_video_format_desc().mode); + return renderer_->get_frame(); } boost::thread thread_; diff --git a/shell/shell.vcxproj b/shell/shell.vcxproj index 61643c975..c75650d23 100644 --- a/shell/shell.vcxproj +++ b/shell/shell.vcxproj @@ -29,6 +29,7 @@ Designer + diff --git a/shell/shell.vcxproj.filters b/shell/shell.vcxproj.filters index 9e6f179f5..f042f0d77 100644 --- a/shell/shell.vcxproj.filters +++ b/shell/shell.vcxproj.filters @@ -23,6 +23,9 @@ My Amplifier Results + + My Amplifier Results + -- 2.39.2