| Index: content/common/gpu/media/rendering_helper.cc
|
| diff --git a/content/common/gpu/media/rendering_helper.cc b/content/common/gpu/media/rendering_helper.cc
|
| index ebb58f5f3e126112e4020ba6978a0b643a02253d..d81c0d3a0c69a0ec9b4d267db07f32b9f9371ba5 100644
|
| --- a/content/common/gpu/media/rendering_helper.cc
|
| +++ b/content/common/gpu/media/rendering_helper.cc
|
| @@ -388,6 +388,7 @@ void RenderingHelper::RenderThumbnail(uint32 texture_target,
|
| void RenderingHelper::QueueVideoFrame(size_t window_id,
|
| scoped_refptr<VideoFrame> video_frame) {
|
| RenderedVideo* video = &videos_[window_id];
|
| + DCHECK(!video->is_flushing);
|
|
|
| // Pop the front if it has been rendered.
|
| if (video->last_frame_rendered) {
|
| @@ -492,6 +493,18 @@ void RenderingHelper::GetThumbnailsAsRGB(std::vector<unsigned char>* rgb,
|
| done->Signal();
|
| }
|
|
|
| +void RenderingHelper::Flush(size_t window_id,
|
| + const base::Closure& flush_done_cb) {
|
| + RenderedVideo* video = &videos_[window_id];
|
| + if (video->pending_frames.empty()) {
|
| + // The rendering has been completed.
|
| + flush_done_cb.Run();
|
| + return;
|
| + }
|
| + video->is_flushing = true;
|
| + video->flush_done_cb = flush_done_cb;
|
| +}
|
| +
|
| void RenderingHelper::RenderContent() {
|
| CHECK_EQ(base::MessageLoop::current(), message_loop_);
|
| glUniform1i(glGetUniformLocation(program_, "tex_flip"), 1);
|
| @@ -513,12 +526,16 @@ void RenderingHelper::RenderContent() {
|
| GLSetViewPort(video->render_area);
|
| RenderTexture(frame->texture_target(), frame->texture_id());
|
|
|
| - if (video->pending_frames.size() > 1) {
|
| + if (video->pending_frames.size() > 1 || video->is_flushing) {
|
| frames_to_be_returned.push_back(video->pending_frames.front());
|
| video->pending_frames.pop_front();
|
| } else {
|
| video->last_frame_rendered = true;
|
| }
|
| +
|
| + if (video->is_flushing && video->pending_frames.empty() &&
|
| + !video->flush_done_cb.is_null())
|
| + base::ResetAndReturn(&video->flush_done_cb).Run();
|
| }
|
| }
|
|
|
|
|