| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/common/gpu/media/android_deferred_rendering_backing_strategy.h
" | 5 #include "content/common/gpu/media/android_deferred_rendering_backing_strategy.h
" |
| 6 | 6 |
| 7 #include <EGL/egl.h> | 7 #include <EGL/egl.h> |
| 8 #include <EGL/eglext.h> | 8 #include <EGL/eglext.h> |
| 9 | 9 |
| 10 #include "base/android/build_info.h" | 10 #include "base/android/build_info.h" |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 if (!surface_texture_ && have_context) { | 206 if (!surface_texture_ && have_context) { |
| 207 // To make devtools work, we're using a 2D texture. Make it transparent, | 207 // To make devtools work, we're using a 2D texture. Make it transparent, |
| 208 // so that it draws a hole for the SV to show through. This is only | 208 // so that it draws a hole for the SV to show through. This is only |
| 209 // because devtools draws and reads back, which skips overlay processing. | 209 // because devtools draws and reads back, which skips overlay processing. |
| 210 // It's unclear why devtools renders twice -- once normally, and once | 210 // It's unclear why devtools renders twice -- once normally, and once |
| 211 // including a readback layer. The result is that the device screen | 211 // including a readback layer. The result is that the device screen |
| 212 // flashes as we alternately draw the overlay hole and this texture, | 212 // flashes as we alternately draw the overlay hole and this texture, |
| 213 // unless we make the texture transparent. | 213 // unless we make the texture transparent. |
| 214 static const uint8_t rgba[] = {0, 0, 0, 0}; | 214 static const uint8_t rgba[] = {0, 0, 0, 0}; |
| 215 const gfx::Size size(1, 1); | 215 const gfx::Size size(1, 1); |
| 216 glBindTexture(GL_TEXTURE_2D, picture_buffer.texture_id()); | 216 DCHECK_LE(1u, picture_buffer.texture_ids().size()); |
| 217 glBindTexture(GL_TEXTURE_2D, picture_buffer.texture_ids()[0]); |
| 217 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, size.width(), size.height(), 0, | 218 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, size.width(), size.height(), 0, |
| 218 GL_RGBA, GL_UNSIGNED_BYTE, rgba); | 219 GL_RGBA, GL_UNSIGNED_BYTE, rgba); |
| 219 } | 220 } |
| 220 } | 221 } |
| 221 | 222 |
| 222 void AndroidDeferredRenderingBackingStrategy::ReleaseCodecBufferForPicture( | 223 void AndroidDeferredRenderingBackingStrategy::ReleaseCodecBufferForPicture( |
| 223 const media::PictureBuffer& picture_buffer) { | 224 const media::PictureBuffer& picture_buffer) { |
| 224 AVDACodecImage* avda_image = GetImageForPicture(picture_buffer); | 225 AVDACodecImage* avda_image = GetImageForPicture(picture_buffer); |
| 225 | 226 |
| 226 // See if there is a media codec buffer still attached to this image. | 227 // See if there is a media codec buffer still attached to this image. |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 base::ToLowerASCII(base::android::BuildInfo::GetInstance()->model())); | 394 base::ToLowerASCII(base::android::BuildInfo::GetInstance()->model())); |
| 394 if (model.find("a114") != std::string::npos) | 395 if (model.find("a114") != std::string::npos) |
| 395 surface_texture_detach_works = false; | 396 surface_texture_detach_works = false; |
| 396 } | 397 } |
| 397 } | 398 } |
| 398 | 399 |
| 399 return surface_texture_detach_works; | 400 return surface_texture_detach_works; |
| 400 } | 401 } |
| 401 | 402 |
| 402 } // namespace content | 403 } // namespace content |
| OLD | NEW |