Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / content / common / gpu / media / rendering_helper.h
index 6b0013f..26e8fb2 100644 (file)
@@ -10,6 +10,7 @@
 #include <vector>
 
 #include "base/basictypes.h"
+#include "base/cancelable_callback.h"
 #include "base/time/time.h"
 #include "base/timer/timer.h"
 #include "ui/gfx/geometry/rect.h"
@@ -100,8 +101,9 @@ class RenderingHelper {
   void QueueVideoFrame(size_t window_id,
                        scoped_refptr<VideoFrameTexture> video_frame);
 
-  // Drops all the pending video frames of the specified window.
-  void DropPendingFrames(size_t window_id);
+  // Flushes the pending frames. Notify the rendering_helper there won't be
+  // more video frames.
+  void Flush(size_t window_id);
 
   // Delete |texture_id|.
   void DeleteTexture(uint32 texture_id);
@@ -130,6 +132,12 @@ class RenderingHelper {
     // timer-driven playback.
     bool last_frame_rendered;
 
+    // True if there won't be any new video frames comming.
+    bool is_flushing;
+
+    // The number of frames need to be dropped to catch up the rendering.
+    int frames_to_drop;
+
     // The video frames pending for rendering.
     std::queue<scoped_refptr<VideoFrameTexture> > pending_frames;
 
@@ -147,8 +155,6 @@ class RenderingHelper {
   // |texture_target|.
   void RenderTexture(uint32 texture_target, uint32 texture_id);
 
-  // Timer to trigger the RenderContent() repeatly.
-  scoped_ptr<base::RepeatingTimer<RenderingHelper> > render_timer_;
   base::MessageLoop* message_loop_;
 
   scoped_refptr<gfx::GLContext> gl_context_;
@@ -168,6 +174,8 @@ class RenderingHelper {
   gfx::Size thumbnail_size_;
   GLuint program_;
   base::TimeDelta frame_duration_;
+  base::TimeTicks scheduled_render_time_;
+  base::CancelableClosure render_task_;
 
   DISALLOW_COPY_AND_ASSIGN(RenderingHelper);
 };