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

Side by Side Diff: content/renderer/media/renderer_gpu_video_accelerator_factories.h

Issue 1306693002: media: Convert I420 VideoFrame to UYVY GpuMemoryBuffer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Address andresantoso's comments. Created 5 years, 4 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 CONTENT_RENDERER_MEDIA_RENDERER_GPU_VIDEO_ACCELERATOR_FACTORIES_H_ 5 #ifndef CONTENT_RENDERER_MEDIA_RENDERER_GPU_VIDEO_ACCELERATOR_FACTORIES_H_
6 #define CONTENT_RENDERER_MEDIA_RENDERER_GPU_VIDEO_ACCELERATOR_FACTORIES_H_ 6 #define CONTENT_RENDERER_MEDIA_RENDERER_GPU_VIDEO_ACCELERATOR_FACTORIES_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 : public media::GpuVideoAcceleratorFactories { 42 : public media::GpuVideoAcceleratorFactories {
43 public: 43 public:
44 // Takes a ref on |gpu_channel_host| and tests |context| for loss before each 44 // Takes a ref on |gpu_channel_host| and tests |context| for loss before each
45 // use. Safe to call from any thread. 45 // use. Safe to call from any thread.
46 static scoped_refptr<RendererGpuVideoAcceleratorFactories> Create( 46 static scoped_refptr<RendererGpuVideoAcceleratorFactories> Create(
47 GpuChannelHost* gpu_channel_host, 47 GpuChannelHost* gpu_channel_host,
48 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, 48 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
49 const scoped_refptr<ContextProviderCommandBuffer>& context_provider, 49 const scoped_refptr<ContextProviderCommandBuffer>& context_provider,
50 bool enable_gpu_memory_buffer_video_frames, 50 bool enable_gpu_memory_buffer_video_frames,
51 unsigned image_texture_target, 51 unsigned image_texture_target,
52 media::VideoPixelFormat video_frame_pixel_format,
52 bool enable_video_accelerator); 53 bool enable_video_accelerator);
53 54
54 bool IsGpuVideoAcceleratorEnabled() override; 55 bool IsGpuVideoAcceleratorEnabled() override;
55 // media::GpuVideoAcceleratorFactories implementation. 56 // media::GpuVideoAcceleratorFactories implementation.
56 scoped_ptr<media::VideoDecodeAccelerator> CreateVideoDecodeAccelerator() 57 scoped_ptr<media::VideoDecodeAccelerator> CreateVideoDecodeAccelerator()
57 override; 58 override;
58 scoped_ptr<media::VideoEncodeAccelerator> CreateVideoEncodeAccelerator() 59 scoped_ptr<media::VideoEncodeAccelerator> CreateVideoEncodeAccelerator()
59 override; 60 override;
60 // Creates textures and produces them into mailboxes. Returns true on success 61 // Creates textures and produces them into mailboxes. Returns true on success
61 // or false on failure. 62 // or false on failure.
62 bool CreateTextures(int32 count, 63 bool CreateTextures(int32 count,
63 const gfx::Size& size, 64 const gfx::Size& size,
64 std::vector<uint32>* texture_ids, 65 std::vector<uint32>* texture_ids,
65 std::vector<gpu::Mailbox>* texture_mailboxes, 66 std::vector<gpu::Mailbox>* texture_mailboxes,
66 uint32 texture_target) override; 67 uint32 texture_target) override;
67 void DeleteTexture(uint32 texture_id) override; 68 void DeleteTexture(uint32 texture_id) override;
68 void WaitSyncPoint(uint32 sync_point) override; 69 void WaitSyncPoint(uint32 sync_point) override;
69 70
70 scoped_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBuffer( 71 scoped_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBuffer(
71 const gfx::Size& size, 72 const gfx::Size& size,
72 gfx::BufferFormat format, 73 gfx::BufferFormat format,
73 gfx::BufferUsage usage) override; 74 gfx::BufferUsage usage) override;
74 75
75 bool IsTextureRGSupported() override; 76 bool IsTextureRGSupported() override;
76 bool ShouldUseGpuMemoryBuffersForVideoFrames() const override; 77 bool ShouldUseGpuMemoryBuffersForVideoFrames() const override;
77 unsigned ImageTextureTarget() override; 78 unsigned ImageTextureTarget() override;
79 media::VideoPixelFormat VideoFramePixelFormat() override;
xhwang 2015/08/21 20:53:07 This is used for output frame, it seems easier to
Daniele Castagna 2015/08/21 21:28:17 Renamed to VideoFrameOutputFormat.
78 gpu::gles2::GLES2Interface* GetGLES2Interface() override; 80 gpu::gles2::GLES2Interface* GetGLES2Interface() override;
79 scoped_ptr<base::SharedMemory> CreateSharedMemory(size_t size) override; 81 scoped_ptr<base::SharedMemory> CreateSharedMemory(size_t size) override;
80 scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner() override; 82 scoped_refptr<base::SingleThreadTaskRunner> GetTaskRunner() override;
81 83
82 std::vector<media::VideoDecodeAccelerator::SupportedProfile> 84 std::vector<media::VideoDecodeAccelerator::SupportedProfile>
83 GetVideoDecodeAcceleratorSupportedProfiles() override; 85 GetVideoDecodeAcceleratorSupportedProfiles() override;
84 std::vector<media::VideoEncodeAccelerator::SupportedProfile> 86 std::vector<media::VideoEncodeAccelerator::SupportedProfile>
85 GetVideoEncodeAcceleratorSupportedProfiles() override; 87 GetVideoEncodeAcceleratorSupportedProfiles() override;
86 88
87 private: 89 private:
88 friend class base::RefCountedThreadSafe<RendererGpuVideoAcceleratorFactories>; 90 friend class base::RefCountedThreadSafe<RendererGpuVideoAcceleratorFactories>;
89 RendererGpuVideoAcceleratorFactories( 91 RendererGpuVideoAcceleratorFactories(
90 GpuChannelHost* gpu_channel_host, 92 GpuChannelHost* gpu_channel_host,
91 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, 93 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
92 const scoped_refptr<ContextProviderCommandBuffer>& context_provider, 94 const scoped_refptr<ContextProviderCommandBuffer>& context_provider,
93 bool enable_gpu_memory_buffer_video_frames, 95 bool enable_gpu_memory_buffer_video_frames,
94 unsigned image_texture_target, 96 unsigned image_texture_target,
97 media::VideoPixelFormat video_frame_pixel_format_,
95 bool enable_video_accelerator); 98 bool enable_video_accelerator);
96 99
97 ~RendererGpuVideoAcceleratorFactories() override; 100 ~RendererGpuVideoAcceleratorFactories() override;
98 101
99 // Helper to bind |context_provider| to the |task_runner_| thread after 102 // Helper to bind |context_provider| to the |task_runner_| thread after
100 // construction. 103 // construction.
101 void BindContext(); 104 void BindContext();
102 105
103 // Helper to get a pointer to the WebGraphicsContext3DCommandBufferImpl, 106 // Helper to get a pointer to the WebGraphicsContext3DCommandBufferImpl,
104 // if it has not been lost yet. 107 // if it has not been lost yet.
105 WebGraphicsContext3DCommandBufferImpl* GetContext3d(); 108 WebGraphicsContext3DCommandBufferImpl* GetContext3d();
106 GLHelper* GetGLHelper(); 109 GLHelper* GetGLHelper();
107 110
108 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 111 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
109 scoped_refptr<GpuChannelHost> gpu_channel_host_; 112 scoped_refptr<GpuChannelHost> gpu_channel_host_;
110 scoped_refptr<ContextProviderCommandBuffer> context_provider_; 113 scoped_refptr<ContextProviderCommandBuffer> context_provider_;
111 114
112 // Wheter gpu memory buffers should be used to hold video frames data. 115 // Wheter gpu memory buffers should be used to hold video frames data.
xhwang 2015/08/21 20:53:07 nit: Whet_h_er
Daniele Castagna 2015/08/21 21:28:17 Done. Tnx. :)
113 bool enable_gpu_memory_buffer_video_frames_; 116 bool enable_gpu_memory_buffer_video_frames_;
114 const unsigned image_texture_target_; 117 const unsigned image_texture_target_;
118 const media::VideoPixelFormat video_frame_pixel_format_;
xhwang 2015/08/21 20:53:07 Add a comment for this new member.
Daniele Castagna 2015/08/21 21:28:17 Done.
115 // Whether video acceleration encoding/decoding should be enabled. 119 // Whether video acceleration encoding/decoding should be enabled.
116 const bool video_accelerator_enabled_; 120 const bool video_accelerator_enabled_;
117 121
118 scoped_ptr<GLHelper> gl_helper_; 122 scoped_ptr<GLHelper> gl_helper_;
119 gpu::GpuMemoryBufferManager* const gpu_memory_buffer_manager_; 123 gpu::GpuMemoryBufferManager* const gpu_memory_buffer_manager_;
120 124
121 // For sending requests to allocate shared memory in the Browser process. 125 // For sending requests to allocate shared memory in the Browser process.
122 scoped_refptr<ThreadSafeSender> thread_safe_sender_; 126 scoped_refptr<ThreadSafeSender> thread_safe_sender_;
123 127
124 DISALLOW_COPY_AND_ASSIGN(RendererGpuVideoAcceleratorFactories); 128 DISALLOW_COPY_AND_ASSIGN(RendererGpuVideoAcceleratorFactories);
125 }; 129 };
126 130
127 } // namespace content 131 } // namespace content
128 132
129 #endif // CONTENT_RENDERER_MEDIA_RENDERER_GPU_VIDEO_ACCELERATOR_FACTORIES_H_ 133 #endif // CONTENT_RENDERER_MEDIA_RENDERER_GPU_VIDEO_ACCELERATOR_FACTORIES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698