| 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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 } | 223 } |
| 224 } | 224 } |
| 225 | 225 |
| 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(int32 picture_buffer_id, |
| 234 int32 picture_buffer_id, int32 bitstream_buffer_id) { | 234 int32 bitstream_buffer_id, |
| 235 const gfx::Size& size) { |
| 235 DCHECK(CalledOnValidThread()); | 236 DCHECK(CalledOnValidThread()); |
| 236 if (!client_) | 237 if (!client_) |
| 237 return; | 238 return; |
| 238 media::Picture picture(picture_buffer_id, bitstream_buffer_id); | 239 media::Picture picture(picture_buffer_id, bitstream_buffer_id, size); |
| 239 client_->PictureReady(picture); | 240 client_->PictureReady(picture); |
| 240 } | 241 } |
| 241 | 242 |
| 242 void GpuVideoDecodeAcceleratorHost::OnFlushDone() { | 243 void GpuVideoDecodeAcceleratorHost::OnFlushDone() { |
| 243 DCHECK(CalledOnValidThread()); | 244 DCHECK(CalledOnValidThread()); |
| 244 if (client_) | 245 if (client_) |
| 245 client_->NotifyFlushDone(); | 246 client_->NotifyFlushDone(); |
| 246 } | 247 } |
| 247 | 248 |
| 248 void GpuVideoDecodeAcceleratorHost::OnResetDone() { | 249 void GpuVideoDecodeAcceleratorHost::OnResetDone() { |
| 249 DCHECK(CalledOnValidThread()); | 250 DCHECK(CalledOnValidThread()); |
| 250 if (client_) | 251 if (client_) |
| 251 client_->NotifyResetDone(); | 252 client_->NotifyResetDone(); |
| 252 } | 253 } |
| 253 | 254 |
| 254 void GpuVideoDecodeAcceleratorHost::OnNotifyError(uint32 error) { | 255 void GpuVideoDecodeAcceleratorHost::OnNotifyError(uint32 error) { |
| 255 DCHECK(CalledOnValidThread()); | 256 DCHECK(CalledOnValidThread()); |
| 256 if (!client_) | 257 if (!client_) |
| 257 return; | 258 return; |
| 258 weak_this_factory_.InvalidateWeakPtrs(); | 259 weak_this_factory_.InvalidateWeakPtrs(); |
| 259 | 260 |
| 260 // Client::NotifyError() may Destroy() |this|, so calling it needs to be the | 261 // Client::NotifyError() may Destroy() |this|, so calling it needs to be the |
| 261 // last thing done on this stack! | 262 // last thing done on this stack! |
| 262 media::VideoDecodeAccelerator::Client* client = NULL; | 263 media::VideoDecodeAccelerator::Client* client = NULL; |
| 263 std::swap(client, client_); | 264 std::swap(client, client_); |
| 264 client->NotifyError(static_cast<media::VideoDecodeAccelerator::Error>(error)); | 265 client->NotifyError(static_cast<media::VideoDecodeAccelerator::Error>(error)); |
| 265 } | 266 } |
| 266 | 267 |
| 267 } // namespace content | 268 } // namespace content |
| OLD | NEW |