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

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

Issue 1750213002: Fix Android black frames from MSE config changes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address the easy feedback, awaiting high level design sign off Created 4 years, 9 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/android_copying_backing_strategy.cc
diff --git a/content/common/gpu/media/android_copying_backing_strategy.cc b/content/common/gpu/media/android_copying_backing_strategy.cc
index cf166afc8fc512f13f28bf47f3deb0ee54c70253..599854dddb5f3157a59195442b08324767de7628 100644
--- a/content/common/gpu/media/android_copying_backing_strategy.cc
+++ b/content/common/gpu/media/android_copying_backing_strategy.cc
@@ -161,4 +161,33 @@ bool AndroidCopyingBackingStrategy::ArePicturesOverlayable() {
return false;
}
+void AndroidCopyingBackingStrategy::UpdatePictureBufferSize(
+ media::PictureBuffer* picture_buffer,
+ const gfx::Size& new_size) {
+ // This strategy uses 2D textures who's allocated memory is dependent on the
+ // size. To update size in all places, we must:
+ // 1) Update the PictureBuffer meta-data
+ picture_buffer->set_size(new_size);
+
+ // 2) Update the GL texture via glTextImage2D. This step assumes the caller
DaleCurtis 2016/03/08 18:29:03 glTexImage2D unless there's an ASCII art GL comman
chcunningham 2016/03/08 22:19:12 Done. :)
+ // has made our GL context current.
+ glBindTexture(GL_TEXTURE_2D, picture_buffer->texture_id());
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, new_size.width(), new_size.height(),
+ 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
+ state_provider_->GetGlDecoder()->RestoreActiveTextureUnitBinding(
+ GL_TEXTURE_2D);
+
+ // 3) Update the CHROMIUM Texture's size.
+ gpu::gles2::TextureRef* texture_ref =
+ state_provider_->GetTextureForPicture(*picture_buffer);
+ RETURN_IF_NULL(texture_ref);
DaleCurtis 2016/03/08 18:29:03 Should this function return an error if this occur
chcunningham 2016/03/08 22:19:12 I think its should be ok as-is. This macro This ma
+ gpu::gles2::TextureManager* texture_manager =
+ state_provider_->GetGlDecoder()->GetContextGroup()->texture_manager();
+ RETURN_IF_NULL(texture_manager);
DaleCurtis 2016/03/08 18:29:03 Ditto?
chcunningham 2016/03/08 22:19:12 Ditto
+ texture_manager->SetLevelInfo(texture_ref, GetTextureTarget(), 0, GL_RGBA,
+ new_size.width(), new_size.height(), 1, 0,
+ GL_RGBA, GL_UNSIGNED_BYTE,
+ gfx::Rect(new_size));
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698