]> git.sesse.net Git - casparcg/commitdiff
2.1.0: -ffmpeg_producer: Fixed last_frame() flickering.
authorronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Mon, 19 Mar 2012 19:07:00 +0000 (19:07 +0000)
committerronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Mon, 19 Mar 2012 19:07:00 +0000 (19:07 +0000)
git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/branches/2.1.0@2687 362d55ac-95cf-4e76-9f9a-cbaa9c17b72d

modules/ffmpeg/producer/ffmpeg_producer.cpp

index 9e5dfd0a7c8f2269ba013f55de2ba981098176da..f18bc5008510bc5fa0361a6423e1cb00df65f693 100644 (file)
@@ -163,24 +163,16 @@ public:
                {\r
                        frame = std::move(muxer_.front());\r
                        muxer_.pop();\r
+                       ++frame_number_;                \r
                }\r
-               else\r
-               {\r
-                       if(!input_.eof())               \r
-                               graph_->set_tag("underflow");   \r
-               }\r
-                                                       \r
+               else if(!input_.eof())                                  \r
+                       graph_->set_tag("underflow");   \r
+                                                                       \r
                graph_->set_value("frame-time", frame_timer.elapsed()*format_desc_.fps*0.5);\r
                event_subject_  << monitor::event("profiler/time") % frame_timer.elapsed() % (1.0/format_desc_.fps);                    \r
                                                                \r
                graph_->set_text(print());\r
 \r
-               if(frame != core::draw_frame::late())           \r
-               {\r
-                       last_frame_ = frame;\r
-                       ++frame_number_;                \r
-               }\r
-\r
                event_subject_  << monitor::event("file/time")                  % monitor::duration(file_frame_number()/fps_) \r
                                                                                                                                % monitor::duration(file_nb_frames()/fps_)\r
                                                << monitor::event("file/frame")                 % static_cast<int32_t>(file_frame_number())\r
@@ -189,10 +181,10 @@ public:
                                                << monitor::event("file/path")                  % filename_\r
                                                << monitor::event("loop")                               % input_.loop();\r
                \r
-               if(frame == core::draw_frame::late() && input_.eof())\r
-                       return last_frame();\r
+               if(frame == core::draw_frame::late())\r
+                       return input_.eof() ? last_frame() : core::draw_frame::late();\r
                                \r
-               return frame;\r
+               return last_frame_ = frame;\r
        }\r
 \r
        core::draw_frame last_frame() const override\r