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 #ifndef CONTENT_COMMON_GPU_MEDIA_ANDROID_DEFERRED_RENDERING_BACKING_STRATEGY_H_ | 5 #ifndef CONTENT_COMMON_GPU_MEDIA_ANDROID_DEFERRED_RENDERING_BACKING_STRATEGY_H_ |
6 #define CONTENT_COMMON_GPU_MEDIA_ANDROID_DEFERRED_RENDERING_BACKING_STRATEGY_H_ | 6 #define CONTENT_COMMON_GPU_MEDIA_ANDROID_DEFERRED_RENDERING_BACKING_STRATEGY_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
12 #include "content/common/gpu/media/android_video_decode_accelerator.h" | 12 #include "content/common/gpu/media/android_video_decode_accelerator.h" |
13 #include "ui/gl/gl_bindings.h" | |
13 | 14 |
14 namespace gl { | 15 namespace gl { |
15 class GLImage; | 16 class GLImage; |
16 } | 17 } |
17 | 18 |
18 namespace gpu { | 19 namespace gpu { |
19 namespace gles2 { | 20 namespace gles2 { |
20 class GLStreamTextureImage; | 21 class GLStreamTextureImage; |
21 class TextureRef; | 22 class TextureRef; |
22 } | 23 } |
(...skipping 16 matching lines...) Expand all Loading... | |
39 ~AndroidDeferredRenderingBackingStrategy() override; | 40 ~AndroidDeferredRenderingBackingStrategy() override; |
40 | 41 |
41 // AndroidVideoDecodeAccelerator::BackingStrategy | 42 // AndroidVideoDecodeAccelerator::BackingStrategy |
42 gfx::ScopedJavaSurface Initialize(int surface_view_id) override; | 43 gfx::ScopedJavaSurface Initialize(int surface_view_id) override; |
43 void Cleanup(bool have_context, | 44 void Cleanup(bool have_context, |
44 const AndroidVideoDecodeAccelerator::OutputBufferMap&) override; | 45 const AndroidVideoDecodeAccelerator::OutputBufferMap&) override; |
45 scoped_refptr<gfx::SurfaceTexture> GetSurfaceTexture() const override; | 46 scoped_refptr<gfx::SurfaceTexture> GetSurfaceTexture() const override; |
46 uint32_t GetTextureTarget() const override; | 47 uint32_t GetTextureTarget() const override; |
47 void UseCodecBufferForPictureBuffer(int32_t codec_buffer_index, | 48 void UseCodecBufferForPictureBuffer(int32_t codec_buffer_index, |
48 const media::PictureBuffer&) override; | 49 const media::PictureBuffer&) override; |
49 void AssignOnePictureBuffer(const media::PictureBuffer&) override; | 50 void AssignOnePictureBuffer(const media::PictureBuffer&, bool) override; |
50 void ReuseOnePictureBuffer(const media::PictureBuffer&) override; | 51 void ReuseOnePictureBuffer(const media::PictureBuffer&) override; |
51 void DismissOnePictureBuffer(const media::PictureBuffer&) override; | 52 void DismissOnePictureBuffer(const media::PictureBuffer&) override; |
52 void CodecChanged( | 53 void CodecChanged( |
53 media::VideoCodecBridge*, | 54 media::VideoCodecBridge*, |
54 const AndroidVideoDecodeAccelerator::OutputBufferMap&) override; | 55 const AndroidVideoDecodeAccelerator::OutputBufferMap&) override; |
55 void OnFrameAvailable() override; | 56 void OnFrameAvailable() override; |
56 bool ArePicturesOverlayable() override; | 57 bool ArePicturesOverlayable() override; |
57 void UpdatePictureBufferSize(media::PictureBuffer* picture_buffer, | 58 void UpdatePictureBufferSize(media::PictureBuffer* picture_buffer, |
58 const gfx::Size& new_size) override; | 59 const gfx::Size& new_size) override; |
59 | 60 |
(...skipping 12 matching lines...) Expand all Loading... | |
72 // picture buffer textures with it. The picture buffer textures will not | 73 // picture buffer textures with it. The picture buffer textures will not |
73 // dependend on |this|, the SurfaceTexture, the MediaCodec or the VDA, so it's | 74 // dependend on |this|, the SurfaceTexture, the MediaCodec or the VDA, so it's |
74 // used to back the picture buffers when the VDA is being destroyed. | 75 // used to back the picture buffers when the VDA is being destroyed. |
75 void CopySurfaceTextureToPictures( | 76 void CopySurfaceTextureToPictures( |
76 const AndroidVideoDecodeAccelerator::OutputBufferMap& buffers); | 77 const AndroidVideoDecodeAccelerator::OutputBufferMap& buffers); |
77 | 78 |
78 // Return true if and only if the surface_texture_cant_detach workaround is | 79 // Return true if and only if the surface_texture_cant_detach workaround is |
79 // not set. | 80 // not set. |
80 bool DoesSurfaceTextureDetachWork() const; | 81 bool DoesSurfaceTextureDetachWork() const; |
81 | 82 |
83 // Create an EGLImage by creating a 2D texture, calling |init_texture| while | |
84 // it's bound, and then creating the EGLImage from that. The caller takes | |
85 // ownership of the resulting EGLImage. | |
86 EGLImageKHR CreateImageFromTexture(bool ( | |
DaleCurtis
2016/03/11 19:23:36
Use callback instead?
liberato (no reviews please)
2016/03/11 19:53:57
since the strategy isn't refcounted, didn't seem t
| |
87 AndroidDeferredRenderingBackingStrategy::*init_texture)(GLint source_id)); | |
88 | |
89 // Init |source_id| to be a copy of the current |surface_texture_| buffer. | |
90 // |source_id| is the service id of the 2D texture. | |
91 bool InitTextureWithCopy(GLint source_id); | |
92 | |
93 // Init |source_id| to be a 1x1 transparent texture. | |
94 bool InitTransparentTexture(GLint source_id); | |
95 | |
82 scoped_refptr<AVDASharedState> shared_state_; | 96 scoped_refptr<AVDASharedState> shared_state_; |
83 | 97 |
84 AVDAStateProvider* state_provider_; | 98 AVDAStateProvider* state_provider_; |
85 | 99 |
100 // EGLImage for a 1x1 transparent texture, or EGL_NO_IMAGE_KHR. | |
101 EGLImageKHR transparent_image_; | |
102 | |
86 // The SurfaceTexture to render to. Non-null after Initialize() if | 103 // The SurfaceTexture to render to. Non-null after Initialize() if |
87 // we're not rendering to a SurfaceView. | 104 // we're not rendering to a SurfaceView. |
88 scoped_refptr<gfx::SurfaceTexture> surface_texture_; | 105 scoped_refptr<gfx::SurfaceTexture> surface_texture_; |
89 | 106 |
90 media::VideoCodecBridge* media_codec_; | 107 media::VideoCodecBridge* media_codec_; |
91 | 108 |
92 DISALLOW_COPY_AND_ASSIGN(AndroidDeferredRenderingBackingStrategy); | 109 DISALLOW_COPY_AND_ASSIGN(AndroidDeferredRenderingBackingStrategy); |
93 }; | 110 }; |
94 | 111 |
95 } // namespace content | 112 } // namespace content |
96 | 113 |
97 #endif // CONTENT_COMMON_GPU_MEDIA_ANDROID_DEFERRED_RENDERING_BACKING_STRATEGY_ H_ | 114 #endif // CONTENT_COMMON_GPU_MEDIA_ANDROID_DEFERRED_RENDERING_BACKING_STRATEGY_ H_ |
OLD | NEW |