]> git.sesse.net Git - casparcg/commitdiff
[html] Ensure that the last frame of an animation is displayed as soon as possible...
authorHelge Norberg <helge.norberg@svt.se>
Mon, 1 Sep 2014 13:44:38 +0000 (15:44 +0200)
committerHelge Norberg <helge.norberg@svt.se>
Mon, 1 Sep 2014 13:44:38 +0000 (15:44 +0200)
modules/html/producer/html_producer.cpp

index 9689a25e208e49a7dc03e5332eec02ce52477c37..1f7321eab2ec10aa4f5bf0f7b6871ed2b1672e72 100644 (file)
@@ -350,10 +350,11 @@ namespace caspar {
                                timer.tick(0.0);
                                const auto& format_desc = frame_factory_->get_video_format_desc();
 
-                               bool has_frames = lock(frames_mutex_, [&]
+                               auto num_frames = lock(frames_mutex_, [&]
                                {
-                                       return frames_.size() >= format_desc.field_count;
+                                       return frames_.size();
                                });
+                               bool has_frames = num_frames >= format_desc.field_count;
 
                                if (has_frames)
                                {
@@ -383,6 +384,20 @@ namespace caspar {
                                                });
                                        }
                                }
+                               else if (num_frames == 1) // Interlaced but only on frame
+                               {                         // available. Probably the last frame
+                                                             // of end of some animation sequence
+                                       auto frame = pop();
+
+                                       lock(last_frame_mutex_, [&]
+                                       {
+                                               last_progressive_frame_ = frame;
+                                               last_frame_ = frame;
+                                       });
+
+                                       timer.tick(1.0 / (format_desc.fps * format_desc.field_count));
+                                       invoke_requested_animation_frames();
+                               }
                                else
                                {
                                        graph_->set_tag("late-frame");