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 #include "media/gpu/ipc/client/gpu_video_decode_accelerator_host.h" | 5 #include "media/gpu/ipc/client/gpu_video_decode_accelerator_host.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 | 204 |
205 void GpuVideoDecodeAcceleratorHost::OnBitstreamBufferProcessed( | 205 void GpuVideoDecodeAcceleratorHost::OnBitstreamBufferProcessed( |
206 int32_t bitstream_buffer_id) { | 206 int32_t bitstream_buffer_id) { |
207 DCHECK(CalledOnValidThread()); | 207 DCHECK(CalledOnValidThread()); |
208 if (client_) | 208 if (client_) |
209 client_->NotifyEndOfBitstreamBuffer(bitstream_buffer_id); | 209 client_->NotifyEndOfBitstreamBuffer(bitstream_buffer_id); |
210 } | 210 } |
211 | 211 |
212 void GpuVideoDecodeAcceleratorHost::OnProvidePictureBuffer( | 212 void GpuVideoDecodeAcceleratorHost::OnProvidePictureBuffer( |
213 uint32_t num_requested_buffers, | 213 uint32_t num_requested_buffers, |
214 VideoPixelFormat format, | |
215 uint32_t textures_per_buffer, | 214 uint32_t textures_per_buffer, |
216 const gfx::Size& dimensions, | 215 const gfx::Size& dimensions, |
217 uint32_t texture_target) { | 216 uint32_t texture_target) { |
218 DCHECK(CalledOnValidThread()); | 217 DCHECK(CalledOnValidThread()); |
219 picture_buffer_dimensions_ = dimensions; | 218 picture_buffer_dimensions_ = dimensions; |
220 | 219 |
221 const int kMaxVideoPlanes = 4; | 220 const int kMaxVideoPlanes = 4; |
222 if (textures_per_buffer > kMaxVideoPlanes) { | 221 if (textures_per_buffer > kMaxVideoPlanes) { |
223 PostNotifyError(PLATFORM_FAILURE); | 222 PostNotifyError(PLATFORM_FAILURE); |
224 return; | 223 return; |
225 } | 224 } |
226 | 225 |
227 if (client_) { | 226 if (client_) { |
228 client_->ProvidePictureBuffers(num_requested_buffers, format, | 227 client_->ProvidePictureBuffers(num_requested_buffers, textures_per_buffer, |
229 textures_per_buffer, dimensions, | 228 dimensions, texture_target); |
230 texture_target); | |
231 } | 229 } |
232 } | 230 } |
233 | 231 |
234 void GpuVideoDecodeAcceleratorHost::OnDismissPictureBuffer( | 232 void GpuVideoDecodeAcceleratorHost::OnDismissPictureBuffer( |
235 int32_t picture_buffer_id) { | 233 int32_t picture_buffer_id) { |
236 DCHECK(CalledOnValidThread()); | 234 DCHECK(CalledOnValidThread()); |
237 if (client_) | 235 if (client_) |
238 client_->DismissPictureBuffer(picture_buffer_id); | 236 client_->DismissPictureBuffer(picture_buffer_id); |
239 } | 237 } |
240 | 238 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 weak_this_factory_.InvalidateWeakPtrs(); | 270 weak_this_factory_.InvalidateWeakPtrs(); |
273 | 271 |
274 // Client::NotifyError() may Destroy() |this|, so calling it needs to be the | 272 // Client::NotifyError() may Destroy() |this|, so calling it needs to be the |
275 // last thing done on this stack! | 273 // last thing done on this stack! |
276 VideoDecodeAccelerator::Client* client = NULL; | 274 VideoDecodeAccelerator::Client* client = NULL; |
277 std::swap(client, client_); | 275 std::swap(client, client_); |
278 client->NotifyError(static_cast<VideoDecodeAccelerator::Error>(error)); | 276 client->NotifyError(static_cast<VideoDecodeAccelerator::Error>(error)); |
279 } | 277 } |
280 | 278 |
281 } // namespace media | 279 } // namespace media |
OLD | NEW |