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 int32_t picture_buffer_id, | 242 const AcceleratedVideoDecoderHostMsg_PictureReady_Params& params) { |
243 int32_t bitstream_buffer_id, | |
244 const gfx::Rect& visible_rect, | |
245 bool allow_overlay, | |
246 bool size_changed) { | |
247 DCHECK(CalledOnValidThread()); | 243 DCHECK(CalledOnValidThread()); |
248 if (!client_) | 244 if (!client_) |
249 return; | 245 return; |
250 Picture picture(picture_buffer_id, bitstream_buffer_id, visible_rect, | 246 Picture picture(params.picture_buffer_id, params.bitstream_buffer_id, |
251 allow_overlay); | 247 params.visible_rect, params.color_space, |
252 picture.set_size_changed(size_changed); | 248 params.allow_overlay); |
| 249 picture.set_size_changed(params.size_changed); |
253 client_->PictureReady(picture); | 250 client_->PictureReady(picture); |
254 } | 251 } |
255 | 252 |
256 void GpuVideoDecodeAcceleratorHost::OnFlushDone() { | 253 void GpuVideoDecodeAcceleratorHost::OnFlushDone() { |
257 DCHECK(CalledOnValidThread()); | 254 DCHECK(CalledOnValidThread()); |
258 if (client_) | 255 if (client_) |
259 client_->NotifyFlushDone(); | 256 client_->NotifyFlushDone(); |
260 } | 257 } |
261 | 258 |
262 void GpuVideoDecodeAcceleratorHost::OnResetDone() { | 259 void GpuVideoDecodeAcceleratorHost::OnResetDone() { |
263 DCHECK(CalledOnValidThread()); | 260 DCHECK(CalledOnValidThread()); |
264 if (client_) | 261 if (client_) |
265 client_->NotifyResetDone(); | 262 client_->NotifyResetDone(); |
266 } | 263 } |
267 | 264 |
268 void GpuVideoDecodeAcceleratorHost::OnNotifyError(uint32_t error) { | 265 void GpuVideoDecodeAcceleratorHost::OnNotifyError(uint32_t error) { |
269 DCHECK(CalledOnValidThread()); | 266 DCHECK(CalledOnValidThread()); |
270 if (!client_) | 267 if (!client_) |
271 return; | 268 return; |
272 weak_this_factory_.InvalidateWeakPtrs(); | 269 weak_this_factory_.InvalidateWeakPtrs(); |
273 | 270 |
274 // Client::NotifyError() may Destroy() |this|, so calling it needs to be the | 271 // Client::NotifyError() may Destroy() |this|, so calling it needs to be the |
275 // last thing done on this stack! | 272 // last thing done on this stack! |
276 VideoDecodeAccelerator::Client* client = NULL; | 273 VideoDecodeAccelerator::Client* client = NULL; |
277 std::swap(client, client_); | 274 std::swap(client, client_); |
278 client->NotifyError(static_cast<VideoDecodeAccelerator::Error>(error)); | 275 client->NotifyError(static_cast<VideoDecodeAccelerator::Error>(error)); |
279 } | 276 } |
280 | 277 |
281 } // namespace media | 278 } // namespace media |
OLD | NEW |