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

Side by Side Diff: media/gpu/avda_picture_buffer_manager.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/avda_codec_image.cc ('k') | media/gpu/avda_picture_buffer_manager.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_PICTURE_BUFFER_MANAGER_H_ 5 #ifndef MEDIA_GPU_AVDA_PICTURE_BUFFER_MANAGER_H_
6 #define MEDIA_GPU_AVDA_PICTURE_BUFFER_MANAGER_H_ 6 #define MEDIA_GPU_AVDA_PICTURE_BUFFER_MANAGER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 27 matching lines...) Expand all
38 class MEDIA_GPU_EXPORT AVDAPictureBufferManager { 38 class MEDIA_GPU_EXPORT AVDAPictureBufferManager {
39 public: 39 public:
40 using PictureBufferMap = std::map<int32_t, PictureBuffer>; 40 using PictureBufferMap = std::map<int32_t, PictureBuffer>;
41 41
42 explicit AVDAPictureBufferManager(AVDAStateProvider* state_provider); 42 explicit AVDAPictureBufferManager(AVDAStateProvider* state_provider);
43 virtual ~AVDAPictureBufferManager(); 43 virtual ~AVDAPictureBufferManager();
44 44
45 // Must be called before anything else. If |surface_id| is |kNoSurfaceID| 45 // Must be called before anything else. If |surface_id| is |kNoSurfaceID|
46 // then a new SurfaceTexture will be returned. Otherwise, the corresponding 46 // then a new SurfaceTexture will be returned. Otherwise, the corresponding
47 // SurfaceView will be returned. 47 // SurfaceView will be returned.
48 //
49 // May be called multiple times to switch to a new |surface_id|. Picture
50 // buffers will be updated to use the new surface during the call to
51 // UseCodecBufferForPictureBuffer().
48 gl::ScopedJavaSurface Initialize(int surface_id); 52 gl::ScopedJavaSurface Initialize(int surface_id);
49 53
50 void Destroy(const PictureBufferMap& buffers); 54 void Destroy(const PictureBufferMap& buffers);
51 55
52 // Returns the GL texture target that the PictureBuffer textures use.
53 uint32_t GetTextureTarget() const;
54
55 // Returns the size to use when requesting picture buffers.
56 gfx::Size GetPictureBufferSize() const;
57
58 // Sets up |picture_buffer| so that its texture will refer to the image that 56 // Sets up |picture_buffer| so that its texture will refer to the image that
59 // is represented by the decoded output buffer at codec_buffer_index. 57 // is represented by the decoded output buffer at codec_buffer_index.
60 void UseCodecBufferForPictureBuffer(int32_t codec_buffer_index, 58 void UseCodecBufferForPictureBuffer(int32_t codec_buffer_index,
61 const PictureBuffer& picture_buffer); 59 const PictureBuffer& picture_buffer);
62 60
63 // Assigns a picture buffer and attaches an image to its texture. 61 // Assigns a picture buffer and attaches an image to its texture.
64 void AssignOnePictureBuffer(const PictureBuffer& picture_buffer, 62 void AssignOnePictureBuffer(const PictureBuffer& picture_buffer,
65 bool have_context); 63 bool have_context);
66 64
67 // Reuses a picture buffer to hold a new frame. 65 // Reuses a picture buffer to hold a new frame.
68 void ReuseOnePictureBuffer(const PictureBuffer& picture_buffer); 66 void ReuseOnePictureBuffer(const PictureBuffer& picture_buffer);
69 67
70 // Release MediaCodec buffers. 68 // Release MediaCodec buffers.
71 void ReleaseCodecBuffers(const PictureBufferMap& buffers); 69 void ReleaseCodecBuffers(const PictureBufferMap& buffers);
72 70
73 // Attempts to free up codec output buffers by rendering early. 71 // Attempts to free up codec output buffers by rendering early.
74 void MaybeRenderEarly(); 72 void MaybeRenderEarly();
75 73
76 // Called when the MediaCodec instance changes. If |codec| is nullptr the 74 // Called when the MediaCodec instance changes. If |codec| is nullptr the
77 // MediaCodec is being destroyed. Previously provided codecs should no longer 75 // MediaCodec is being destroyed. Previously provided codecs should no longer
78 // be referenced. 76 // be referenced.
79 void CodecChanged(VideoCodecBridge* codec); 77 void CodecChanged(VideoCodecBridge* codec);
80 78
81 // Whether the pictures buffers are overlayable. 79 // Whether the pictures buffers are overlayable.
82 bool ArePicturesOverlayable(); 80 bool ArePicturesOverlayable();
83 81
82 // Are there any unrendered picture buffers oustanding?
83 bool HasUnrenderedPictures() const;
84
85 // Returns the GL texture target that the PictureBuffer textures use.
86 // Always use OES textures even though this will cause flickering in dev tools
87 // when inspecting a fullscreen video. See http://crbug.com/592798
88 static constexpr GLenum kTextureTarget = GL_TEXTURE_EXTERNAL_OES;
89
84 private: 90 private:
85 // Release any codec buffer that is associated with the given picture buffer 91 // Release any codec buffer that is associated with the given picture buffer
86 // back to the codec. It is okay if there is no such buffer. 92 // back to the codec. It is okay if there is no such buffer.
87 void ReleaseCodecBufferForPicture(const PictureBuffer& picture_buffer); 93 void ReleaseCodecBufferForPicture(const PictureBuffer& picture_buffer);
88 94
89 // Sets up the texture references (as found by |picture_buffer|), for the 95 // Sets up the texture references (as found by |picture_buffer|), for the
90 // specified |image|. If |image| is null, clears any ref on the texture 96 // specified |image|. If |image| is null, clears any ref on the texture
91 // associated with |picture_buffer|. 97 // associated with |picture_buffer|.
92 void SetImageForPicture(const PictureBuffer& picture_buffer, 98 void SetImageForPicture(const PictureBuffer& picture_buffer,
93 gpu::gles2::GLStreamTextureImage* image); 99 gpu::gles2::GLStreamTextureImage* image);
(...skipping 16 matching lines...) Expand all
110 116
111 // Maps a picture buffer id to a AVDACodecImage. 117 // Maps a picture buffer id to a AVDACodecImage.
112 std::map<int, scoped_refptr<AVDACodecImage>> codec_images_; 118 std::map<int, scoped_refptr<AVDACodecImage>> codec_images_;
113 119
114 DISALLOW_COPY_AND_ASSIGN(AVDAPictureBufferManager); 120 DISALLOW_COPY_AND_ASSIGN(AVDAPictureBufferManager);
115 }; 121 };
116 122
117 } // namespace media 123 } // namespace media
118 124
119 #endif // MEDIA_GPU_AVDA_PICTURE_BUFFER_MANAGER_H_ 125 #endif // MEDIA_GPU_AVDA_PICTURE_BUFFER_MANAGER_H_
OLDNEW
« no previous file with comments | « media/gpu/avda_codec_image.cc ('k') | media/gpu/avda_picture_buffer_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698