OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_COMMON_GPU_MEDIA_GPU_VIDEO_DECODE_ACCELERATOR_H_ | 5 #ifndef CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_DECODE_ACCELERATOR_H_ |
6 #define CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_DECODE_ACCELERATOR_H_ | 6 #define CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_DECODE_ACCELERATOR_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/shared_memory.h" | 12 #include "base/memory/shared_memory.h" |
13 #include "content/common/gpu/gpu_command_buffer_stub.h" | 13 #include "content/common/gpu/gpu_command_buffer_stub.h" |
14 #include "content/common/gpu/media/video_decode_accelerator_impl.h" | 14 #include "content/common/gpu/media/video_decode_accelerator_impl.h" |
15 #include "ipc/ipc_listener.h" | 15 #include "ipc/ipc_listener.h" |
16 #include "ipc/ipc_sender.h" | 16 #include "ipc/ipc_sender.h" |
17 #include "media/video/video_decode_accelerator.h" | 17 #include "media/video/video_decode_accelerator.h" |
| 18 #include "ui/gfx/size.h" |
18 | 19 |
19 namespace base { | 20 namespace base { |
20 class MessageLoopProxy; | 21 class MessageLoopProxy; |
21 } | 22 } |
22 | 23 |
23 namespace content { | 24 namespace content { |
24 | 25 |
25 class GpuVideoDecodeAccelerator | 26 class GpuVideoDecodeAccelerator |
26 : public IPC::Listener, | 27 : public IPC::Listener, |
27 public IPC::Sender, | 28 public IPC::Sender, |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 // The renderer process handle is valid as long as we have a channel between | 64 // The renderer process handle is valid as long as we have a channel between |
64 // GPU process and the renderer. | 65 // GPU process and the renderer. |
65 void Initialize(const media::VideoCodecProfile profile, | 66 void Initialize(const media::VideoCodecProfile profile, |
66 IPC::Message* init_done_msg); | 67 IPC::Message* init_done_msg); |
67 | 68 |
68 private: | 69 private: |
69 class MessageFilter; | 70 class MessageFilter; |
70 | 71 |
71 // Handlers for IPC messages. | 72 // Handlers for IPC messages. |
72 void OnDecode(base::SharedMemoryHandle handle, int32 id, uint32 size); | 73 void OnDecode(base::SharedMemoryHandle handle, int32 id, uint32 size); |
73 void OnAssignPictureBuffers( | 74 void OnAssignPictureBuffers(const std::vector<int32>& buffer_ids, |
74 const std::vector<int32>& buffer_ids, | 75 const std::vector<uint32>& texture_ids); |
75 const std::vector<uint32>& texture_ids, | 76 void OnReusePictureBuffer(int32 picture_buffer_id); |
76 const std::vector<gfx::Size>& sizes); | |
77 void OnReusePictureBuffer( | |
78 int32 picture_buffer_id); | |
79 void OnFlush(); | 77 void OnFlush(); |
80 void OnReset(); | 78 void OnReset(); |
81 void OnDestroy(); | 79 void OnDestroy(); |
82 | 80 |
83 // Called on IO thread when |filter_| has been removed. | 81 // Called on IO thread when |filter_| has been removed. |
84 void OnFilterRemoved(); | 82 void OnFilterRemoved(); |
85 | 83 |
86 // Message to Send() when initialization is done. Is only non-NULL during | 84 // Message to Send() when initialization is done. Is only non-NULL during |
87 // initialization and is owned by the IPC channel underlying the | 85 // initialization and is owned by the IPC channel underlying the |
88 // GpuCommandBufferStub. | 86 // GpuCommandBufferStub. |
89 IPC::Message* init_done_msg_; | 87 IPC::Message* init_done_msg_; |
90 | 88 |
91 // Route ID to communicate with the host. | 89 // Route ID to communicate with the host. |
92 int32 host_route_id_; | 90 int32 host_route_id_; |
93 | 91 |
94 // Unowned pointer to the underlying GpuCommandBufferStub. | 92 // Unowned pointer to the underlying GpuCommandBufferStub. |
95 GpuCommandBufferStub* stub_; | 93 GpuCommandBufferStub* stub_; |
96 | 94 |
97 // The underlying VideoDecodeAccelerator. | 95 // The underlying VideoDecodeAccelerator. |
98 scoped_ptr<VideoDecodeAcceleratorImpl> video_decode_accelerator_; | 96 scoped_ptr<VideoDecodeAcceleratorImpl> video_decode_accelerator_; |
99 | 97 |
100 // Callback for making the relevant context current for GL calls. | 98 // Callback for making the relevant context current for GL calls. |
101 // Returns false if failed. | 99 // Returns false if failed. |
102 base::Callback<bool(void)> make_context_current_; | 100 base::Callback<bool(void)> make_context_current_; |
103 | 101 |
| 102 // The texture dimensions as requested by ProvidePictureBuffers(). |
| 103 gfx::Size texture_dimensions_; |
| 104 |
104 // The texture target as requested by ProvidePictureBuffers(). | 105 // The texture target as requested by ProvidePictureBuffers(). |
105 uint32 texture_target_; | 106 uint32 texture_target_; |
106 | 107 |
107 // The message filter to run VDA::Decode on IO thread if VDA supports it. | 108 // The message filter to run VDA::Decode on IO thread if VDA supports it. |
108 scoped_refptr<MessageFilter> filter_; | 109 scoped_refptr<MessageFilter> filter_; |
109 | 110 |
110 // GPU child message loop. | 111 // GPU child message loop. |
111 scoped_refptr<base::MessageLoopProxy> child_message_loop_; | 112 scoped_refptr<base::MessageLoopProxy> child_message_loop_; |
112 | 113 |
113 // GPU IO message loop. | 114 // GPU IO message loop. |
114 scoped_refptr<base::MessageLoopProxy> io_message_loop_; | 115 scoped_refptr<base::MessageLoopProxy> io_message_loop_; |
115 | 116 |
116 // Weak pointers will be invalidated on IO thread. | 117 // Weak pointers will be invalidated on IO thread. |
117 base::WeakPtrFactory<Client> weak_factory_for_io_; | 118 base::WeakPtrFactory<Client> weak_factory_for_io_; |
118 | 119 |
119 DISALLOW_IMPLICIT_CONSTRUCTORS(GpuVideoDecodeAccelerator); | 120 DISALLOW_IMPLICIT_CONSTRUCTORS(GpuVideoDecodeAccelerator); |
120 }; | 121 }; |
121 | 122 |
122 } // namespace content | 123 } // namespace content |
123 | 124 |
124 #endif // CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_DECODE_ACCELERATOR_H_ | 125 #endif // CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_DECODE_ACCELERATOR_H_ |
OLD | NEW |