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 MEDIA_GPU_ANDROID_DEFERRED_RENDERING_BACKING_STRATEGY_H_ | 5 #ifndef MEDIA_GPU_ANDROID_DEFERRED_RENDERING_BACKING_STRATEGY_H_ |
6 #define MEDIA_GPU_ANDROID_DEFERRED_RENDERING_BACKING_STRATEGY_H_ | 6 #define MEDIA_GPU_ANDROID_DEFERRED_RENDERING_BACKING_STRATEGY_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 // AndroidVideoDecodeAccelerator::BackingStrategy | 42 // AndroidVideoDecodeAccelerator::BackingStrategy |
43 gl::ScopedJavaSurface Initialize(int surface_view_id) override; | 43 gl::ScopedJavaSurface Initialize(int surface_view_id) override; |
44 void Cleanup( | 44 void Cleanup( |
45 bool have_context, | 45 bool have_context, |
46 const AndroidVideoDecodeAccelerator::OutputBufferMap& buffers) override; | 46 const AndroidVideoDecodeAccelerator::OutputBufferMap& buffers) override; |
47 scoped_refptr<gl::SurfaceTexture> GetSurfaceTexture() const override; | 47 scoped_refptr<gl::SurfaceTexture> GetSurfaceTexture() const override; |
48 uint32_t GetTextureTarget() const override; | 48 uint32_t GetTextureTarget() const override; |
49 gfx::Size GetPictureBufferSize() const override; | 49 gfx::Size GetPictureBufferSize() const override; |
50 void UseCodecBufferForPictureBuffer( | 50 void UseCodecBufferForPictureBuffer( |
51 int32_t codec_buffer_index, | 51 int32_t codec_buffer_index, |
52 const media::PictureBuffer& picture_buffer) override; | 52 const PictureBuffer& picture_buffer) override; |
53 void AssignOnePictureBuffer(const media::PictureBuffer&, bool) override; | 53 void AssignOnePictureBuffer(const PictureBuffer&, bool) override; |
54 void ReuseOnePictureBuffer( | 54 void ReuseOnePictureBuffer(const PictureBuffer& picture_buffer) override; |
55 const media::PictureBuffer& picture_buffer) override; | |
56 void MaybeRenderEarly() override; | 55 void MaybeRenderEarly() override; |
57 void CodecChanged(media::VideoCodecBridge* codec) override; | 56 void CodecChanged(VideoCodecBridge* codec) override; |
58 void ReleaseCodecBuffers( | 57 void ReleaseCodecBuffers( |
59 const AndroidVideoDecodeAccelerator::OutputBufferMap& buffers) override; | 58 const AndroidVideoDecodeAccelerator::OutputBufferMap& buffers) override; |
60 void OnFrameAvailable() override; | 59 void OnFrameAvailable() override; |
61 bool ArePicturesOverlayable() override; | 60 bool ArePicturesOverlayable() override; |
62 void UpdatePictureBufferSize(media::PictureBuffer* picture_buffer, | 61 void UpdatePictureBufferSize(PictureBuffer* picture_buffer, |
63 const gfx::Size& new_size) override; | 62 const gfx::Size& new_size) override; |
64 | 63 |
65 private: | 64 private: |
66 // Release any codec buffer that is associated with the given picture buffer | 65 // Release any codec buffer that is associated with the given picture buffer |
67 // back to the codec. It is okay if there is no such buffer. | 66 // back to the codec. It is okay if there is no such buffer. |
68 void ReleaseCodecBufferForPicture(const media::PictureBuffer& picture_buffer); | 67 void ReleaseCodecBufferForPicture(const PictureBuffer& picture_buffer); |
69 | 68 |
70 // Sets up the texture references (as found by |picture_buffer|), for the | 69 // Sets up the texture references (as found by |picture_buffer|), for the |
71 // specified |image|. If |image| is null, clears any ref on the texture | 70 // specified |image|. If |image| is null, clears any ref on the texture |
72 // associated with |picture_buffer|. | 71 // associated with |picture_buffer|. |
73 void SetImageForPicture( | 72 void SetImageForPicture( |
74 const media::PictureBuffer& picture_buffer, | 73 const PictureBuffer& picture_buffer, |
75 const scoped_refptr<gpu::gles2::GLStreamTextureImage>& image); | 74 const scoped_refptr<gpu::gles2::GLStreamTextureImage>& image); |
76 | 75 |
77 // Make a copy of the SurfaceTexture's front buffer and associate all given | 76 // Make a copy of the SurfaceTexture's front buffer and associate all given |
78 // picture buffer textures with it. The picture buffer textures will not | 77 // picture buffer textures with it. The picture buffer textures will not |
79 // dependend on |this|, the SurfaceTexture, the MediaCodec or the VDA, so it's | 78 // dependend on |this|, the SurfaceTexture, the MediaCodec or the VDA, so it's |
80 // used to back the picture buffers when the VDA is being destroyed. | 79 // used to back the picture buffers when the VDA is being destroyed. |
81 void CopySurfaceTextureToPictures( | 80 void CopySurfaceTextureToPictures( |
82 const AndroidVideoDecodeAccelerator::OutputBufferMap& buffers); | 81 const AndroidVideoDecodeAccelerator::OutputBufferMap& buffers); |
83 | 82 |
84 // Return true if and only if CopySurfaceTextureToPictures is expected to work | 83 // Return true if and only if CopySurfaceTextureToPictures is expected to work |
85 // on this device. | 84 // on this device. |
86 bool ShouldCopyPictures() const; | 85 bool ShouldCopyPictures() const; |
87 | 86 |
88 scoped_refptr<AVDASharedState> shared_state_; | 87 scoped_refptr<AVDASharedState> shared_state_; |
89 | 88 |
90 AVDAStateProvider* state_provider_; | 89 AVDAStateProvider* state_provider_; |
91 | 90 |
92 // The SurfaceTexture to render to. Non-null after Initialize() if | 91 // The SurfaceTexture to render to. Non-null after Initialize() if |
93 // we're not rendering to a SurfaceView. | 92 // we're not rendering to a SurfaceView. |
94 scoped_refptr<gl::SurfaceTexture> surface_texture_; | 93 scoped_refptr<gl::SurfaceTexture> surface_texture_; |
95 | 94 |
96 media::VideoCodecBridge* media_codec_; | 95 VideoCodecBridge* media_codec_; |
97 | 96 |
98 // Picture buffer IDs that are out for display. Stored in order of frames as | 97 // Picture buffer IDs that are out for display. Stored in order of frames as |
99 // they are returned from the decoder. | 98 // they are returned from the decoder. |
100 std::vector<int32_t> pictures_out_for_display_; | 99 std::vector<int32_t> pictures_out_for_display_; |
101 | 100 |
102 DISALLOW_COPY_AND_ASSIGN(AndroidDeferredRenderingBackingStrategy); | 101 DISALLOW_COPY_AND_ASSIGN(AndroidDeferredRenderingBackingStrategy); |
103 }; | 102 }; |
104 | 103 |
105 } // namespace media | 104 } // namespace media |
106 | 105 |
107 #endif // MEDIA_GPU_ANDROID_DEFERRED_RENDERING_BACKING_STRATEGY_H_ | 106 #endif // MEDIA_GPU_ANDROID_DEFERRED_RENDERING_BACKING_STRATEGY_H_ |
OLD | NEW |