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 <map> | 8 #include <map> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 | 42 |
43 // IPC::Listener implementation. | 43 // IPC::Listener implementation. |
44 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 44 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
45 | 45 |
46 // media::VideoDecodeAccelerator::Client implementation. | 46 // media::VideoDecodeAccelerator::Client implementation. |
47 virtual void ProvidePictureBuffers(uint32 requested_num_of_buffers, | 47 virtual void ProvidePictureBuffers(uint32 requested_num_of_buffers, |
48 const gfx::Size& dimensions, | 48 const gfx::Size& dimensions, |
49 uint32 texture_target) OVERRIDE; | 49 uint32 texture_target) OVERRIDE; |
50 virtual void DismissPictureBuffer(int32 picture_buffer_id) OVERRIDE; | 50 virtual void DismissPictureBuffer(int32 picture_buffer_id) OVERRIDE; |
51 virtual void PictureReady(const media::Picture& picture) OVERRIDE; | 51 virtual void PictureReady(const media::Picture& picture) OVERRIDE; |
52 virtual void NotifyInitializeDone() OVERRIDE; | |
53 virtual void NotifyError(media::VideoDecodeAccelerator::Error error) OVERRIDE; | 52 virtual void NotifyError(media::VideoDecodeAccelerator::Error error) OVERRIDE; |
54 virtual void NotifyEndOfBitstreamBuffer(int32 bitstream_buffer_id) OVERRIDE; | 53 virtual void NotifyEndOfBitstreamBuffer(int32 bitstream_buffer_id) OVERRIDE; |
55 virtual void NotifyFlushDone() OVERRIDE; | 54 virtual void NotifyFlushDone() OVERRIDE; |
56 virtual void NotifyResetDone() OVERRIDE; | 55 virtual void NotifyResetDone() OVERRIDE; |
57 | 56 |
58 // GpuCommandBufferStub::DestructionObserver implementation. | 57 // GpuCommandBufferStub::DestructionObserver implementation. |
59 virtual void OnWillDestroyStub() OVERRIDE; | 58 virtual void OnWillDestroyStub() OVERRIDE; |
60 | 59 |
61 // Function to delegate sending to actual sender. | 60 // Function to delegate sending to actual sender. |
62 virtual bool Send(IPC::Message* message) OVERRIDE; | 61 virtual bool Send(IPC::Message* message) OVERRIDE; |
63 | 62 |
64 // Initialize the accelerator with the given profile and send the | 63 // Initialize the accelerator with the given profile and send the |
65 // |init_done_msg| when done. | 64 // |init_done_msg| when done. |
66 // The renderer process handle is valid as long as we have a channel between | |
67 // GPU process and the renderer. | |
68 void Initialize(const media::VideoCodecProfile profile, | 65 void Initialize(const media::VideoCodecProfile profile, |
69 IPC::Message* init_done_msg); | 66 IPC::Message* init_done_msg); |
70 | 67 |
71 private: | 68 private: |
72 class MessageFilter; | 69 class MessageFilter; |
73 | 70 |
74 // We only allow self-delete, from OnWillDestroyStub(), after cleanup there. | 71 // We only allow self-delete, from OnWillDestroyStub(), after cleanup there. |
75 virtual ~GpuVideoDecodeAccelerator(); | 72 virtual ~GpuVideoDecodeAccelerator(); |
76 | 73 |
77 // Handlers for IPC messages. | 74 // Handlers for IPC messages. |
78 void OnDecode(base::SharedMemoryHandle handle, int32 id, uint32 size); | 75 void OnDecode(base::SharedMemoryHandle handle, int32 id, uint32 size); |
79 void OnAssignPictureBuffers(const std::vector<int32>& buffer_ids, | 76 void OnAssignPictureBuffers(const std::vector<int32>& buffer_ids, |
80 const std::vector<uint32>& texture_ids); | 77 const std::vector<uint32>& texture_ids); |
81 void OnReusePictureBuffer(int32 picture_buffer_id); | 78 void OnReusePictureBuffer(int32 picture_buffer_id); |
82 void OnFlush(); | 79 void OnFlush(); |
83 void OnReset(); | 80 void OnReset(); |
84 void OnDestroy(); | 81 void OnDestroy(); |
85 | 82 |
86 // Called on IO thread when |filter_| has been removed. | 83 // Called on IO thread when |filter_| has been removed. |
87 void OnFilterRemoved(); | 84 void OnFilterRemoved(); |
88 | 85 |
89 // Sets the texture to cleared. | 86 // Sets the texture to cleared. |
90 void SetTextureCleared(const media::Picture& picture); | 87 void SetTextureCleared(const media::Picture& picture); |
91 | 88 |
92 // Message to Send() when initialization is done. Is only non-NULL during | 89 // Helper for replying to the creation request. |
93 // initialization and is owned by the IPC channel underlying the | 90 void SendCreateDecoderReply(IPC::Message* message, int32 route_id); |
94 // GpuCommandBufferStub. | |
95 IPC::Message* init_done_msg_; | |
96 | 91 |
97 // Route ID to communicate with the host. | 92 // Route ID to communicate with the host. |
98 int32 host_route_id_; | 93 int32 host_route_id_; |
99 | 94 |
100 // Unowned pointer to the underlying GpuCommandBufferStub. | 95 // Unowned pointer to the underlying GpuCommandBufferStub. |this| is |
| 96 // registered as a DestuctionObserver of |stub_| and will self-delete when |
| 97 // |stub_| is destroyed. |
101 GpuCommandBufferStub* stub_; | 98 GpuCommandBufferStub* stub_; |
102 | 99 |
103 // The underlying VideoDecodeAccelerator. | 100 // The underlying VideoDecodeAccelerator. |
104 scoped_ptr<VideoDecodeAcceleratorImpl> video_decode_accelerator_; | 101 scoped_ptr<VideoDecodeAcceleratorImpl> video_decode_accelerator_; |
105 | 102 |
106 // Callback for making the relevant context current for GL calls. | 103 // Callback for making the relevant context current for GL calls. |
107 // Returns false if failed. | 104 // Returns false if failed. |
108 base::Callback<bool(void)> make_context_current_; | 105 base::Callback<bool(void)> make_context_current_; |
109 | 106 |
110 // The texture dimensions as requested by ProvidePictureBuffers(). | 107 // The texture dimensions as requested by ProvidePictureBuffers(). |
(...skipping 25 matching lines...) Expand all Loading... |
136 | 133 |
137 // A map from picture buffer ID to TextureRef that have not been cleared. | 134 // A map from picture buffer ID to TextureRef that have not been cleared. |
138 std::map<int32, scoped_refptr<gpu::gles2::TextureRef> > uncleared_textures_; | 135 std::map<int32, scoped_refptr<gpu::gles2::TextureRef> > uncleared_textures_; |
139 | 136 |
140 DISALLOW_IMPLICIT_CONSTRUCTORS(GpuVideoDecodeAccelerator); | 137 DISALLOW_IMPLICIT_CONSTRUCTORS(GpuVideoDecodeAccelerator); |
141 }; | 138 }; |
142 | 139 |
143 } // namespace content | 140 } // namespace content |
144 | 141 |
145 #endif // CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_DECODE_ACCELERATOR_H_ | 142 #endif // CONTENT_COMMON_GPU_MEDIA_GPU_VIDEO_DECODE_ACCELERATOR_H_ |
OLD | NEW |