]> git.sesse.net Git - casparcg/commitdiff
Fixed graph memory-leak.
authorronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Thu, 22 Dec 2011 20:06:21 +0000 (20:06 +0000)
committerronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Thu, 22 Dec 2011 20:06:21 +0000 (20:06 +0000)
git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/trunk@1924 362d55ac-95cf-4e76-9f9a-cbaa9c17b72d

18 files changed:
common/common.vcxproj
common/common.vcxproj.filters
common/concurrency/lock.h [new file with mode: 0644]
common/diagnostics/graph.cpp
common/diagnostics/graph.h
core/consumer/output.cpp
core/mixer/audio/audio_mixer.cpp
core/mixer/mixer.cpp
core/producer/stage.cpp
modules/bluefish/consumer/bluefish_consumer.cpp
modules/decklink/consumer/decklink_consumer.cpp
modules/decklink/producer/decklink_producer.cpp
modules/ffmpeg/consumer/ffmpeg_consumer.cpp
modules/ffmpeg/producer/ffmpeg_producer.cpp
modules/ffmpeg/producer/input/input.cpp
modules/flash/producer/flash_producer.cpp
modules/oal/consumer/oal_consumer.cpp
modules/ogl/consumer/ogl_consumer.cpp

index fecb1cad9ce984363a1c6936e5d2206dbeb8bdef..f889ce3340f767e0a16fbc61327b034524073fec 100644 (file)
     <ClInclude Include="compiler\vs\disable_silly_warnings.h" />\r
     <ClInclude Include="concurrency\com_context.h" />\r
     <ClInclude Include="concurrency\executor.h" />\r
+    <ClInclude Include="concurrency\lock.h" />\r
     <ClInclude Include="concurrency\target.h" />\r
     <ClInclude Include="diagnostics\graph.h" />\r
     <ClInclude Include="exception\exceptions.h" />\r
index 8d1362df984288324a4ac0535bb310584caf63d7..1a5155289638e6d63b996aef99d026c4124e8e02 100644 (file)
     <ClInclude Include="utility\utf8conv_inl.h">\r
       <Filter>source\utility</Filter>\r
     </ClInclude>\r
+    <ClInclude Include="concurrency\lock.h">\r
+      <Filter>source\concurrency</Filter>\r
+    </ClInclude>\r
   </ItemGroup>\r
 </Project>
\ No newline at end of file
diff --git a/common/concurrency/lock.h b/common/concurrency/lock.h
new file mode 100644 (file)
index 0000000..1182d09
--- /dev/null
@@ -0,0 +1,12 @@
+#pragma once\r
+\r
+namespace caspar {\r
+\r
+template<typename T, typename F>\r
+void lock(T& mutex, F&& func)\r
+{\r
+       T::scoped_lock lock(mutex);\r
+       func();\r
+}\r
+\r
+}
\ No newline at end of file
index b71606f93f85a1d892f2a3e4607dab72ae12fec6..22e1aa414eac1ffd5fa2499291ec16bc463e7373 100644 (file)
@@ -26,6 +26,7 @@
 #pragma warning (disable : 4244)\r
 \r
 #include "../concurrency/executor.h"\r
+#include "../concurrency/lock.h"\r
 #include "../env.h"\r
 \r
 #include <SFML/Graphics.hpp>\r
 #include <boost/circular_buffer.hpp>\r
 #include <boost/range/algorithm_ext/erase.hpp>\r
 \r
-#include <numeric>\r
-#include <map>\r
+#include <tbb/concurrent_unordered_map.h>\r
+#include <tbb/atomic.h>\r
+#include <tbb/spin_mutex.h>\r
+\r
 #include <array>\r
