| 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 "content/common/gpu/client/gpu_video_decode_accelerator_host.h" | 5 #include "content/common/gpu/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/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 int32_t picture_buffer_id) { | 237 int32_t picture_buffer_id) { |
| 238 DCHECK(CalledOnValidThread()); | 238 DCHECK(CalledOnValidThread()); |
| 239 if (client_) | 239 if (client_) |
| 240 client_->DismissPictureBuffer(picture_buffer_id); | 240 client_->DismissPictureBuffer(picture_buffer_id); |
| 241 } | 241 } |
| 242 | 242 |
| 243 void GpuVideoDecodeAcceleratorHost::OnPictureReady( | 243 void GpuVideoDecodeAcceleratorHost::OnPictureReady( |
| 244 int32_t picture_buffer_id, | 244 int32_t picture_buffer_id, |
| 245 int32_t bitstream_buffer_id, | 245 int32_t bitstream_buffer_id, |
| 246 const gfx::Rect& visible_rect, | 246 const gfx::Rect& visible_rect, |
| 247 bool allow_overlay) { | 247 bool allow_overlay, |
| 248 bool size_changed) { |
| 248 DCHECK(CalledOnValidThread()); | 249 DCHECK(CalledOnValidThread()); |
| 249 if (!client_) | 250 if (!client_) |
| 250 return; | 251 return; |
| 251 media::Picture picture(picture_buffer_id, bitstream_buffer_id, visible_rect, | 252 media::Picture picture(picture_buffer_id, bitstream_buffer_id, visible_rect, |
| 252 allow_overlay); | 253 allow_overlay); |
| 254 picture.set_size_changed(size_changed); |
| 253 client_->PictureReady(picture); | 255 client_->PictureReady(picture); |
| 254 } | 256 } |
| 255 | 257 |
| 256 void GpuVideoDecodeAcceleratorHost::OnFlushDone() { | 258 void GpuVideoDecodeAcceleratorHost::OnFlushDone() { |
| 257 DCHECK(CalledOnValidThread()); | 259 DCHECK(CalledOnValidThread()); |
| 258 if (client_) | 260 if (client_) |
| 259 client_->NotifyFlushDone(); | 261 client_->NotifyFlushDone(); |
| 260 } | 262 } |
| 261 | 263 |
| 262 void GpuVideoDecodeAcceleratorHost::OnResetDone() { | 264 void GpuVideoDecodeAcceleratorHost::OnResetDone() { |
| 263 DCHECK(CalledOnValidThread()); | 265 DCHECK(CalledOnValidThread()); |
| 264 if (client_) | 266 if (client_) |
| 265 client_->NotifyResetDone(); | 267 client_->NotifyResetDone(); |
| 266 } | 268 } |
| 267 | 269 |
| 268 void GpuVideoDecodeAcceleratorHost::OnNotifyError(uint32_t error) { | 270 void GpuVideoDecodeAcceleratorHost::OnNotifyError(uint32_t error) { |
| 269 DCHECK(CalledOnValidThread()); | 271 DCHECK(CalledOnValidThread()); |
| 270 if (!client_) | 272 if (!client_) |
| 271 return; | 273 return; |
| 272 weak_this_factory_.InvalidateWeakPtrs(); | 274 weak_this_factory_.InvalidateWeakPtrs(); |
| 273 | 275 |
| 274 // Client::NotifyError() may Destroy() |this|, so calling it needs to be the | 276 // Client::NotifyError() may Destroy() |this|, so calling it needs to be the |
| 275 // last thing done on this stack! | 277 // last thing done on this stack! |
| 276 media::VideoDecodeAccelerator::Client* client = NULL; | 278 media::VideoDecodeAccelerator::Client* client = NULL; |
| 277 std::swap(client, client_); | 279 std::swap(client, client_); |
| 278 client->NotifyError(static_cast<media::VideoDecodeAccelerator::Error>(error)); | 280 client->NotifyError(static_cast<media::VideoDecodeAccelerator::Error>(error)); |
| 279 } | 281 } |
| 280 | 282 |
| 281 } // namespace content | 283 } // namespace content |
| OLD | NEW |