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

Side by Side Diff: media/gpu/avda_codec_image.h

Issue 2461073002: Use MediaCodec.setOutputSurface() for fullscreen transitions on M. (Closed)
Patch Set: Address comments. Created 4 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « media/gpu/android_video_decode_accelerator.cc ('k') | media/gpu/avda_codec_image.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_AVDA_CODEC_IMAGE_H_ 5 #ifndef MEDIA_GPU_AVDA_CODEC_IMAGE_H_
6 #define MEDIA_GPU_AVDA_CODEC_IMAGE_H_ 6 #define MEDIA_GPU_AVDA_CODEC_IMAGE_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 // Releases the attached codec buffer (if not already released) indicated by 67 // Releases the attached codec buffer (if not already released) indicated by
68 // |codec_buffer_index_| and updates the surface if specified by the given 68 // |codec_buffer_index_| and updates the surface if specified by the given
69 // |update_mode|. See UpdateMode documentation for details. 69 // |update_mode|. See UpdateMode documentation for details.
70 void UpdateSurface(UpdateMode update_mode); 70 void UpdateSurface(UpdateMode update_mode);
71 71
72 // Updates the MediaCodec for this image; clears |codec_buffer_index_|. 72 // Updates the MediaCodec for this image; clears |codec_buffer_index_|.
73 void CodecChanged(MediaCodecBridge* codec); 73 void CodecChanged(MediaCodecBridge* codec);
74 74
75 void set_texture(gpu::gles2::Texture* texture) { texture_ = texture; } 75 void set_texture(gpu::gles2::Texture* texture) { texture_ = texture; }
76 76
77 // Decoded buffer index that has the image for us to display. 77 // Sets up the properties necessary for the image to render. |buffer_index| is
78 void set_media_codec_buffer_index(int buffer_index) { 78 // supplied to ReleaseOutputBuffer(), |has_surface_texture| controls which
79 codec_buffer_index_ = buffer_index; 79 // rendering path is used, and |size| is used by the compositor.
80 } 80 void SetBufferMetadata(int buffer_index,
81 bool has_surface_texture,
82 const gfx::Size& size);
81 83
82 // Set the size of the current image. 84 bool SetSharedState(scoped_refptr<AVDASharedState> shared_state);
83 void set_size(const gfx::Size& size) { size_ = size; }
84 85
85 // Indicates if the codec buffer has been released to the back buffer. 86 // Indicates if the codec buffer has been released to the back buffer.
86 bool was_rendered_to_back_buffer() const { 87 bool was_rendered_to_back_buffer() const {
87 return codec_buffer_index_ == kUpdateOnly; 88 return codec_buffer_index_ == kUpdateOnly;
88 } 89 }
89 90
90 // Indicates if the codec buffer has been released to the front buffer. 91 // Indicates if the codec buffer has been released to the front buffer.
91 bool was_rendered_to_front_buffer() const { 92 bool was_rendered_to_front_buffer() const {
92 return codec_buffer_index_ == kRendered; 93 return codec_buffer_index_ == kRendered;
93 } 94 }
94 95
96 bool is_unrendered() const { return codec_buffer_index_ >= kUpdateOnly; }
97
95 protected: 98 protected:
96 ~AVDACodecImage() override; 99 ~AVDACodecImage() override;
97 100
98 private: 101 private:
99 // Make sure that the surface texture's front buffer is current. This will 102 // Make sure that the surface texture's front buffer is current. This will
100 // save / restore the current context. It will optionally restore the texture 103 // save / restore the current context. It will optionally restore the texture
101 // bindings in the surface texture's context, based on |mode|. This is 104 // bindings in the surface texture's context, based on |mode|. This is
102 // intended as a hint if we don't need to change contexts. If we do need to 105 // intended as a hint if we don't need to change contexts. If we do need to
103 // change contexts, then we'll always preserve the texture bindings in the 106 // change contexts, then we'll always preserve the texture bindings in the
104 // both contexts. In other words, the caller is telling us whether it's 107 // both contexts. In other words, the caller is telling us whether it's
(...skipping 29 matching lines...) Expand all
134 int codec_buffer_index_; 137 int codec_buffer_index_;
135 138
136 // Our image size. 139 // Our image size.
137 gfx::Size size_; 140 gfx::Size size_;
138 141
139 // May be null. 142 // May be null.
140 MediaCodecBridge* media_codec_; 143 MediaCodecBridge* media_codec_;
141 144
142 const base::WeakPtr<gpu::gles2::GLES2Decoder> decoder_; 145 const base::WeakPtr<gpu::gles2::GLES2Decoder> decoder_;
143 146
144 // Indicates if we're rendering to a SurfaceTexture or not. 147 // Indicates if we're rendering to a SurfaceTexture or not. Set during the
145 const bool has_surface_texture_; 148 // call to SetBufferMetadata().
149 bool has_surface_texture_;
146 150
147 // The texture that we're attached to. 151 // The texture that we're attached to.
148 gpu::gles2::Texture* texture_; 152 gpu::gles2::Texture* texture_;
149 153
150 DISALLOW_COPY_AND_ASSIGN(AVDACodecImage); 154 DISALLOW_COPY_AND_ASSIGN(AVDACodecImage);
151 }; 155 };
152 156
153 } // namespace media 157 } // namespace media
154 158
155 #endif // MEDIA_GPU_AVDA_CODEC_IMAGE_H_ 159 #endif // MEDIA_GPU_AVDA_CODEC_IMAGE_H_
OLDNEW
« no previous file with comments | « media/gpu/android_video_decode_accelerator.cc ('k') | media/gpu/avda_codec_image.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698