]> git.sesse.net Git - casparcg/commitdiff
2.0.0.2: - Fixed a bug with CASPAR_ASSERT where dbg_break was always called.
authorronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Fri, 21 Jan 2011 12:48:45 +0000 (12:48 +0000)
committerronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Fri, 21 Jan 2011 12:48:45 +0000 (12:48 +0000)
         - Optimized empty/eof functions to return const reference instead of by-value.

git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/branches/2.0.0.2@399 362d55ac-95cf-4e76-9f9a-cbaa9c17b72d

common/memory/safe_ptr.h
common/utility/assert.h
core/consumer/frame_consumer.h
core/core.vcxproj
core/producer/frame_producer.h
core/producer/layer.cpp
mixer/frame/draw_frame.h

index 8f9b5c8833789b358fcf69b558114e11a0408e74..acc17eb6acd2f2f4ec3b5ae2bdc6a8800173da1f 100644 (file)
@@ -16,7 +16,8 @@ public:
        safe_ptr() : impl_(std::make_shared<T>()){}     \r
        \r
        safe_ptr(const safe_ptr<T>& other) : impl_(other.impl_){}  // noexcept\r
-       \r
+       safe_ptr(safe_ptr<T>&& other) : impl_(std::move(other.impl_)){}\r
+\r
        template<typename U>\r
        safe_ptr(const safe_ptr<U>& other, typename std::enable_if<std::is_convertible<U*, T*>::value, void*>::type = 0) : impl_(other.impl_){}  // noexcept\r
                \r
index 29a149719c3e56af99d6e730745b5bc0da1a1061..bd541df3bc01b14841ecb1ae45572893d9fc7fc2 100644 (file)
@@ -10,8 +10,8 @@
 \r
 #define CASPAR_ASSERT_EXPR_STR(str) #str\r
 \r
-#define CASPAR_ASSERT(expr) do{if(!(expr)) CASPAR_LOG(warning) << "\n\nAssertion Failed:\n" << \\r
+#define CASPAR_ASSERT(expr) do{if(!(expr)){ CASPAR_LOG(warning) << "\n\nAssertion Failed:\n" << \\r
        CASPAR_ASSERT_EXPR_STR(expr) << "\n" \\r
        __FILE__ << "\n"; \\r
        _CASPAR_DBG_BREAK;\\r
-       }while(0);
\ No newline at end of file
+       }}while(0);
\ No newline at end of file
index db80152a8577f198f17cb8c00f2c6b4c33d1d515..0f7444d1e427149cf6c7c2fb2a4d03f540d8a7ef 100644 (file)
@@ -36,7 +36,7 @@ struct frame_consumer : boost::noncopyable
        virtual size_t buffer_depth() const = 0;\r
        virtual void initialize(const video_format_desc& format_desc) = 0;\r
 \r
-       static safe_ptr<frame_consumer> empty()\r
+       static const safe_ptr<frame_consumer>& empty()\r
        {\r
                struct empty_frame_consumer : public frame_consumer\r
                {\r
index 00d1d6396b7eafd329ea64d496450551a24fb320..89b23c749fe940f424be4c56a503f199038d2b97 100644 (file)
     <ClCompile Include="producer\layer.cpp">\r
       <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../StdAfx.h</PrecompiledHeaderFile>\r
       <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">../StdAfx.h</PrecompiledHeaderFile>\r
+      <PreprocessToFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</PreprocessToFile>\r
     </ClCompile>\r
     <ClCompile Include="producer\transition\transition_producer.cpp">\r
       <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../../StdAfx.h</PrecompiledHeaderFile>\r
index f522322a59aacfd2b3f51061a410de418db5f39a..2b399e49693ab86628193d8eaf3ccdc5e4a11dfc 100644 (file)
@@ -74,7 +74,7 @@ public:
        ////////////////////////////////////////////////////////////////////////////////////////////////////\r
        virtual void initialize(const safe_ptr<frame_factory>& frame_factory) = 0;\r
 \r
-       static safe_ptr<frame_producer> empty()  // nothrow\r
+       static const safe_ptr<frame_producer>& empty()  // nothrow\r
        {\r
                struct empty_frame_producer : public frame_producer\r
                {\r
index 064a322ff1ffac83e93829dbbaaf3c170afc5548..66fda5c9e61f8970869b51a5d8139a8d732454b9 100644 (file)
@@ -90,18 +90,14 @@ public:
                if(is_paused_)\r
                        return last_frame_;\r
 \r
-               if(foreground_ == frame_producer::empty())\r
-               {\r
-                       last_frame_ = draw_frame::empty();\r
-                       return last_frame_;\r
-               }\r
-\r
                try\r
                {\r
                        last_frame_ = foreground_->receive(); \r
                        last_frame_->set_layer_index(index_);\r
                        if(last_frame_ == draw_frame::eof())\r
                        {\r
+                               CASPAR_ASSERT(foreground_ != frame_producer::empty());\r
+\r
                                auto following = foreground_->get_following_producer();\r
                                following->set_leading_producer(foreground_);\r
                                foreground_ = following;\r
index 311300b9e7e0275b25ea72211c68b131aee91afc..150b07c398b190d657c36b40548df56c2b134a47 100644 (file)
@@ -46,14 +46,14 @@ public:
                \r
        static safe_ptr<draw_frame> interlace(const safe_ptr<draw_frame>& frame1, const safe_ptr<draw_frame>& frame2, video_mode::type mode);\r
                \r
-       static safe_ptr<draw_frame> eof()\r
+       static const safe_ptr<draw_frame>& eof()\r
        {\r
                struct eof_frame : public draw_frame{};\r
                static safe_ptr<draw_frame> frame = make_safe<eof_frame>();\r
                return frame;\r
        }\r
 \r
-       static safe_ptr<draw_frame> empty()\r
+       static const safe_ptr<draw_frame>& empty()\r
        {\r
                struct empty_frame : public draw_frame{};\r
                static safe_ptr<draw_frame> frame = make_safe<empty_frame>();\r