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