Chromium Code Reviews| 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/filters/gpu_video_decoder.h" | 5 #include "media/filters/gpu_video_decoder.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
| (...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 415 | 415 |
| 416 PictureBufferMap::iterator it = | 416 PictureBufferMap::iterator it = |
| 417 assigned_picture_buffers_.find(picture.picture_buffer_id()); | 417 assigned_picture_buffers_.find(picture.picture_buffer_id()); |
| 418 if (it == assigned_picture_buffers_.end()) { | 418 if (it == assigned_picture_buffers_.end()) { |
| 419 NOTREACHED() << "Missing picture buffer: " << picture.picture_buffer_id(); | 419 NOTREACHED() << "Missing picture buffer: " << picture.picture_buffer_id(); |
| 420 NotifyError(VideoDecodeAccelerator::PLATFORM_FAILURE); | 420 NotifyError(VideoDecodeAccelerator::PLATFORM_FAILURE); |
| 421 return; | 421 return; |
| 422 } | 422 } |
| 423 const PictureBuffer& pb = it->second; | 423 const PictureBuffer& pb = it->second; |
| 424 | 424 |
| 425 // Validate picture size from GPU | |
| 426 if (picture.size().IsEmpty() || | |
| 427 !gfx::Rect(pb.size()).Contains(gfx::Rect(picture.size()))) { | |
| 428 LOG(ERROR) << "Invalid picture size from VDA: " << picture.size().ToString() | |
|
ddorwin
2014/08/18 16:26:38
Do we need this string in opt builds?
kcwu
2014/08/18 17:33:06
Done.
| |
| 429 << " should fit in " << pb.size().ToString(); | |
| 430 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); | |
| 431 return; | |
| 432 } | |
| 433 | |
| 425 // Update frame's timestamp. | 434 // Update frame's timestamp. |
| 426 base::TimeDelta timestamp; | 435 base::TimeDelta timestamp; |
| 436 // Some of the VDAs don't support and thus don't provide us with visible | |
|
ddorwin
2014/08/18 16:26:38
Does this comment mean we are handling such VDAs d
kcwu
2014/08/18 17:33:06
Always doing this. The other consideration is GpuV
| |
| 437 // size in picture.size, passing coded size instead, so drop it and use | |
| 438 // config information instead. | |
| 427 gfx::Rect visible_rect; | 439 gfx::Rect visible_rect; |
| 428 gfx::Size natural_size; | 440 gfx::Size natural_size; |
| 429 GetBufferData(picture.bitstream_buffer_id(), ×tamp, &visible_rect, | 441 GetBufferData(picture.bitstream_buffer_id(), ×tamp, &visible_rect, |
| 430 &natural_size); | 442 &natural_size); |
| 431 DCHECK(decoder_texture_target_); | 443 DCHECK(decoder_texture_target_); |
| 432 | 444 |
| 433 scoped_refptr<VideoFrame> frame(VideoFrame::WrapNativeTexture( | 445 scoped_refptr<VideoFrame> frame(VideoFrame::WrapNativeTexture( |
| 434 make_scoped_ptr(new gpu::MailboxHolder( | 446 make_scoped_ptr(new gpu::MailboxHolder( |
| 435 pb.texture_mailbox(), decoder_texture_target_, 0 /* sync_point */)), | 447 pb.texture_mailbox(), decoder_texture_target_, 0 /* sync_point */)), |
| 436 BindToCurrentLoop(base::Bind(&GpuVideoDecoder::ReleaseMailbox, | 448 BindToCurrentLoop(base::Bind(&GpuVideoDecoder::ReleaseMailbox, |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 602 DLOG(ERROR) << "VDA Error: " << error; | 614 DLOG(ERROR) << "VDA Error: " << error; |
| 603 DestroyVDA(); | 615 DestroyVDA(); |
| 604 } | 616 } |
| 605 | 617 |
| 606 void GpuVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() | 618 void GpuVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() |
| 607 const { | 619 const { |
| 608 DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread()); | 620 DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread()); |
| 609 } | 621 } |
| 610 | 622 |
| 611 } // namespace media | 623 } // namespace media |
| OLD | NEW |