+#include <numeric>\r
+#include <tuple>\r
 \r
 namespace caspar { namespace diagnostics {\r
                \r
+int color(float r, float g, float b, float a)\r
+{\r
+       int code = 0;\r
+       code |= static_cast<int>(r*255.0f+0.5f) << 24;\r
+       code |= static_cast<int>(g*255.0f+0.5f) << 16;\r
+       code |= static_cast<int>(b*255.0f+0.5f) <<  8;\r
+       code |= static_cast<int>(a*255.0f+0.5f) <<  0;\r
+       return code;\r
+}\r
+\r
+std::tuple<float, float, float, float> color(int code)\r
+{\r
+       float r = static_cast<float>((code >> 24) & 255)/255.0f;\r
+       float g = static_cast<float>((code >> 16) & 255)/255.0f;\r
+       float b = static_cast<float>((code >>  8) & 255)/255.0f;\r
+       float a = static_cast<float>((code >>  0) & 255)/255.0f;\r
+       return std::make_tuple(r, g, b, a);\r
+}\r
+\r
 struct drawable : public sf::Drawable\r
 {\r
        virtual ~drawable(){}\r
@@ -52,24 +76,17 @@ class context : public drawable
 {      \r
        std::unique_ptr<sf::RenderWindow> window_;\r
        \r
-       std::list<std::shared_ptr<drawable>> drawables_;\r
+       std::list<std::weak_ptr<drawable>> drawables_;\r
                \r
        executor executor_;\r
 public:                                        \r
 \r
-       template<typename Func>\r
-       static void begin_invoke(Func&& func, task_priority priority) // noexcept\r
-       {       \r
-               if(get_instance().executor_.size() < 128)\r
-                       get_instance().executor_.begin_invoke(std::forward<Func>(func), priority);      \r
-       }\r
-\r
        static void register_drawable(const std::shared_ptr<drawable>& drawable)\r
        {\r
                if(!drawable)\r
                        return;\r
 \r
-               begin_invoke([=]\r
+               get_instance().executor_.begin_invoke([=]\r
                {\r
                        get_instance().do_register_drawable(drawable);\r
                }, high_priority);\r
@@ -77,7 +94,7 @@ public:
 \r
        static void show(bool value)\r
        {\r
-               begin_invoke([=]\r
+               get_instance().executor_.begin_invoke([=]\r
                {       \r
                        get_instance().do_show(value);\r
                }, high_priority);\r
@@ -95,7 +112,7 @@ private:
                {\r
                        if(!window_)\r
                        {\r
-                               window_.reset(new sf::RenderWindow(sf::VideoMode(600, 1000), "CasparCG Diagnostics"));\r
+                               window_.reset(new sf::RenderWindow(sf::VideoMode(750, 750), "CasparCG Diagnostics"));\r
                                window_->SetPosition(0, 0);\r
                                window_->SetActive();\r
                                glEnable(GL_BLEND);\r
@@ -126,7 +143,7 @@ private:
                glClear(GL_COLOR_BUFFER_BIT);\r
                window_->Draw(*this);\r
                window_->Display();\r
-               boost::this_thread::sleep(boost::posix_time::milliseconds(20));\r
+               boost::this_thread::sleep(boost::posix_time::milliseconds(15));\r
                executor_.begin_invoke([this]{tick();});\r
        }\r
 \r
@@ -139,8 +156,8 @@ private:
                int n = 0;\r
                for(auto it = drawables_.begin(); it != drawables_.end(); ++n)\r
                {\r
-                       auto& drawable = *it;\r
-                       if(!drawable.unique())\r
+                       auto drawable = it->lock();\r
+                       if(drawable)\r
                        {\r
                                drawable->SetScale(static_cast<float>(window_->GetWidth()), static_cast<float>(target_dy*window_->GetHeight()));\r
                                float target_y = std::max(last_y, static_cast<float>(n * window_->GetHeight())*target_dy);\r
@@ -155,8 +172,15 @@ private:
        \r
        void do_register_drawable(const std::shared_ptr<drawable>& drawable)\r
        {\r
-               if(std::find(drawables_.begin(), drawables_.end(), drawable) == drawables_.end())\r
-                       drawables_.push_back(drawable);\r
+               drawables_.push_back(drawable);\r
+               auto it = drawables_.begin();\r
+               while(it != drawables_.end())\r
+               {\r
+                       if(it->lock())\r
+                               ++it;\r
+                       else    \r
+                               it = drawables_.erase(it);                      \r
+               }\r
        }\r
        \r
        static context& get_instance()\r
@@ -166,105 +190,55 @@ private:
        }\r
 };\r
 \r
-class guide : public drawable\r
-{\r
-       float value_;\r
-       color c_;\r
-public:\r
-       guide(color c = color(1.0f, 1.0f, 1.0f, 0.6f)) \r
-               : value_(0.0f)\r
-               , c_(c){}\r
-\r
-       guide(float value, color c = color(1.0f, 1.0f, 1.0f, 0.6f)) \r
-               : value_(value)\r
-               , c_(c){}\r
-                       \r
-       void set_color(color c) {c_ = c;}\r
-\r
-       void render(sf::RenderTarget&)\r
-       {               \r
-               glEnable(GL_LINE_STIPPLE);\r
-               glLineStipple(3, 0xAAAA);\r
-               glBegin(GL_LINE_STRIP); \r
-                       glColor4f(c_.red, c_.green, c_.blue+0.2f, c_.alpha);            \r
-                       glVertex3f(0.0f, (1.0f-value_) * 0.8f + 0.1f, 0.0f);            \r
-                       glVertex3f(1.0f, (1.0f-value_) * 0.8f + 0.1f, 0.0f);    \r
-               glEnd();\r
-               glDisable(GL_LINE_STIPPLE);\r
-       }\r
-};\r
-\r
 class line : public drawable\r
 {\r
-       boost::optional<diagnostics::guide> guide_;\r
-       boost::circular_buffer<std::pair<double, bool>> line_data_;\r
+       boost::circular_buffer<std::pair<float, bool>> line_data_;\r
 \r
-       boost::circular_buffer<double>  tick_data_;\r
-       bool                                                    tick_tag_;\r
-       color c_;\r
+       tbb::atomic<float>      tick_data_;\r
+       tbb::atomic<bool>       tick_tag_;\r
+       tbb::atomic<int>        color_;\r
 public:\r
        line(size_t res = 600)\r
                : line_data_(res)\r
-               , tick_data_(50)\r
-               , tick_tag_(false)\r
-               , c_(1.0f, 1.0f, 1.0f)\r
        {\r
+               tick_data_      = -1.0f;\r
+               color_          = 0xFFFFFFFF;\r
+               tick_tag_       = false;\r
+\r
                line_data_.push_back(std::make_pair(-1.0f, false));\r
        }\r
        \r
-       void update(double value)\r
+       void set_value(float value)\r
        {\r
-               tick_data_.push_back(value);\r
-       }\r
-\r
-       void set(double value)\r
-       {\r
-               tick_data_.clear();\r
-               tick_data_.push_back(value);\r
+               tick_data_ = value;\r
        }\r
        \r
-       void tag()\r
+       void set_tag()\r
        {\r
                tick_tag_ = true;\r
        }\r
-\r
-       void guide(const guide& guide)\r
+               \r
+       void set_color(int color)\r
        {\r
-               guide_ = guide;\r
-               guide_->set_color(c_);\r
+               color_ = color;\r
        }\r
-       \r
-       void set_color(color c)\r
+\r
+       int get_color()\r
        {\r
-               c_ = c;\r
-               if(guide_)\r
-                       guide_->set_color(c_);\r
+               return color_;\r
        }\r
-\r
-       color get_color() const { return c_; }\r
-       \r
+               \r
        void render(sf::RenderTarget& target)\r
        {\r
                float dx = 1.0f/static_cast<float>(line_data_.capacity());\r
                float x = static_cast<float>(line_data_.capacity()-line_data_.size())*dx;\r
 \r
-               if(!tick_data_.empty())\r
-               {\r
-                       float sum = std::accumulate(tick_data_.begin(), tick_data_.end(), 0.0) + std::numeric_limits<float>::min();\r
-                       line_data_.push_back(std::make_pair(static_cast<float>(sum)/static_cast<float>(tick_data_.size()), tick_tag_));\r
-                       tick_data_.clear();\r
-               }\r
-               else if(!line_data_.empty())\r
-               {\r
-                       line_data_.push_back(std::make_pair(line_data_.back().first, tick_tag_));\r
-               }\r
-               tick_tag_ = false;\r
-\r
-               if(guide_)\r
-                       target.Draw(*guide_);\r
-               \r
+               line_data_.push_back(std::make_pair(tick_data_, tick_tag_));            \r
+               tick_tag_   = false;\r
+                               \r
                glBegin(GL_LINE_STRIP);\r
-               glColor4f(c_.red, c_.green, c_.blue, 0.8f);             \r
+               auto c = color(color_);\r
+               glColor4f(std::get<0>(c), std::get<1>(c), std::get<2>(c), 0.8f);                \r
                for(size_t n = 0; n < line_data_.size(); ++n)           \r
                        if(line_data_[n].first > -0.5)\r
                                glVertex3d(x+n*dx, std::max(0.05, std::min(0.95, (1.0f-line_data_[n].first)*0.8 + 0.1f)), 0.0);         \r
@@ -276,8 +250,7 @@ public:
                {\r
                        if(line_data_[n].second)\r
                        {\r
-                               glBegin(GL_LINE_STRIP);\r
-                               glColor4f(c_.red, c_.green, c_.blue, c_.alpha);                                 \r
+                               glBegin(GL_LINE_STRIP);                 \r
                                        glVertex3f(x+n*dx, 0.0f, 0.0f);                         \r
                                        glVertex3f(x+n*dx, 1.0f, 0.0f);         \r
                                glEnd();\r
@@ -287,46 +260,41 @@ public:
        }\r
 };\r
 \r
-struct graph::implementation : public drawable\r
+struct graph::impl : public drawable\r
 {\r
-       std::map<std::string, diagnostics::line> lines_;\r
-       std::string name_;\r
-       std::string text_;\r
-       \r
-       implementation(const std::string& name) \r
-               : name_(name)\r
-               , text_(name_){}\r
-       \r
-       void set_text(const std::string& value)\r
-       {\r
-               text_ = value;\r
-       }\r
+       tbb::concurrent_unordered_map<std::string, diagnostics::line> lines_;\r
+\r
+       tbb::spin_mutex mutex_;\r
+       std::wstring text_;\r
 \r
-       void update(const std::string& name, double value)\r
+       impl()\r
        {\r
-               lines_[name].update(value);\r
        }\r
-\r
-       void set(const std::string& name, double value)\r
+               \r
+       void set_text(const std::wstring& value)\r
        {\r
-               lines_[name].set(value);\r
+               auto temp = value;\r
+               lock(mutex_, [&]\r
+               {\r
+                       text_ = std::move(temp);\r
+               });\r
        }\r
 \r
-       void tag(const std::string& name)\r
+       void set_value(const std::string& name, double value)\r
        {\r
-               lines_[name].tag();\r
+               lines_[name].set_value(value);\r
        }\r
 \r
-       void set_color(const std::string& name, color c)\r
+       void set_tag(const std::string& name)\r
        {\r
-               lines_[name].set_color(c);\r
+               lines_[name].set_tag();\r
        }\r
-       \r
-       void guide(const std::string& name, double value)\r
+\r
+       void set_color(const std::string& name, int color)\r
        {\r
-               lines_[name].guide(diagnostics::guide(value));  \r
+               lines_[name].set_color(color);\r
        }\r
-       \r
+               \r
 private:\r
        void render(sf::RenderTarget& target)\r
        {\r
@@ -334,7 +302,13 @@ private:
                const size_t text_margin = 2;\r
                const size_t text_offset = (text_size+text_margin*2)*2;\r
 \r
-               sf::String text(text_.c_str(), sf::Font::GetDefaultFont(), text_size);\r
+               std::wstring text_str;\r
+               {\r
+                       tbb::spin_mutex::scoped_lock lock(mutex_);\r
+                       text_str = text_;\r
+               }\r
+\r
+               sf::String text(text_str.c_str(), sf::Font::GetDefaultFont(), text_size);\r
                text.SetStyle(sf::String::Italic);\r
                text.Move(text_margin, text_margin);\r
                \r
@@ -347,7 +321,7 @@ private:
                                sf::String line_text(it->first, sf::Font::GetDefaultFont(), text_size);\r
                                line_text.SetPosition(x_offset, text_margin+text_offset/2);\r
                                auto c = it->second.get_color();\r
-                               line_text.SetColor(sf::Color(c.red*255.0f, c.green*255.0f, c.blue*255.0f, c.alpha*255.0f));\r
+                               line_text.SetColor(sf::Color((c >> 24) & 255, (c >> 16) & 255, (c >> 8) & 255, (c >> 0) & 255));\r
                                target.Draw(line_text);\r
                                x_offset = line_text.GetRect().Right + text_margin*2;\r
                        }\r
@@ -367,8 +341,25 @@ private:
                        glTranslated(0.0f, text_offset/GetScale().y, 1.0f);\r
                        glScaled(1.0f, 1.0-text_offset/GetScale().y, 1.0f);\r
                \r
-                       target.Draw(diagnostics::guide(1.0f, color(1.0f, 1.0f, 1.0f, 0.6f)));\r
-                       target.Draw(diagnostics::guide(0.0f, color(1.0f, 1.0f, 1.0f, 0.6f)));\r
+                       glEnable(GL_LINE_STIPPLE);\r
+                       glLineStipple(3, 0xAAAA);\r
+                       glColor4f(1.0f, 1.0f, 1.9f, 0.5f);      \r
+                       glBegin(GL_LINE_STRIP);         \r
+                               glVertex3f(0.0f, (1.0f-0.5f) * 0.8f + 0.1f, 0.0f);              \r
+                               glVertex3f(1.0f, (1.0f-0.5f) * 0.8f + 0.1f, 0.0f);      \r
+                       glEnd();\r
+                       glBegin(GL_LINE_STRIP);         \r
+                               glVertex3f(0.0f, (1.0f-0.0f) * 0.8f + 0.1f, 0.0f);              \r
+                               glVertex3f(1.0f, (1.0f-0.0f) * 0.8f + 0.1f, 0.0f);      \r
+                       glEnd();\r
+                       glBegin(GL_LINE_STRIP);         \r
+                               glVertex3f(0.0f, (1.0f-1.0f) * 0.8f + 0.1f, 0.0f);              \r
+                               glVertex3f(1.0f, (1.0f-1.0f) * 0.8f + 0.1f, 0.0f);      \r
+                       glEnd();\r
+                       glDisable(GL_LINE_STIPPLE);\r
+\r
+                       //target.Draw(diagnostics::guide(1.0f, color(1.0f, 1.0f, 1.0f, 0.6f)));\r
+                       //target.Draw(diagnostics::guide(0.0f, color(1.0f, 1.0f, 1.0f, 0.6f)));\r
 \r
                        for(auto it = lines_.begin(); it != lines_.end(); ++it)         \r
                                target.Draw(it->second);\r
@@ -376,73 +367,18 @@ private:
                glPopMatrix();\r
        }\r
 \r
-       implementation(implementation&);\r
-       implementation& operator=(implementation&);\r
+       impl(impl&);\r
+       impl& operator=(impl&);\r
 };\r
        \r
-graph::graph() : impl_(new implementation(""))\r
-{\r
-\r
-}\r
-\r
-void graph::set_text(const std::string& value)\r
+graph::graph() : impl_(new impl())\r
 {\r
-       auto p = impl_;\r
-       context::begin_invoke([=]\r
-       {       \r
-               p->set_text(value);\r
-       }, high_priority);\r
 }\r
 \r
-void graph::set_text(const std::wstring& value)\r
-{\r
-       auto p = impl_;\r
-       context::begin_invoke([=]\r
-       {       \r
-               set_text(narrow(value));\r
-       }, high_priority);\r
-}\r
-\r
-void graph::update_value(const std::string& name, double value)\r
-{\r
-       auto p = impl_;\r
-       context::begin_invoke([=]\r
-       {       \r
-               p->update(name, value);\r
-       }, high_priority);\r
-}\r
-void graph::set_value(const std::string& name, double value)\r
-{      \r
-       auto p = impl_;\r
-       context::begin_invoke([=]\r
-       {       \r
-               p->set(name, value);\r
-       }, high_priority);      \r
-}\r
-void graph::set_color(const std::string& name, color c)\r
-{              \r
-       auto p = impl_;\r
-       context::begin_invoke([=]\r
-       {       \r
-               p->set_color(name, c);\r
-       }, high_priority);\r
-}\r
-void graph::add_tag(const std::string& name)\r
-{              \r
-       auto p = impl_;\r
-       context::begin_invoke([=]\r
-       {       \r
-               p->tag(name);\r
-       }, high_priority);\r
-}\r
-void graph::add_guide(const std::string& name, double value)\r
-{      \r
-       auto p = impl_;\r
-       context::begin_invoke([=]\r
-       {       \r
-               p->guide(name, value);\r
-       }, high_priority);\r
-}\r
+void graph::set_text(const std::wstring& value){impl_->set_text(value);}\r
+void graph::set_value(const std::string& name, double value){impl_->set_value(name, value);}\r
+void graph::set_color(const std::string& name, int color){impl_->set_color(name, color);}\r
+void graph::set_tag(const std::string& name){impl_->set_tag(name);}\r
 \r
 void register_graph(const safe_ptr<graph>& graph)\r
 {\r
@@ -457,16 +393,16 @@ void show_graphs(bool value)
 //namespace v2\r
 //{    \r
 //     \r
-//struct line::implementation\r
+//struct line::impl\r
 //{\r
 //     std::wstring name_;\r
 //     boost::circular_buffer<data> ticks_;\r
 //\r
-//     implementation(const std::wstring& name) \r
+//     impl(const std::wstring& name) \r
 //             : name_(name)\r
 //             , ticks_(1024){}\r
 //     \r
-//     void update_value(float value)\r
+//     void set_value(float value)\r
 //     {\r
 //             ticks_.push_back();\r
 //             ticks_.back().value = value;\r
@@ -475,36 +411,36 @@ void show_graphs(bool value)
 //     void set_value(float value)\r
 //     {\r
 //             ticks_.clear();\r
-//             update_value(value);\r
+//             set_value(value);\r
 //     }\r
 //};\r
 //\r
 //line::line(){}\r
-//line::line(const std::wstring& name) : impl_(new implementation(name)){}\r
+//line::line(const std::wstring& name) : impl_(new impl(name)){}\r
 //std::wstring line::print() const {return impl_->name_;}\r
-//void line::update_value(float value){impl_->update_value(value);}\r
+//void line::set_value(float value){impl_->set_value(value);}\r
 //void line::set_value(float value){impl_->set_value(value);}\r
 //boost::circular_buffer<data>& line::ticks() { return impl_->ticks_;}\r
 //\r
-//struct graph::implementation\r
+//struct graph::impl\r
 //{\r
 //     std::map<std::wstring, line> lines_;\r
 //     color                                            color_;\r
 //     printer                                          printer_;\r
 //\r
-//     implementation(const std::wstring& name) \r
+//     impl(const std::wstring& name) \r
 //             : printer_([=]{return name;}){}\r
 //\r
-//     implementation(const printer& parent_printer) \r
+//     impl(const printer& parent_printer) \r
 //             : printer_(parent_printer){}\r
 //     \r
-//     void update_value(const std::wstring& name, float value)\r
+//     void set_value(const std::wstring& name, float value)\r
 //     {\r
 //             auto it = lines_.find(name);\r
 //             if(it == lines_.end())\r
 //                     it = lines_.insert(std::make_pair(name, line(name))).first;\r
 //\r
-//             it->second.update_value(value);\r
+//             it->second.set_value(value);\r
 //     }\r
 //\r
 //     void set_value(const std::wstring& name, float value)\r
@@ -537,9 +473,9 @@ void show_graphs(bool value)
 //     }\r
 //};\r
 //     \r
-//graph::graph(const std::wstring& name) : impl_(new implementation(name)){}\r
-//graph::graph(const printer& parent_printer) : impl_(new implementation(parent_printer)){}\r
-//void graph::update_value(const std::wstring& name, float value){impl_->update_value(name, value);}\r
+//graph::graph(const std::wstring& name) : impl_(new impl(name)){}\r
+//graph::graph(const printer& parent_printer) : impl_(new impl(parent_printer)){}\r
+//void graph::set_value(const std::wstring& name, float value){impl_->set_value(name, value);}\r
 //void graph::set_value(const std::wstring& name, float value){impl_->set_value(name, value);}\r
 //void graph::set_color(const std::wstring& name, color c){impl_->set_color(name, c);}\r
 //color graph::get_color() const {return impl_->get_color();}\r
index 5bdcda25a829d144350320f1a27cbe70c74b92fa..78a8aa8b20e8b4270dd1f986fa2dec55e35957cf 100644 (file)
 \r
 #include "../memory/safe_ptr.h"\r
 \r
-#include <functional>\r
 #include <string>\r
-#include <vector>\r
-#include <map>\r
+#include <tuple>\r
 \r
-#include <boost/range/iterator_range.hpp>\r
-#include <boost/circular_buffer.hpp>\r
-\r
-namespace caspar {\r
-               \r
-typedef std::function<std::wstring()> printer;\r
-       \r
-namespace diagnostics {\r
-       \r
-struct color\r
-{\r
-       float red;\r
-       float green;\r
-       float blue;\r
-       float alpha;\r
+namespace caspar { namespace diagnostics {\r
        \r
-       color(float r = 0.0f, float g = 0.0f, float b = 0.0f, float a = 1.0f)\r
-               : red(r)\r
-               , green(g)\r
-               , blue(b)\r
-               , alpha(a){}\r
-};\r
+int color(float r, float g, float b, float a = 1.0f);\r
+std::tuple<float, float, float, float> color(int code);\r
 \r
 class graph\r
 {\r
        friend void register_graph(const safe_ptr<graph>& graph);\r
 public:\r
        graph();\r
-       void set_text(const std::string& value);\r
        void set_text(const std::wstring& value);\r
-       void update_value(const std::string& name, double value);\r
        void set_value(const std::string& name, double value);\r
-       void set_color(const std::string& name, color c);\r
-       void add_tag(const std::string& name);\r
-       void add_guide(const std::string& name, double value);\r
+       void set_color(const std::string& name, int color);\r
+       void set_tag(const std::string& name);\r
 private:\r
-       struct implementation;\r
-       std::shared_ptr<implementation> impl_;\r
+       struct impl;\r
+       std::shared_ptr<impl> impl_;\r
 };\r
 \r
 void register_graph(const safe_ptr<graph>& graph);\r
 void show_graphs(bool value);\r
 \r
-//namespace v2\r
-//{\r
-//     \r
-//     struct data\r
-//     {\r
-//             float value;\r
-//     };\r
-//\r
-//     class line\r
-//     {\r
-//     public:\r
-//             line();\r
-//             line(const std::wstring& name);\r
-//             std::wstring print() const;\r
-//             void update_value(float value);\r
-//             void set_value(float value);\r
-//             void set_tag(const std::wstring& tag);\r
-//\r
-//             boost::circular_buffer<data>& ticks();\r
-//     private:\r
-//             struct implementation;\r
-//             std::shared_ptr<implementation> impl_;\r
-//     };\r
-//     \r
-//     class graph;\r
-//\r
-//\r
-//     class graph\r
-//     {\r
-//     public:\r
-//             graph(const std::wstring& name);\r
-//             graph(const printer& parent_printer);\r
-//\r
-//             void update_value(const std::wstring& name, float value);\r
-//             void set_value(const std::wstring& name, float value);\r
-//\r
-//             void set_guide(const std::wstring& name, float value);\r
-//             void set_color(const std::wstring& name, color c);\r
-//\r
-//             color get_color() const;\r
-//             std::map<std::wstring, line>& get_lines();\r
-//\r
-//             std::wstring print() const;\r
-//\r
-//             safe_ptr<graph> clone() const;\r
-//     private:\r
-//             struct implementation;\r
-//             std::shared_ptr<implementation> impl_;\r
-//     };\r
-//     \r
-//     static safe_ptr<graph> create_graph(const std::wstring& name);\r
-//     static safe_ptr<graph> create_graph(const printer& parent_printer);\r
-//     static std::vector<safe_ptr<graph>> get_all_graphs();\r
-//}\r
-\r
 }}
\ No newline at end of file
index 4133b0d6e5140a61629c472c57b5caa4a2d2dd16..326e3ce70a2593f2e5c8fde628a787b0df4a8d7f 100644 (file)
@@ -68,7 +68,7 @@ public:
                , format_desc_(format_desc)\r
                , executor_(L"output")\r
        {\r
-               graph_->set_color("consume-time", diagnostics::color(1.0f, 0.4f, 0.0f));\r
+               graph_->set_color("consume-time", diagnostics::color(1.0f, 0.4f, 0.0f, 0.8));\r
        }       \r
        \r
        void add(int index, safe_ptr<frame_consumer> consumer)\r
@@ -227,7 +227,7 @@ public:
                                        }\r
                                }\r
                                                \r
-                               graph_->update_value("consume-time", consume_timer_.elapsed()*format_desc_.fps*0.5);\r
+                               graph_->set_value("consume-time", consume_timer_.elapsed()*format_desc_.fps*0.5);\r
                        }\r
                        catch(...)\r
                        {\r
index 714e0001e8be8426a4c77cdfb3bddbb195d8c85f..6e35f66b57ff1df0765329e5533076983b387930 100644 (file)
@@ -191,7 +191,7 @@ public:
 \r
                auto max = boost::range::max_element(result);\r
 \r
-               graph_->update_value("volume", static_cast<double>(std::abs(*max))/std::numeric_limits<int32_t>::max());\r
+               graph_->set_value("volume", static_cast<double>(std::abs(*max))/std::numeric_limits<int32_t>::max());\r
 \r
                return result;\r
        }\r
index 750c9bbb06759325303609a6fa8ab9fd900961e6..2dcabd6b8175d5ffb7de7808fd2d3f9f5808b189 100644 (file)
@@ -82,7 +82,7 @@ public:
                , audio_mixer_(graph_)\r
                , executor_(L"mixer")\r
        {                       \r
-               graph_->set_color("mix-time", diagnostics::color(1.0f, 0.0f, 0.9f));\r
+               graph_->set_color("mix-time", diagnostics::color(1.0f, 0.0f, 0.9f, 0.8));\r
        }\r
        \r
        void send(const std::pair<std::map<int, safe_ptr<core::basic_frame>>, std::shared_ptr<void>>& packet)\r
@@ -110,7 +110,7 @@ public:
                                auto audio = audio_mixer_(format_desc_);\r
                                image.wait();\r
 \r
-                               graph_->update_value("mix-time", mix_timer_.elapsed()*format_desc_.fps*0.5);\r
+                               graph_->set_value("mix-time", mix_timer_.elapsed()*format_desc_.fps*0.5);\r
 \r
                                target_->send(std::make_pair(make_safe<read_frame>(ogl_, format_desc_.size, std::move(image.get()), std::move(audio)), packet.second));                                 \r
                        }\r
index 2396e7be6b2368fa75ae80737531b428cdd3ae48..0520a331ebfec86fde980a89e3a479e8db9cfd44 100644 (file)
@@ -96,8 +96,7 @@ public:
                , target_(target)\r
                , executor_(L"stage")\r
        {\r
-               graph_->add_guide("tick-time", 0.5f);   \r
-               graph_->set_color("tick-time", diagnostics::color(0.0f, 0.6f, 0.9f));   \r
+               graph_->set_color("tick-time", diagnostics::color(0.0f, 0.6f, 0.9f, 0.8));      \r
                graph_->set_color("produce-time", diagnostics::color(0.0f, 1.0f, 0.0f));\r
        }\r
 \r
@@ -147,7 +146,7 @@ public:
                                frames[layer.first] = frame1;\r
                        });\r
                        \r
-                       graph_->update_value("produce-time", produce_timer_.elapsed()*format_desc_.fps*0.5);\r
+                       graph_->set_value("produce-time", produce_timer_.elapsed()*format_desc_.fps*0.5);\r
                        \r
                        std::shared_ptr<void> ticket(nullptr, [self](void*)\r
                        {\r
@@ -158,7 +157,7 @@ public:
 \r
                        target_->send(std::make_pair(frames, ticket));\r
 \r
-                       graph_->update_value("tick-time", tick_timer_.elapsed()*format_desc_.fps*0.5);\r
+                       graph_->set_value("tick-time", tick_timer_.elapsed()*format_desc_.fps*0.5);\r
                        tick_timer_.restart();\r
                }\r
                catch(...)\r
index 6beadf6beda9724ff6d6c05992e5874e6401f3f5..162a3d4128f49989fa79791f71c418dec5d41f9d 100644 (file)
@@ -86,9 +86,7 @@ public:
        {\r
                executor_.set_capacity(1);\r
 \r
-               graph_->add_guide("tick-time", 0.5);\r
                graph_->set_color("tick-time", diagnostics::color(0.0f, 0.6f, 0.9f));   \r
-               graph_->add_guide("frame-time", 0.5f);  \r
                graph_->set_color("sync-time", diagnostics::color(1.0f, 0.0f, 0.0f));\r
                graph_->set_color("frame-time", diagnostics::color(0.5f, 1.0f, 0.2f));\r
                graph_->set_text(print());\r
@@ -193,7 +191,7 @@ public:
                        try\r
                        {       \r
                                display_frame(frame);                           \r
-                               graph_->update_value("tick-time", static_cast<float>(tick_timer_.elapsed()*format_desc_.fps*0.5));\r
+                               graph_->set_value("tick-time", static_cast<float>(tick_timer_.elapsed()*format_desc_.fps*0.5));\r
                                tick_timer_.restart();\r
                        }\r
                        catch(...)\r
@@ -210,7 +208,7 @@ public:
                sync_timer_.restart();\r
                unsigned long n_field = 0;\r
                blue_->wait_output_video_synch(UPD_FMT_FRAME, n_field);\r
-               graph_->update_value("sync-time", sync_timer_.elapsed()*format_desc_.fps*0.5);\r
+               graph_->set_value("sync-time", sync_timer_.elapsed()*format_desc_.fps*0.5);\r
                \r
                frame_timer_.restart();         \r
 \r
@@ -260,7 +258,7 @@ public:
 \r
                boost::range::rotate(reserved_frames_, std::begin(reserved_frames_)+1);\r
                \r
-               graph_->update_value("frame-time", static_cast<float>(frame_timer_.elapsed()*format_desc_.fps*0.5));\r
+               graph_->set_value("frame-time", static_cast<float>(frame_timer_.elapsed()*format_desc_.fps*0.5));\r
        }\r
 \r
        void encode_hanc(BLUE_UINT32* hanc_data, void* audio_data, size_t audio_samples, size_t audio_nchannels)\r
index ad8573c9ad64dd4e3e42bc69d4e3019c8f47ad17..46c50cf43f3abe24e2404f8e3a403bd8b5440851 100644 (file)
@@ -190,7 +190,6 @@ public:
                video_frame_buffer_.set_capacity(1);\r
                audio_frame_buffer_.set_capacity(1);\r
 \r
-               graph_->add_guide("tick-time", 0.5);\r
                graph_->set_color("tick-time", diagnostics::color(0.0f, 0.6f, 0.9f));   \r
                graph_->set_color("late-frame", diagnostics::color(0.6f, 0.3f, 0.3f));\r
                graph_->set_color("dropped-frame", diagnostics::color(0.3f, 0.6f, 0.3f));\r
@@ -317,7 +316,7 @@ public:
                {\r
                        if(result == bmdOutputFrameDisplayedLate)\r
                        {\r
-                               graph_->add_tag("late-frame");\r
+                               graph_->set_tag("late-frame");\r
                                video_scheduled_ += format_desc_.duration;\r
                                audio_scheduled_ += reinterpret_cast<decklink_frame*>(completed_frame)->audio_data().size()/format_desc_.audio_channels;\r
                                //++video_scheduled_;\r
@@ -325,9 +324,9 @@ public:
                                //++audio_scheduled_;\r
                        }\r
                        else if(result == bmdOutputFrameDropped)\r
-                               graph_->add_tag("dropped-frame");\r
+                               graph_->set_tag("dropped-frame");\r
                        else if(result == bmdOutputFrameFlushed)\r
-                               graph_->add_tag("flushed-frame");\r
+                               graph_->set_tag("flushed-frame");\r
 \r
                        std::shared_ptr<core::read_frame> frame;        \r
                        video_frame_buffer_.pop(frame);                                 \r
@@ -335,7 +334,7 @@ public:
                        \r
                        unsigned long buffered;\r
                        output_->GetBufferedVideoFrameCount(&buffered);\r
-                       graph_->update_value("buffered-video", static_cast<double>(buffered)/format_desc_.fps);\r
+                       graph_->set_value("buffered-video", static_cast<double>(buffered)/format_desc_.fps);\r
                }\r
                catch(...)\r
                {\r
@@ -373,7 +372,7 @@ public:
 \r
                        unsigned long buffered;\r
                        output_->GetBufferedAudioSampleFrameCount(&buffered);\r
-                       graph_->update_value("buffered-audio", static_cast<double>(buffered)/(format_desc_.audio_cadence[0]*2));\r
+                       graph_->set_value("buffered-audio", static_cast<double>(buffered)/(format_desc_.audio_cadence[0]*2));\r
                }\r
                catch(...)\r
                {\r
@@ -406,7 +405,7 @@ public:
 \r
                video_scheduled_ += format_desc_.duration;\r
 \r
-               graph_->update_value("tick-time", tick_timer_.elapsed()*format_desc_.fps*0.5);\r
+               graph_->set_value("tick-time", tick_timer_.elapsed()*format_desc_.fps*0.5);\r
                tick_timer_.restart();\r
        }\r
 \r
index c20b3d0ad62b1e3d4aae8f37121f10379e23644c..e18930d3cdb1e22c225a72a8942921944f8ad0f5 100644 (file)
@@ -117,7 +117,6 @@ public:
                hints_ = 0;\r
                frame_buffer_.set_capacity(2);\r
                \r
-               graph_->add_guide("tick-time", 0.5);\r
                graph_->set_color("tick-time", diagnostics::color(0.0f, 0.6f, 0.9f));   \r
                graph_->set_color("late-frame", diagnostics::color(0.6f, 0.3f, 0.3f));\r
                graph_->set_color("frame-time", diagnostics::color(1.0f, 0.0f, 0.0f));\r
@@ -177,7 +176,7 @@ public:
 \r
                try\r
                {\r
-                       graph_->update_value("tick-time", tick_timer_.elapsed()*format_desc_.fps*0.5);\r
+                       graph_->set_value("tick-time", tick_timer_.elapsed()*format_desc_.fps*0.5);\r
                        tick_timer_.restart();\r
 \r
                        frame_timer_.restart();\r
@@ -231,10 +230,10 @@ public:
                        for(auto frame = muxer_.poll(); frame; frame = muxer_.poll())\r
                        {\r
                                if(!frame_buffer_.try_push(make_safe_ptr(frame)))\r
-                                       graph_->add_tag("dropped-frame");\r
+                                       graph_->set_tag("dropped-frame");\r
                        }\r
 \r
-                       graph_->update_value("frame-time", frame_timer_.elapsed()*format_desc_.fps*0.5);\r
+                       graph_->set_value("frame-time", frame_timer_.elapsed()*format_desc_.fps*0.5);\r
 \r
                        graph_->set_value("output-buffer", static_cast<float>(frame_buffer_.size())/static_cast<float>(frame_buffer_.capacity()));      \r
                }\r
@@ -256,7 +255,7 @@ public:
 \r
                safe_ptr<core::basic_frame> frame = core::basic_frame::late();\r
                if(!frame_buffer_.try_pop(frame))\r
-                       graph_->add_tag("late-frame");\r
+                       graph_->set_tag("late-frame");\r
                graph_->set_value("output-buffer", static_cast<float>(frame_buffer_.size())/static_cast<float>(frame_buffer_.capacity()));      \r
                return frame;\r
        }\r
index b085fc43573df701e21ee0993172417004bb1d04..648283f4c64409b688e93c346fb772e9d4f75b34 100644 (file)
@@ -100,7 +100,6 @@ public:
                // TODO: Ask stakeholders about case where file already exists.\r
                boost::filesystem2::remove(boost::filesystem2::wpath(env::media_folder() + widen(filename))); // Delete the file if it exists\r
 \r
-               graph_->add_guide("frame-time", 0.5);\r
                graph_->set_color("frame-time", diagnostics::color(0.1f, 1.0f, 0.1f));\r
                graph_->set_color("write-time", diagnostics::color(0.5f, 0.5f, 0.1f));\r
                graph_->set_text(print());\r
@@ -370,7 +369,7 @@ public:
                        auto video = encode_video_frame(frame);\r
                        auto audio = encode_audio_frame(frame);\r
 \r
-                       graph_->update_value("frame-time", frame_timer_.elapsed()*format_desc_.fps*0.5);\r
+                       graph_->set_value("frame-time", frame_timer_.elapsed()*format_desc_.fps*0.5);\r
                        \r
                        file_write_executor_.begin_invoke([=]\r
                        {\r
@@ -381,7 +380,7 @@ public:
                                if(audio)\r
                                        av_write_frame(oc_.get(), audio.get());\r
 \r
-                               graph_->update_value("write-time", write_timer_.elapsed()*format_desc_.fps*0.5);\r
+                               graph_->set_value("write-time", write_timer_.elapsed()*format_desc_.fps*0.5);\r
                        });\r
                });\r
        }\r
index c555fe2534232ba0e01c7f6a87fee782dc383f89..df676718ceb19dfe15856828056897d5052e07a5 100644 (file)
@@ -97,7 +97,6 @@ public:
                , last_frame_(core::basic_frame::empty())\r
                , frame_number_(0)\r
        {\r
-               graph_->add_guide("frame-time", 0.5);\r
                graph_->set_color("frame-time", diagnostics::color(0.1f, 1.0f, 0.1f));\r
                graph_->set_color("underflow", diagnostics::color(0.6f, 0.3f, 0.9f));   \r
                diagnostics::register_graph(graph_);\r
@@ -145,14 +144,14 @@ public:
                for(int n = 0; n < 16 && frame_buffer_.size() < 2; ++n)\r
                        try_decode_frame(hints);\r
                \r
-               graph_->update_value("frame-time", frame_timer_.elapsed()*format_desc_.fps*0.5);\r
+               graph_->set_value("frame-time", frame_timer_.elapsed()*format_desc_.fps*0.5);\r
                                \r
                if(frame_buffer_.empty() && input_.eof())\r
                        return last_frame();\r
 \r
                if(frame_buffer_.empty())\r
                {\r
-                       graph_->add_tag("underflow");   \r
+                       graph_->set_tag("underflow");   \r
                        return core::basic_frame::late();                       \r
                }\r
                \r
index 58916005ad80f4a4c29e7c501fed783e82c3c1e5..1c1383471b66b2daf5409c727a1412d70a673115 100644 (file)
@@ -129,8 +129,8 @@ struct input::implementation : boost::noncopyable
                        buffer_cond_.notify_all();\r
                }\r
 \r
-               graph_->update_value("buffer-size", (static_cast<double>(buffer_size_)+0.001)/MAX_BUFFER_SIZE);\r
-               graph_->update_value("buffer-count", (static_cast<double>(buffer_.size()+0.001)/MAX_BUFFER_COUNT));\r
+               graph_->set_value("buffer-size", (static_cast<double>(buffer_size_)+0.001)/MAX_BUFFER_SIZE);\r
+               graph_->set_value("buffer-count", (static_cast<double>(buffer_.size()+0.001)/MAX_BUFFER_COUNT));\r
 \r
                return result;\r
        }\r
@@ -177,7 +177,7 @@ struct input::implementation : boost::noncopyable
                        if(loop_)\r
                        {\r
                                do_seek(start_);\r
-                               graph_->add_tag("seek");                \r
+                               graph_->set_tag("seek");                \r
                                CASPAR_LOG(trace) << print() << " Looping.";                    \r
                        }                                       \r
                }\r
@@ -203,8 +203,8 @@ struct input::implementation : boost::noncopyable
                        buffer_.try_push(packet);\r
                        buffer_size_ += packet->size;\r
                                \r
-                       graph_->update_value("buffer-size", (static_cast<double>(buffer_size_)+0.001)/MAX_BUFFER_SIZE);\r
-                       graph_->update_value("buffer-count", (static_cast<double>(buffer_.size()+0.001)/MAX_BUFFER_COUNT));\r
+                       graph_->set_value("buffer-size", (static_cast<double>(buffer_size_)+0.001)/MAX_BUFFER_SIZE);\r
+                       graph_->set_value("buffer-count", (static_cast<double>(buffer_.size()+0.001)/MAX_BUFFER_COUNT));\r
                }                       \r
        }\r
 \r
