| 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 "content/common/gpu/client/gpu_channel_host.h" | 10 #include "content/common/gpu/client/gpu_channel_host.h" |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 void GpuVideoDecodeAcceleratorHost::OnDismissPictureBuffer( | 226 void GpuVideoDecodeAcceleratorHost::OnDismissPictureBuffer( |
| 227 int32 picture_buffer_id) { | 227 int32 picture_buffer_id) { |
| 228 DCHECK(CalledOnValidThread()); | 228 DCHECK(CalledOnValidThread()); |
| 229 if (client_) | 229 if (client_) |
| 230 client_->DismissPictureBuffer(picture_buffer_id); | 230 client_->DismissPictureBuffer(picture_buffer_id); |
| 231 } | 231 } |
| 232 | 232 |
| 233 void GpuVideoDecodeAcceleratorHost::OnPictureReady( | 233 void GpuVideoDecodeAcceleratorHost::OnPictureReady( |
| 234 int32 picture_buffer_id, | 234 int32 picture_buffer_id, |
| 235 int32 bitstream_buffer_id, | 235 int32 bitstream_buffer_id, |
| 236 const gfx::Rect& visible_rect) { | 236 const gfx::Rect& visible_rect, |
| 237 bool allow_overlay) { |
| 237 DCHECK(CalledOnValidThread()); | 238 DCHECK(CalledOnValidThread()); |
| 238 if (!client_) | 239 if (!client_) |
| 239 return; | 240 return; |
| 240 media::Picture picture(picture_buffer_id, bitstream_buffer_id, visible_rect); | 241 media::Picture picture(picture_buffer_id, bitstream_buffer_id, visible_rect); |
| 242 picture.set_allow_overlay(allow_overlay); |
| 241 client_->PictureReady(picture); | 243 client_->PictureReady(picture); |
| 242 } | 244 } |
| 243 | 245 |
| 244 void GpuVideoDecodeAcceleratorHost::OnFlushDone() { | 246 void GpuVideoDecodeAcceleratorHost::OnFlushDone() { |
| 245 DCHECK(CalledOnValidThread()); | 247 DCHECK(CalledOnValidThread()); |
| 246 if (client_) | 248 if (client_) |
| 247 client_->NotifyFlushDone(); | 249 client_->NotifyFlushDone(); |
| 248 } | 250 } |
| 249 | 251 |
| 250 void GpuVideoDecodeAcceleratorHost::OnResetDone() { | 252 void GpuVideoDecodeAcceleratorHost::OnResetDone() { |
| 251 DCHECK(CalledOnValidThread()); | 253 DCHECK(CalledOnValidThread()); |
| 252 if (client_) | 254 if (client_) |
| 253 client_->NotifyResetDone(); | 255 client_->NotifyResetDone(); |
| 254 } | 256 } |
| 255 | 257 |
| 256 void GpuVideoDecodeAcceleratorHost::OnNotifyError(uint32 error) { | 258 void GpuVideoDecodeAcceleratorHost::OnNotifyError(uint32 error) { |
| 257 DCHECK(CalledOnValidThread()); | 259 DCHECK(CalledOnValidThread()); |
| 258 if (!client_) | 260 if (!client_) |
| 259 return; | 261 return; |
| 260 weak_this_factory_.InvalidateWeakPtrs(); | 262 weak_this_factory_.InvalidateWeakPtrs(); |
| 261 | 263 |
| 262 // Client::NotifyError() may Destroy() |this|, so calling it needs to be the | 264 // Client::NotifyError() may Destroy() |this|, so calling it needs to be the |
| 263 // last thing done on this stack! | 265 // last thing done on this stack! |
| 264 media::VideoDecodeAccelerator::Client* client = NULL; | 266 media::VideoDecodeAccelerator::Client* client = NULL; |
| 265 std::swap(client, client_); | 267 std::swap(client, client_); |
| 266 client->NotifyError(static_cast<media::VideoDecodeAccelerator::Error>(error)); | 268 client->NotifyError(static_cast<media::VideoDecodeAccelerator::Error>(error)); |
| 267 } | 269 } |
| 268 | 270 |
| 269 } // namespace content | 271 } // namespace content |
| OLD | NEW |