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

Side by Side Diff: content/renderer/pepper/video_decoder_shim.cc

Issue 1916923004: Request context sharing via content::ContextProviderCommandBuffer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sharegroup: . Created 4 years, 7 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
« no previous file with comments | « content/renderer/pepper/video_decoder_shim.h ('k') | content/renderer/render_frame_impl.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "content/renderer/pepper/video_decoder_shim.h" 5 #include "content/renderer/pepper/video_decoder_shim.h"
6 6
7 #include <GLES2/gl2.h> 7 #include <GLES2/gl2.h>
8 #include <GLES2/gl2ext.h> 8 #include <GLES2/gl2ext.h>
9 #include <GLES2/gl2extchromium.h> 9 #include <GLES2/gl2extchromium.h>
10 #include <utility> 10 #include <utility>
11 11
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/location.h" 13 #include "base/location.h"
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/numerics/safe_conversions.h" 16 #include "base/numerics/safe_conversions.h"
17 #include "base/single_thread_task_runner.h" 17 #include "base/single_thread_task_runner.h"
18 #include "base/thread_task_runner_handle.h" 18 #include "base/thread_task_runner_handle.h"
19 #include "cc/blink/context_provider_web_context.h" 19 #include "content/common/gpu/client/context_provider_command_buffer.h"
20 #include "content/public/renderer/render_thread.h" 20 #include "content/public/renderer/render_thread.h"
21 #include "content/renderer/pepper/pepper_video_decoder_host.h" 21 #include "content/renderer/pepper/pepper_video_decoder_host.h"
22 #include "content/renderer/render_thread_impl.h" 22 #include "content/renderer/render_thread_impl.h"
23 #include "gpu/command_buffer/client/gles2_interface.h" 23 #include "gpu/command_buffer/client/gles2_interface.h"
24 #include "media/base/cdm_context.h" 24 #include "media/base/cdm_context.h"
25 #include "media/base/decoder_buffer.h" 25 #include "media/base/decoder_buffer.h"
26 #include "media/base/limits.h" 26 #include "media/base/limits.h"
27 #include "media/base/media_util.h" 27 #include "media/base/media_util.h"
28 #include "media/base/video_decoder.h" 28 #include "media/base/video_decoder.h"
29 #include "media/filters/ffmpeg_video_decoder.h" 29 #include "media/filters/ffmpeg_video_decoder.h"
(...skipping 24 matching lines...) Expand all
54 #else 54 #else
55 return false; 55 return false;
56 #endif 56 #endif
57 } 57 }
58 58
59 } // namespace 59 } // namespace
60 60
61 // YUV->RGB converter class using a shader and FBO. 61 // YUV->RGB converter class using a shader and FBO.
62 class VideoDecoderShim::YUVConverter { 62 class VideoDecoderShim::YUVConverter {
63 public: 63 public:
64 YUVConverter(const scoped_refptr<cc_blink::ContextProviderWebContext>&); 64 YUVConverter(scoped_refptr<ContextProviderCommandBuffer>);
65 ~YUVConverter(); 65 ~YUVConverter();
66 bool Initialize(); 66 bool Initialize();
67 void Convert(const scoped_refptr<media::VideoFrame>& frame, GLuint tex_out); 67 void Convert(const scoped_refptr<media::VideoFrame>& frame, GLuint tex_out);
68 68
69 private: 69 private:
70 GLuint CreateShader(); 70 GLuint CreateShader();
71 GLuint CompileShader(const char* name, GLuint type, const char* code); 71 GLuint CompileShader(const char* name, GLuint type, const char* code);
72 GLuint CreateProgram(const char* name, GLuint vshader, GLuint fshader); 72 GLuint CreateProgram(const char* name, GLuint vshader, GLuint fshader);
73 GLuint CreateTexture(); 73 GLuint CreateTexture();
74 74
75 scoped_refptr<cc_blink::ContextProviderWebContext> context_provider_; 75 scoped_refptr<ContextProviderCommandBuffer> context_provider_;
76 gpu::gles2::GLES2Interface* gl_; 76 gpu::gles2::GLES2Interface* gl_;
77 GLuint frame_buffer_; 77 GLuint frame_buffer_;
78 GLuint vertex_buffer_; 78 GLuint vertex_buffer_;
79 GLuint program_; 79 GLuint program_;
80 80
81 GLuint y_texture_; 81 GLuint y_texture_;
82 GLuint u_texture_; 82 GLuint u_texture_;
83 GLuint v_texture_; 83 GLuint v_texture_;
84 GLuint a_texture_; 84 GLuint a_texture_;
85 85
86 GLuint internal_format_; 86 GLuint internal_format_;
87 GLuint format_; 87 GLuint format_;
88 media::VideoPixelFormat video_format_; 88 media::VideoPixelFormat video_format_;
89 89
90 GLuint y_width_; 90 GLuint y_width_;
91 GLuint y_height_; 91 GLuint y_height_;
92 92
93 GLuint uv_width_; 93 GLuint uv_width_;
94 GLuint uv_height_; 94 GLuint uv_height_;
95 uint32_t uv_height_divisor_; 95 uint32_t uv_height_divisor_;
96 uint32_t uv_width_divisor_; 96 uint32_t uv_width_divisor_;
97 97
98 GLint yuv_matrix_loc_; 98 GLint yuv_matrix_loc_;
99 GLint yuv_adjust_loc_; 99 GLint yuv_adjust_loc_;
100 100
101 DISALLOW_COPY_AND_ASSIGN(YUVConverter); 101 DISALLOW_COPY_AND_ASSIGN(YUVConverter);
102 }; 102 };
103 103
104 VideoDecoderShim::YUVConverter::YUVConverter( 104 VideoDecoderShim::YUVConverter::YUVConverter(
105 const scoped_refptr<cc_blink::ContextProviderWebContext>& context_provider) 105 scoped_refptr<ContextProviderCommandBuffer> context_provider)
106 : context_provider_(context_provider), 106 : context_provider_(std::move(context_provider)),
107 gl_(context_provider_->ContextGL()), 107 gl_(context_provider_->ContextGL()),
108 frame_buffer_(0), 108 frame_buffer_(0),
109 vertex_buffer_(0), 109 vertex_buffer_(0),
110 program_(0), 110 program_(0),
111 y_texture_(0), 111 y_texture_(0),
112 u_texture_(0), 112 u_texture_(0),
113 v_texture_(0), 113 v_texture_(0),
114 a_texture_(0), 114 a_texture_(0),
115 internal_format_(0), 115 internal_format_(0),
116 format_(0), 116 format_(0),
(...skipping 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after
1117 void VideoDecoderShim::DeleteTexture(uint32_t texture_id) { 1117 void VideoDecoderShim::DeleteTexture(uint32_t texture_id) {
1118 gpu::gles2::GLES2Interface* gles2 = context_provider_->ContextGL(); 1118 gpu::gles2::GLES2Interface* gles2 = context_provider_->ContextGL();
1119 gles2->DeleteTextures(1, &texture_id); 1119 gles2->DeleteTextures(1, &texture_id);
1120 } 1120 }
1121 1121
1122 void VideoDecoderShim::FlushCommandBuffer() { 1122 void VideoDecoderShim::FlushCommandBuffer() {
1123 context_provider_->ContextGL()->Flush(); 1123 context_provider_->ContextGL()->Flush();
1124 } 1124 }
1125 1125
1126 } // namespace content 1126 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/pepper/video_decoder_shim.h ('k') | content/renderer/render_frame_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698