index c8e6ea7584732a831040c3dcb8765119908b86d0..e7b37d1b03c1abed594f3de42a4559a648803214 100644 (file)
@@ -171,9 +171,7 @@ public:
                , width_(width)\r
                , height_(height)\r
        {               \r
-               graph_->add_guide("frame-time", 0.5f);\r
                graph_->set_color("frame-time", diagnostics::color(0.1f, 1.0f, 0.1f));\r
-               graph_->add_guide("tick-time", 0.5);\r
                graph_->set_color("tick-time", diagnostics::color(0.0f, 0.6f, 0.9f));\r
                graph_->set_color("param", diagnostics::color(1.0f, 0.5f, 0.0f));       \r
                graph_->set_color("skip-sync", diagnostics::color(0.8f, 0.3f, 0.2f));                   \r
@@ -220,7 +218,7 @@ public:
 \r
                if(!ax_->FlashCall(param, result))\r
                        CASPAR_LOG(warning) << print() << L" Flash call failed:" << param;//BOOST_THROW_EXCEPTION(invalid_operation() << msg_info("Flash function call failed.") << arg_name_info("param") << arg_value_info(narrow(param)));\r
-               graph_->add_tag("param");\r
+               graph_->set_tag("param");\r
 \r
                return result;\r
        }\r
