| 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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 } | 210 } |
| 211 | 211 |
| 212 void GpuVideoDecodeAcceleratorHost::OnBitstreamBufferProcessed( | 212 void GpuVideoDecodeAcceleratorHost::OnBitstreamBufferProcessed( |
| 213 int32_t bitstream_buffer_id) { | 213 int32_t bitstream_buffer_id) { |
| 214 DCHECK(CalledOnValidThread()); | 214 DCHECK(CalledOnValidThread()); |
| 215 if (client_) | 215 if (client_) |
| 216 client_->NotifyEndOfBitstreamBuffer(bitstream_buffer_id); | 216 client_->NotifyEndOfBitstreamBuffer(bitstream_buffer_id); |
| 217 } | 217 } |
| 218 | 218 |
| 219 void GpuVideoDecodeAcceleratorHost::OnProvidePictureBuffer( | 219 void GpuVideoDecodeAcceleratorHost::OnProvidePictureBuffer( |
| 220 VideoPixelFormat format, |
| 220 uint32_t num_requested_buffers, | 221 uint32_t num_requested_buffers, |
| 221 uint32_t textures_per_buffer, | 222 uint32_t textures_per_buffer, |
| 222 const gfx::Size& dimensions, | 223 const gfx::Size& dimensions, |
| 223 uint32_t texture_target) { | 224 uint32_t texture_target) { |
| 224 DCHECK(CalledOnValidThread()); | 225 DCHECK(CalledOnValidThread()); |
| 225 picture_buffer_dimensions_ = dimensions; | 226 picture_buffer_dimensions_ = dimensions; |
| 226 | 227 |
| 227 const int kMaxVideoPlanes = 4; | 228 const int kMaxVideoPlanes = 4; |
| 228 if (textures_per_buffer > kMaxVideoPlanes) { | 229 if (textures_per_buffer > kMaxVideoPlanes) { |
| 229 PostNotifyError(PLATFORM_FAILURE); | 230 PostNotifyError(PLATFORM_FAILURE); |
| 230 return; | 231 return; |
| 231 } | 232 } |
| 232 | 233 |
| 233 if (client_) { | 234 if (client_) { |
| 234 client_->ProvidePictureBuffers(num_requested_buffers, textures_per_buffer, | 235 client_->ProvidePictureBuffers(num_requested_buffers, format, |
| 235 dimensions, texture_target); | 236 textures_per_buffer, dimensions, |
| 237 texture_target); |
| 236 } | 238 } |
| 237 } | 239 } |
| 238 | 240 |
| 239 void GpuVideoDecodeAcceleratorHost::OnDismissPictureBuffer( | 241 void GpuVideoDecodeAcceleratorHost::OnDismissPictureBuffer( |
| 240 int32_t picture_buffer_id) { | 242 int32_t picture_buffer_id) { |
| 241 DCHECK(CalledOnValidThread()); | 243 DCHECK(CalledOnValidThread()); |
| 242 if (client_) | 244 if (client_) |
| 243 client_->DismissPictureBuffer(picture_buffer_id); | 245 client_->DismissPictureBuffer(picture_buffer_id); |
| 244 } | 246 } |
| 245 | 247 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 weak_this_factory_.InvalidateWeakPtrs(); | 279 weak_this_factory_.InvalidateWeakPtrs(); |
| 278 | 280 |
| 279 // Client::NotifyError() may Destroy() |this|, so calling it needs to be the | 281 // Client::NotifyError() may Destroy() |this|, so calling it needs to be the |
| 280 // last thing done on this stack! | 282 // last thing done on this stack! |
| 281 VideoDecodeAccelerator::Client* client = NULL; | 283 VideoDecodeAccelerator::Client* client = NULL; |
| 282 std::swap(client, client_); | 284 std::swap(client, client_); |
| 283 client->NotifyError(static_cast<VideoDecodeAccelerator::Error>(error)); | 285 client->NotifyError(static_cast<VideoDecodeAccelerator::Error>(error)); |
| 284 } | 286 } |
| 285 | 287 |
| 286 } // namespace media | 288 } // namespace media |
| OLD | NEW |