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.
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,
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.
// 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!
// | | Pause() ^
// | V Play() |
// | [kPlaying]---------------------------|
- // | | Pause() ^
- // | V Receive EOF frame. | Pause()
- // | [kEnded]-----------------------------+
- // | ^
+ // | Pause() ^ Pause()
// | |
// +-----> [kStopped] [Any state other than]
// [kUninitialized/kError]
kFlushed,
kPrerolling,
kPlaying,
- kEnded,
kStopped,
kError,
};
// 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.