@@ -229,7 +227,7 @@ public:
        {\r
                float frame_time = 1.0f/ax_->GetFPS();\r
 \r
-               graph_->update_value("tick-time", static_cast<float>(tick_timer_.elapsed()/frame_time)*0.5f);\r
+               graph_->set_value("tick-time", static_cast<float>(tick_timer_.elapsed()/frame_time)*0.5f);\r
                tick_timer_.restart();\r
 \r
                if(ax_->IsEmpty())\r
@@ -238,7 +236,7 @@ public:
                if(!has_underflow)                      \r
                        timer_.tick(frame_time); // This will block the thread.\r
                else\r
-                       graph_->add_tag("skip-sync");\r
+                       graph_->set_tag("skip-sync");\r
                        \r
                frame_timer_.restart();\r
 \r
@@ -258,7 +256,7 @@ public:
                        head_ = frame;\r
                }               \r
                                \r
-               graph_->update_value("frame-time", static_cast<float>(frame_timer_.elapsed()/frame_time)*0.5f);\r
+               graph_->set_value("frame-time", static_cast<float>(frame_timer_.elapsed()/frame_time)*0.5f);\r
                return head_;\r
        }\r
 \r
@@ -331,7 +329,7 @@ public:
 \r
                auto frame = core::basic_frame::late();\r
                if(!frame_buffer_.try_pop(frame) && context_)\r
