OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/common/gpu/gpu_video_decode_accelerator.h" | 5 #include "content/common/gpu/gpu_video_decode_accelerator.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 } | 101 } |
102 | 102 |
103 void GpuVideoDecodeAccelerator::OnGetConfigs( | 103 void GpuVideoDecodeAccelerator::OnGetConfigs( |
104 const std::vector<uint32>& requested, std::vector<uint32>* matched) { | 104 const std::vector<uint32>& requested, std::vector<uint32>* matched) { |
105 // TODO(vrk): Need to rethink GetConfigs. | 105 // TODO(vrk): Need to rethink GetConfigs. |
106 NOTIMPLEMENTED(); | 106 NOTIMPLEMENTED(); |
107 } | 107 } |
108 | 108 |
109 void GpuVideoDecodeAccelerator::OnInitialize( | 109 void GpuVideoDecodeAccelerator::OnInitialize( |
110 const std::vector<uint32>& configs) { | 110 const std::vector<uint32>& configs) { |
111 if (!video_decode_accelerator_.get()) | 111 if (!video_decode_accelerator_) |
112 return; | 112 return; |
113 | 113 |
114 video_decode_accelerator_->Initialize(configs); | 114 video_decode_accelerator_->Initialize(configs); |
115 } | 115 } |
116 | 116 |
117 void GpuVideoDecodeAccelerator::OnDecode(int32 id, | 117 void GpuVideoDecodeAccelerator::OnDecode(int32 id, |
118 base::SharedMemoryHandle handle, | 118 base::SharedMemoryHandle handle, |
119 int32 size) { | 119 int32 size) { |
120 if (!video_decode_accelerator_.get()) | 120 if (!video_decode_accelerator_) |
121 return; | 121 return; |
122 video_decode_accelerator_->Decode(media::BitstreamBuffer(id, handle, size)); | 122 video_decode_accelerator_->Decode(media::BitstreamBuffer(id, handle, size)); |
123 } | 123 } |
124 | 124 |
125 void GpuVideoDecodeAccelerator::OnAssignGLESBuffers( | 125 void GpuVideoDecodeAccelerator::OnAssignGLESBuffers( |
126 const std::vector<int32> buffer_ids, | 126 const std::vector<int32> buffer_ids, |
127 const std::vector<uint32> texture_ids, | 127 const std::vector<uint32> texture_ids, |
128 const std::vector<uint32> context_ids, | 128 const std::vector<uint32> context_ids, |
129 const std::vector<gfx::Size> sizes) { | 129 const std::vector<gfx::Size> sizes) { |
130 // TODO(vrk): Implement. | 130 // TODO(vrk): Implement. |
131 NOTIMPLEMENTED(); | 131 NOTIMPLEMENTED(); |
132 } | 132 } |
133 | 133 |
134 void GpuVideoDecodeAccelerator::OnAssignSysmemBuffers( | 134 void GpuVideoDecodeAccelerator::OnAssignSysmemBuffers( |
135 const std::vector<int32> buffer_ids, | 135 const std::vector<int32> buffer_ids, |
136 const std::vector<base::SharedMemoryHandle> data, | 136 const std::vector<base::SharedMemoryHandle> data, |
137 const std::vector<gfx::Size> sizes) { | 137 const std::vector<gfx::Size> sizes) { |
138 // TODO(vrk): Implement. | 138 // TODO(vrk): Implement. |
139 NOTIMPLEMENTED(); | 139 NOTIMPLEMENTED(); |
140 } | 140 } |
141 | 141 |
142 void GpuVideoDecodeAccelerator::OnReusePictureBuffer(int32 picture_buffer_id) { | 142 void GpuVideoDecodeAccelerator::OnReusePictureBuffer(int32 picture_buffer_id) { |
143 if (!video_decode_accelerator_.get()) | 143 if (!video_decode_accelerator_) |
144 return; | 144 return; |
145 | 145 |
146 video_decode_accelerator_->ReusePictureBuffer(picture_buffer_id); | 146 video_decode_accelerator_->ReusePictureBuffer(picture_buffer_id); |
147 } | 147 } |
148 | 148 |
149 void GpuVideoDecodeAccelerator::OnFlush() { | 149 void GpuVideoDecodeAccelerator::OnFlush() { |
150 if (!video_decode_accelerator_.get()) | 150 if (!video_decode_accelerator_) |
151 return; | 151 return; |
152 | 152 |
153 if (!video_decode_accelerator_->Flush()) { | 153 if (!video_decode_accelerator_->Flush()) { |
154 NotifyError( | 154 NotifyError( |
155 media::VideoDecodeAccelerator::VIDEODECODERERROR_UNEXPECTED_FLUSH); | 155 media::VideoDecodeAccelerator::VIDEODECODERERROR_UNEXPECTED_FLUSH); |
156 } | 156 } |
157 } | 157 } |
158 | 158 |
159 void GpuVideoDecodeAccelerator::OnAbort() { | 159 void GpuVideoDecodeAccelerator::OnAbort() { |
160 if (!video_decode_accelerator_.get()) | 160 if (!video_decode_accelerator_) |
161 return; | 161 return; |
162 | 162 |
163 video_decode_accelerator_->Abort(); | 163 video_decode_accelerator_->Abort(); |
164 } | 164 } |
165 | 165 |
166 void GpuVideoDecodeAccelerator::NotifyEndOfBitstreamBuffer( | 166 void GpuVideoDecodeAccelerator::NotifyEndOfBitstreamBuffer( |
167 int32 bitstream_buffer_id) { | 167 int32 bitstream_buffer_id) { |
168 if (!Send(new AcceleratedVideoDecoderHostMsg_BitstreamBufferProcessed( | 168 if (!Send(new AcceleratedVideoDecoderHostMsg_BitstreamBufferProcessed( |
169 route_id_, bitstream_buffer_id))) { | 169 route_id_, bitstream_buffer_id))) { |
170 DLOG(ERROR) | 170 DLOG(ERROR) |
171 << "Send(AcceleratedVideoDecoderHostMsg_BitstreamBufferProcessed) " | 171 << "Send(AcceleratedVideoDecoderHostMsg_BitstreamBufferProcessed) " |
172 << "failed"; | 172 << "failed"; |
173 } | 173 } |
174 } | 174 } |
175 | 175 |
176 void GpuVideoDecodeAccelerator::NotifyFlushDone() { | 176 void GpuVideoDecodeAccelerator::NotifyFlushDone() { |
177 if (!Send(new AcceleratedVideoDecoderHostMsg_FlushDone(route_id_))) | 177 if (!Send(new AcceleratedVideoDecoderHostMsg_FlushDone(route_id_))) |
178 LOG(ERROR) << "Send(AcceleratedVideoDecoderHostMsg_FlushDone) failed"; | 178 LOG(ERROR) << "Send(AcceleratedVideoDecoderHostMsg_FlushDone) failed"; |
179 } | 179 } |
180 | 180 |
181 void GpuVideoDecodeAccelerator::NotifyAbortDone() { | 181 void GpuVideoDecodeAccelerator::NotifyAbortDone() { |
182 if (!Send(new AcceleratedVideoDecoderHostMsg_AbortDone(route_id_))) | 182 if (!Send(new AcceleratedVideoDecoderHostMsg_AbortDone(route_id_))) |
183 LOG(ERROR) << "Send(AcceleratedVideoDecoderHostMsg_AbortDone) failed"; | 183 LOG(ERROR) << "Send(AcceleratedVideoDecoderHostMsg_AbortDone) failed"; |
184 } | 184 } |
185 | 185 |
186 bool GpuVideoDecodeAccelerator::Send(IPC::Message* message) { | 186 bool GpuVideoDecodeAccelerator::Send(IPC::Message* message) { |
187 DCHECK(sender_); | 187 DCHECK(sender_); |
188 return sender_->Send(message); | 188 return sender_->Send(message); |
189 } | 189 } |
OLD | NEW |