Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / media / filters / video_renderer_impl.h
index b45f847..8980447 100644 (file)
@@ -36,19 +36,12 @@ class MEDIA_EXPORT VideoRendererImpl
       public base::PlatformThread::Delegate {
  public:
   typedef base::Callback<void(const scoped_refptr<VideoFrame>&)> PaintCB;
-  typedef base::Callback<void(bool)> SetOpaqueCB;
-
-  // Maximum duration of the last frame.
-  static base::TimeDelta kMaxLastFrameDuration();
 
   // |decoders| contains the VideoDecoders to use when initializing.
   //
   // |paint_cb| is executed on the video frame timing thread whenever a new
   // frame is available for painting.
   //
-  // |set_opaque_cb| is executed when the renderer is initialized to inform
-  // the player whether the decoded output will be opaque or not.
-  //
   // Implementors should avoid doing any sort of heavy work in this method and
   // instead post a task to a common/worker thread to handle rendering.  Slowing
   // down the video thread may result in losing synchronization with audio.
@@ -59,12 +52,12 @@ class MEDIA_EXPORT VideoRendererImpl
       ScopedVector<VideoDecoder> decoders,
       const SetDecryptorReadyCB& set_decryptor_ready_cb,
       const PaintCB& paint_cb,
-      const SetOpaqueCB& set_opaque_cb,
       bool drop_frames);
   virtual ~VideoRendererImpl();
 
   // VideoRenderer implementation.
   virtual void Initialize(DemuxerStream* stream,
+                          bool low_delay,
                           const PipelineStatusCB& init_cb,
                           const StatisticsCB& statistics_cb,
                           const TimeCB& max_time_cb,
@@ -85,7 +78,7 @@ class MEDIA_EXPORT VideoRendererImpl
 
  private:
   // Callback for |video_frame_stream_| initialization.
-  void OnVideoFrameStreamInitialized(bool success, bool has_alpha);
+  void OnVideoFrameStreamInitialized(bool success);
 
   // Callback for |video_frame_stream_| to deliver decoded video frames and
   // report video decoding status.
@@ -144,12 +137,17 @@ class MEDIA_EXPORT VideoRendererImpl
   // Provides video frames to VideoRendererImpl.
   VideoFrameStream video_frame_stream_;
 
+  // Flag indicating low-delay mode.
+  bool low_delay_;
+
   // Queue of incoming frames yet to be painted.
   typedef std::deque<scoped_refptr<VideoFrame> > VideoFrameQueue;
   VideoFrameQueue ready_frames_;
 
-  // Keeps track of whether we received the end of stream buffer.
+  // Keeps track of whether we received the end of stream buffer and finished
+  // rendering.
   bool received_end_of_stream_;
+  bool rendered_end_of_stream_;
 
   // Used to signal |thread_| as frames are added to |frames_|.  Rule of thumb:
   // always check |state_| to see if it was set to STOPPED after waking up!
@@ -172,10 +170,7 @@ class MEDIA_EXPORT VideoRendererImpl
   //   |          |                Pause()          ^
   //   |          V Play()                          |
   //   |       [kPlaying]---------------------------|
-  //   |          |                Pause()          ^
-  //   |          V Receive EOF frame.              | Pause()
-  //   |       [kEnded]-----------------------------+
-  //   |                                            ^
+  //   |                           Pause()          ^ Pause()
   //   |                                            |
   //   +-----> [kStopped]                 [Any state other than]
   //                                      [kUninitialized/kError]
@@ -190,7 +185,6 @@ class MEDIA_EXPORT VideoRendererImpl
     kFlushed,
     kPrerolling,
     kPlaying,
-    kEnded,
     kStopped,
     kError,
   };
@@ -225,9 +219,6 @@ class MEDIA_EXPORT VideoRendererImpl
   // Embedder callback for notifying a new frame is available for painting.
   PaintCB paint_cb_;
 
-  // Callback to execute to inform the player if the decoded output is opaque.
-  SetOpaqueCB set_opaque_cb_;
-
   // The timestamp of the last frame removed from the |ready_frames_| queue,
   // either for calling |paint_cb_| or for dropping. Set to kNoTimestamp()
   // during flushing.