Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3582)

Unified Diff: content/common/gpu/media/rendering_helper.cc

Issue 465293002: rendering_helper - Wait for rendering before resetting the decoder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add document to frames_at_render_. Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 ce2f94b16d405a18034c4b9e2fa4fe49276fad03..00e85f9f0ecd0c44b1961175d1fc5ce248670712 100644
--- a/content/common/gpu/media/rendering_helper.cc
+++ b/content/common/gpu/media/rendering_helper.cc
@@ -74,7 +74,8 @@ VideoFrameTexture::~VideoFrameTexture() {
base::ResetAndReturn(&no_longer_needed_cb_).Run();
}
-RenderingHelper::RenderedVideo::RenderedVideo() : last_frame_rendered(false) {
+RenderingHelper::RenderedVideo::RenderedVideo()
+ : last_frame_rendered(false), is_flushing(false) {
}
RenderingHelper::RenderedVideo::~RenderedVideo() {
@@ -395,6 +396,7 @@ void RenderingHelper::QueueVideoFrame(
scoped_refptr<VideoFrameTexture> video_frame) {
CHECK_EQ(base::MessageLoop::current(), message_loop_);
RenderedVideo* video = &videos_[window_id];
+ DCHECK(!video->is_flushing);
// Pop the last frame if it has been rendered.
if (video->last_frame_rendered) {
@@ -408,13 +410,6 @@ void RenderingHelper::QueueVideoFrame(
video->pending_frames.push(video_frame);
}
-void RenderingHelper::DropPendingFrames(size_t window_id) {
- CHECK_EQ(base::MessageLoop::current(), message_loop_);
- RenderedVideo* video = &videos_[window_id];
- video->pending_frames = std::queue<scoped_refptr<VideoFrameTexture> >();
- video->last_frame_rendered = false;
-}
-
void RenderingHelper::RenderTexture(uint32 texture_target, uint32 texture_id) {
// The ExternalOES sampler is bound to GL_TEXTURE1 and the Texture2D sampler
// is bound to GL_TEXTURE0.
@@ -503,6 +498,10 @@ void RenderingHelper::GetThumbnailsAsRGB(std::vector<unsigned char>* rgb,
done->Signal();
}
+void RenderingHelper::Flush(size_t window_id) {
+ videos_[window_id].is_flushing = true;
+}
+
void RenderingHelper::RenderContent() {
CHECK_EQ(base::MessageLoop::current(), message_loop_);
glUniform1i(glGetUniformLocation(program_, "tex_flip"), 1);
@@ -526,9 +525,10 @@ 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();
+ video->last_frame_rendered = false;
} else {
video->last_frame_rendered = true;
}
« no previous file with comments | « content/common/gpu/media/rendering_helper.h ('k') | content/common/gpu/media/video_decode_accelerator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698