]> git.sesse.net Git - casparcg/commitdiff
3601360: Ensure that the ffmpeg consumer cannot block the channel output thread if...
authorhellgore <hellgore@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Fri, 18 Jan 2013 10:14:02 +0000 (10:14 +0000)
committerhellgore <hellgore@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Fri, 18 Jan 2013 10:14:02 +0000 (10:14 +0000)
git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/trunk@3689 362d55ac-95cf-4e76-9f9a-cbaa9c17b72d

modules/ffmpeg/consumer/ffmpeg_consumer.cpp

index 2ddaa3bbfe8484c2ab6de7662c23265ea72bf903..0f4e24078d0369cc6d579c427486405b56e3669a 100644 (file)
@@ -258,6 +258,7 @@ public:
                boost::filesystem2::remove(boost::filesystem2::wpath(env::media_folder() + widen(filename))); // Delete the file if it exists\r
 \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
                graph_->set_text(print());\r
                diagnostics::register_graph(graph_);\r
 \r
@@ -583,7 +584,7 @@ public:
                 \r
        void send(const safe_ptr<core::read_frame>& frame)\r
        {\r
-               encode_executor_.begin_invoke([=]\r
+               bool queued = encode_executor_.try_begin_invoke([=]\r
                {               \r
                        boost::timer frame_timer;\r
 \r
@@ -592,6 +593,12 @@ public:
 \r
                        graph_->set_value("frame-time", frame_timer.elapsed()*format_desc_.fps*0.5);                    \r
                });\r
+\r
+               if (!queued)\r
+                       graph_->set_tag("dropped-frame");\r
+\r
+               // TODO: adjust PTS accordingly to make dropped frames contribute\r
+               //       to the total playing time\r
        }\r
 };\r
 \r