| 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 rectangle from GPU. This is for sanity/security check | |
| 426 // even the rectangle is not used in this class. | |
| 427 if (picture.visible_rect().IsEmpty() || | |
| 428 !gfx::Rect(pb.size()).Contains(picture.visible_rect())) { | |
| 429 NOTREACHED() << "Invalid picture size from VDA: " | |
| 430 << picture.visible_rect().ToString() << " should fit in " | |
| 431 << pb.size().ToString(); | |
| 432 NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); | |
| 433 return; | |
| 434 } | |
| 435 | |
| 436 // Update frame's timestamp. | 425 // Update frame's timestamp. |
| 437 base::TimeDelta timestamp; | 426 base::TimeDelta timestamp; |
| 438 // Some of the VDAs don't support and thus don't provide us with visible | |
| 439 // size in picture.size, passing coded size instead, so always drop it and | |
| 440 // use config information instead. | |
| 441 gfx::Rect visible_rect; | 427 gfx::Rect visible_rect; |
| 442 gfx::Size natural_size; | 428 gfx::Size natural_size; |
| 443 GetBufferData(picture.bitstream_buffer_id(), ×tamp, &visible_rect, | 429 GetBufferData(picture.bitstream_buffer_id(), ×tamp, &visible_rect, |
| 444 &natural_size); | 430 &natural_size); |
| 445 DCHECK(decoder_texture_target_); | 431 DCHECK(decoder_texture_target_); |
| 446 | 432 |
| 447 scoped_refptr<VideoFrame> frame(VideoFrame::WrapNativeTexture( | 433 scoped_refptr<VideoFrame> frame(VideoFrame::WrapNativeTexture( |
| 448 make_scoped_ptr(new gpu::MailboxHolder( | 434 make_scoped_ptr(new gpu::MailboxHolder( |
| 449 pb.texture_mailbox(), decoder_texture_target_, 0 /* sync_point */)), | 435 pb.texture_mailbox(), decoder_texture_target_, 0 /* sync_point */)), |
| 450 BindToCurrentLoop(base::Bind(&GpuVideoDecoder::ReleaseMailbox, | 436 BindToCurrentLoop(base::Bind(&GpuVideoDecoder::ReleaseMailbox, |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 616 DLOG(ERROR) << "VDA Error: " << error; | 602 DLOG(ERROR) << "VDA Error: " << error; |
| 617 DestroyVDA(); | 603 DestroyVDA(); |
| 618 } | 604 } |
| 619 | 605 |
| 620 void GpuVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() | 606 void GpuVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() |
| 621 const { | 607 const { |
| 622 DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread()); | 608 DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread()); |
| 623 } | 609 } |
| 624 | 610 |
| 625 } // namespace media | 611 } // namespace media |
| OLD | NEW |