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

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

Issue 1785153004: Made full screen video with DevTools not flash black on Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: switched to 2d textures 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_deferred_rendering_backing_strategy.cc
diff --git a/content/common/gpu/media/android_deferred_rendering_backing_strategy.cc b/content/common/gpu/media/android_deferred_rendering_backing_strategy.cc
index e3d59d7386ba6309c18ebbdecab2faa4c2608fd1..79c9c5480e6d82fcea3db3e3491fad57f1317199 100644
--- a/content/common/gpu/media/android_deferred_rendering_backing_strategy.cc
+++ b/content/common/gpu/media/android_deferred_rendering_backing_strategy.cc
@@ -100,7 +100,12 @@ AndroidDeferredRenderingBackingStrategy::GetSurfaceTexture() const {
}
uint32_t AndroidDeferredRenderingBackingStrategy::GetTextureTarget() const {
- return GL_TEXTURE_EXTERNAL_OES;
+ // If we're using a surface texture, then we need an external texture target
+ // to sample from it. If not, then we'll use 2D transparent textures to draw
+ // a transparent hole through which to see the SurfaceView. This is normally
+ // needed only for the devtools inspector, since the overlay mechanism handles
+ // it otherwise.
+ return (surface_texture_ ? GL_TEXTURE_EXTERNAL_OES : GL_TEXTURE_2D);
DaleCurtis 2016/03/28 18:02:02 No unnecessary parens.
liberato (no reviews please) 2016/03/28 20:58:17 Done.
}
AVDACodecImage* AndroidDeferredRenderingBackingStrategy::GetImageForPicture(
@@ -178,13 +183,28 @@ void AndroidDeferredRenderingBackingStrategy::UseCodecBufferForPictureBuffer(
}
void AndroidDeferredRenderingBackingStrategy::AssignOnePictureBuffer(
- const media::PictureBuffer& picture_buffer) {
+ const media::PictureBuffer& picture_buffer,
+ bool have_context) {
// Attach a GLImage to each texture that will use the surface texture.
// We use a refptr here in case SetImageForPicture fails.
scoped_refptr<gpu::gles2::GLStreamTextureImage> gl_image =
new AVDACodecImage(shared_state_, media_codec_,
state_provider_->GetGlDecoder(), surface_texture_);
SetImageForPicture(picture_buffer, gl_image);
+
+ if (!surface_texture_ && have_context) {
+ // To make devtools work, we're using a 2D texture. Make it transparent,
+ // so that it draws a hole for the SV to show through. This is only
+ // because devtools draws and reads back, which skips overlay processing.
+ // It's unclear why devtools renders twice -- once normally, and once
+ // including a readback layer. The result is that the device screen
+ // flashes as we alternately draw the overlay hole and this texture,
+ // unless we make the texture transparent.
+ unsigned char rgba[] = {0, 0, 0, 0};
DaleCurtis 2016/03/28 18:02:02 static const, does uint8_t work?
liberato (no reviews please) 2016/03/28 20:58:17 Done.
+ const gfx::Size size(1, 1);
DaleCurtis 2016/03/28 18:02:02 I'd just inline each value, but up to you.
liberato (no reviews please) 2016/03/28 20:58:17 i think that it's clearer than glTexImage2D(..., 1
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, size.width(), size.height(), 0,
+ GL_RGBA, GL_UNSIGNED_BYTE, rgba);
+ }
}
void AndroidDeferredRenderingBackingStrategy::ReleaseCodecBufferForPicture(

Powered by Google App Engine
This is Rietveld 408576698