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

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

Issue 2351293003: Relocate SurfaceTexture usage from AVDA GLImage into shared state. (Closed)
Patch Set: Unflip default matrix. Created 4 years, 2 months 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
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_SHARED_STATE_H_ 5 #ifndef MEDIA_GPU_AVDA_SHARED_STATE_H_
6 #define MEDIA_GPU_AVDA_SHARED_STATE_H_ 6 #define MEDIA_GPU_AVDA_SHARED_STATE_H_
7 7
8 #include "base/synchronization/waitable_event.h" 8 #include "base/synchronization/waitable_event.h"
9 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" 9 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
10 #include "media/base/android/media_codec_bridge.h" 10 #include "media/base/android/media_codec_bridge.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 // and then call WaitForFrameAvailable() before using the SurfaceTexture. In 68 // and then call WaitForFrameAvailable() before using the SurfaceTexture. In
69 // the ideal case the SurfaceTexture has already been updated, otherwise the 69 // the ideal case the SurfaceTexture has already been updated, otherwise the
70 // method will wait for a pro-rated amount of time based on elapsed time up 70 // method will wait for a pro-rated amount of time based on elapsed time up
71 // to a short deadline. 71 // to a short deadline.
72 // 72 //
73 // Some devices do not reliably notify frame availability, so we use a very 73 // Some devices do not reliably notify frame availability, so we use a very
74 // short deadline of only a few milliseconds to avoid indefinite stalls. 74 // short deadline of only a few milliseconds to avoid indefinite stalls.
75 void RenderCodecBufferToSurfaceTexture(MediaCodecBridge* codec, 75 void RenderCodecBufferToSurfaceTexture(MediaCodecBridge* codec,
76 int codec_buffer_index); 76 int codec_buffer_index);
77 77
78 // Helper methods for interacting with |surface_texture_|. See
79 // gfx::SurfaceTexture for method details.
80 void UpdateTexImage();
81 // Returns a matrix that needs to be y flipped in order to match the
82 // StreamTextureMatrix contract. See GLStreamTextureImage::YInvertMatrix().
83 void GetTransformMatrix(float matrix[16]) const;
84
78 protected: 85 protected:
79 virtual ~AVDASharedState(); 86 virtual ~AVDASharedState();
80 87
81 private: 88 private:
82 friend class base::RefCounted<AVDASharedState>; 89 friend class base::RefCounted<AVDASharedState>;
83 90
84 scoped_refptr<gl::SurfaceTexture> surface_texture_; 91 scoped_refptr<gl::SurfaceTexture> surface_texture_;
85 92
86 // Platform gl texture id for |surface_texture_|. 93 // Platform gl texture id for |surface_texture_|.
87 GLuint surface_texture_service_id_; 94 GLuint surface_texture_service_id_;
88 95
89 // For signalling OnFrameAvailable(). 96 // For signalling OnFrameAvailable().
90 base::WaitableEvent frame_available_event_; 97 base::WaitableEvent frame_available_event_;
91 98
92 // Context and surface that |surface_texture_| is bound to, if 99 // Context and surface that |surface_texture_| is bound to, if
93 // |surface_texture_| is not null. 100 // |surface_texture_| is not null.
94 scoped_refptr<gl::GLContext> context_; 101 scoped_refptr<gl::GLContext> context_;
95 scoped_refptr<gl::GLSurface> surface_; 102 scoped_refptr<gl::GLSurface> surface_;
96 103
97 // Maps a picture buffer id to a AVDACodecImage. 104 // Maps a picture buffer id to a AVDACodecImage.
98 std::map<int, AVDACodecImage*> codec_images_; 105 std::map<int, AVDACodecImage*> codec_images_;
99 106
100 // The time of the last call to RenderCodecBufferToSurfaceTexture(), null if 107 // The time of the last call to RenderCodecBufferToSurfaceTexture(), null if
101 // if there has been no last call or WaitForFrameAvailable() has been called 108 // if there has been no last call or WaitForFrameAvailable() has been called
102 // since the last call. 109 // since the last call.
103 base::TimeTicks release_time_; 110 base::TimeTicks release_time_;
104 111
112 // Texture matrix of the front buffer of the surface texture.
113 float gl_matrix_[16];
114
105 DISALLOW_COPY_AND_ASSIGN(AVDASharedState); 115 DISALLOW_COPY_AND_ASSIGN(AVDASharedState);
106 }; 116 };
107 117
108 } // namespace media 118 } // namespace media
109 119
110 #endif // MEDIA_GPU_AVDA_SHARED_STATE_H_ 120 #endif // MEDIA_GPU_AVDA_SHARED_STATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698