-                       graph_->add_tag("underflow");\r
+                       graph_->set_tag("underflow");\r
 \r
                return frame;\r
        }\r
@@ -434,7 +432,7 @@ public:
 \r
                                graph_->set_value("output-buffer-count", static_cast<float>(frame_buffer_.size())/static_cast<float>(frame_buffer_.capacity()));        \r
                                fps_.fetch_and_store(static_cast<int>(context_->fps()*100.0));                          \r
-                               graph_->set_text(narrow(print()));\r
+                               graph_->set_text(print());\r
 \r
                                render(renderer);\r
                        }\r
index 17e900e90ae6bb888224962371b131ad49d0ff32..39093a731d62742b87e7ded69909eeee1df6d529 100644 (file)
@@ -62,7 +62,6 @@ public:
                : container_(16)\r
                , channel_index_(-1)\r
        {\r
-               graph_->add_guide("tick-time", 0.5);\r
                graph_->set_color("tick-time", diagnostics::color(0.0f, 0.6f, 0.9f));   \r
                diagnostics::register_graph(graph_);\r
 \r
@@ -132,7 +131,7 @@ public:
                data.Samples = container_.back().data();\r
                data.NbSamples = container_.back().size();      \r
                \r
-               graph_->update_value("tick-time", perf_timer_.elapsed()*format_desc_.fps*0.5);          \r
+               graph_->set_value("tick-time", perf_timer_.elapsed()*format_desc_.fps*0.5);             \r
                perf_timer_.restart();\r
 \r
                return is_running_;\r
index 19224546f46636d9912e1be4b5b028c29ff39c31..ce80c2a6a63b7a28980930ff7ebbb936e96c4ba5 100644 (file)
@@ -143,7 +143,6 @@ public:
        {               \r
                frame_buffer_.set_capacity(2);\r
                \r
-               graph_->add_guide("tick-time", 0.5);\r
                graph_->set_color("tick-time", diagnostics::color(0.0f, 0.6f, 0.9f));   \r
                graph_->set_color("frame-time", diagnostics::color(0.1f, 1.0f, 0.1f));\r
                graph_->set_color("dropped-frame", diagnostics::color(0.3f, 0.6f, 0.3f));\r
@@ -253,11 +252,11 @@ public:
                                        \r
                                        perf_timer_.restart();\r
                                        render(frame);\r
-                                       graph_->update_value("frame-time", perf_timer_.elapsed()*format_desc_.fps*0.5); \r
+                                       graph_->set_value("frame-time", perf_timer_.elapsed()*format_desc_.fps*0.5);    \r
 \r
                                        window_.Display();\r
                                        \r
-                                       graph_->update_value("tick-time", tick_timer_.elapsed()*format_desc_.fps*0.5);  \r
+                                       graph_->set_value("tick-time", tick_timer_.elapsed()*format_desc_.fps*0.5);     \r
                                        tick_timer_.restart();\r
                                }\r
                                catch(...)\r
@@ -360,7 +359,7 @@ public:
        bool send(const safe_ptr<core::read_frame>& frame)\r
        {\r
                if(!frame_buffer_.try_push(frame))\r
-                       graph_->add_tag("dropped-frame");\r
+                       graph_->set_tag("dropped-frame");\r
                return is_running_;\r
        }\r
                \r