| 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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 } | 232 } |
| 233 | 233 |
| 234 void GpuVideoDecodeAcceleratorHost::OnDismissPictureBuffer( | 234 void GpuVideoDecodeAcceleratorHost::OnDismissPictureBuffer( |
| 235 int32_t picture_buffer_id) { | 235 int32_t picture_buffer_id) { |
| 236 DCHECK(CalledOnValidThread()); | 236 DCHECK(CalledOnValidThread()); |
| 237 if (client_) | 237 if (client_) |
| 238 client_->DismissPictureBuffer(picture_buffer_id); | 238 client_->DismissPictureBuffer(picture_buffer_id); |
| 239 } | 239 } |
| 240 | 240 |
| 241 void GpuVideoDecodeAcceleratorHost::OnPictureReady( | 241 void GpuVideoDecodeAcceleratorHost::OnPictureReady( |
| 242 const AcceleratedVideoDecoderHostMsg_PictureReady_Params& params) { | 242 int32_t picture_buffer_id, |
| 243 int32_t bitstream_buffer_id, |
| 244 const gfx::Rect& visible_rect, |
| 245 bool allow_overlay, |
| 246 bool size_changed) { |
| 243 DCHECK(CalledOnValidThread()); | 247 DCHECK(CalledOnValidThread()); |
| 244 if (!client_) | 248 if (!client_) |
| 245 return; | 249 return; |
| 246 Picture picture(params.picture_buffer_id, params.bitstream_buffer_id, | 250 Picture picture(picture_buffer_id, bitstream_buffer_id, visible_rect, |
| 247 params.visible_rect, params.color_space, | 251 allow_overlay); |
| 248 params.allow_overlay); | 252 picture.set_size_changed(size_changed); |
| 249 picture.set_size_changed(params.size_changed); | |
| 250 client_->PictureReady(picture); | 253 client_->PictureReady(picture); |
| 251 } | 254 } |
| 252 | 255 |
| 253 void GpuVideoDecodeAcceleratorHost::OnFlushDone() { | 256 void GpuVideoDecodeAcceleratorHost::OnFlushDone() { |
| 254 DCHECK(CalledOnValidThread()); | 257 DCHECK(CalledOnValidThread()); |
| 255 if (client_) | 258 if (client_) |
| 256 client_->NotifyFlushDone(); | 259 client_->NotifyFlushDone(); |
| 257 } | 260 } |
| 258 | 261 |
| 259 void GpuVideoDecodeAcceleratorHost::OnResetDone() { | 262 void GpuVideoDecodeAcceleratorHost::OnResetDone() { |
| 260 DCHECK(CalledOnValidThread()); | 263 DCHECK(CalledOnValidThread()); |
| 261 if (client_) | 264 if (client_) |
| 262 client_->NotifyResetDone(); | 265 client_->NotifyResetDone(); |
| 263 } | 266 } |
| 264 | 267 |
| 265 void GpuVideoDecodeAcceleratorHost::OnNotifyError(uint32_t error) { | 268 void GpuVideoDecodeAcceleratorHost::OnNotifyError(uint32_t error) { |
| 266 DCHECK(CalledOnValidThread()); | 269 DCHECK(CalledOnValidThread()); |
| 267 if (!client_) | 270 if (!client_) |
| 268 return; | 271 return; |
| 269 weak_this_factory_.InvalidateWeakPtrs(); | 272 weak_this_factory_.InvalidateWeakPtrs(); |
| 270 | 273 |
| 271 // 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 |
| 272 // last thing done on this stack! | 275 // last thing done on this stack! |
| 273 VideoDecodeAccelerator::Client* client = NULL; | 276 VideoDecodeAccelerator::Client* client = NULL; |
| 274 std::swap(client, client_); | 277 std::swap(client, client_); |
| 275 client->NotifyError(static_cast<VideoDecodeAccelerator::Error>(error)); | 278 client->NotifyError(static_cast<VideoDecodeAccelerator::Error>(error)); |
| 276 } | 279 } |
| 277 | 280 |
| 278 } // namespace media | 281 } // namespace media |
| OLD | NEW |