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, |
214 uint32_t textures_per_buffer, | 215 uint32_t textures_per_buffer, |
215 const gfx::Size& dimensions, | 216 const gfx::Size& dimensions, |
216 uint32_t texture_target) { | 217 uint32_t texture_target) { |
217 DCHECK(CalledOnValidThread()); | 218 DCHECK(CalledOnValidThread()); |
218 picture_buffer_dimensions_ = dimensions; | 219 picture_buffer_dimensions_ = dimensions; |
219 | 220 |
220 const int kMaxVideoPlanes = 4; | 221 const int kMaxVideoPlanes = 4; |
221 if (textures_per_buffer > kMaxVideoPlanes) { | 222 if (textures_per_buffer > kMaxVideoPlanes) { |
222 PostNotifyError(PLATFORM_FAILURE); | 223 PostNotifyError(PLATFORM_FAILURE); |
223 return; | 224 return; |
224 } | 225 } |
225 | 226 |
226 if (client_) { | 227 if (client_) { |
227 client_->ProvidePictureBuffers(num_requested_buffers, textures_per_buffer, | 228 client_->ProvidePictureBuffers(num_requested_buffers, format, |
228 dimensions, texture_target); | 229 textures_per_buffer, dimensions, |
| 230 texture_target); |
229 } | 231 } |
230 } | 232 } |
231 | 233 |
232 void GpuVideoDecodeAcceleratorHost::OnDismissPictureBuffer( | 234 void GpuVideoDecodeAcceleratorHost::OnDismissPictureBuffer( |
233 int32_t picture_buffer_id) { | 235 int32_t picture_buffer_id) { |
234 DCHECK(CalledOnValidThread()); | 236 DCHECK(CalledOnValidThread()); |
235 if (client_) | 237 if (client_) |
236 client_->DismissPictureBuffer(picture_buffer_id); | 238 client_->DismissPictureBuffer(picture_buffer_id); |
237 } | 239 } |
238 | 240 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 weak_this_factory_.InvalidateWeakPtrs(); | 272 weak_this_factory_.InvalidateWeakPtrs(); |
271 | 273 |
272 // Client::NotifyError() may Destroy() |this|, so calling it needs to be the | 274 // Client::NotifyError() may Destroy() |this|, so calling it needs to be the |
273 // last thing done on this stack! | 275 // last thing done on this stack! |
274 VideoDecodeAccelerator::Client* client = NULL; | 276 VideoDecodeAccelerator::Client* client = NULL; |
275 std::swap(client, client_); | 277 std::swap(client, client_); |
276 client->NotifyError(static_cast<VideoDecodeAccelerator::Error>(error)); | 278 client->NotifyError(static_cast<VideoDecodeAccelerator::Error>(error)); |
277 } | 279 } |
278 | 280 |
279 } // namespace media | 281 } // namespace media |
OLD | NEW |