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 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 466 DVLOG(3) << "PictureReady()"; | 466 DVLOG(3) << "PictureReady()"; |
| 467 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent(); | 467 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent(); |
| 468 | 468 |
| 469 PictureBufferMap::iterator it = | 469 PictureBufferMap::iterator it = |
| 470 assigned_picture_buffers_.find(picture.picture_buffer_id()); | 470 assigned_picture_buffers_.find(picture.picture_buffer_id()); |
| 471 if (it == assigned_picture_buffers_.end()) { | 471 if (it == assigned_picture_buffers_.end()) { |
| 472 DLOG(ERROR) << "Missing picture buffer: " << picture.picture_buffer_id(); | 472 DLOG(ERROR) << "Missing picture buffer: " << picture.picture_buffer_id(); |
| 473 NotifyError(VideoDecodeAccelerator::PLATFORM_FAILURE); | 473 NotifyError(VideoDecodeAccelerator::PLATFORM_FAILURE); |
| 474 return; | 474 return; |
| 475 } | 475 } |
| 476 const PictureBuffer& pb = it->second; | 476 PictureBuffer& pb = it->second; |
| 477 if (pb.size() != picture.visible_rect().size()) { | |
|
liberato (no reviews please)
2016/03/02 16:50:36
i don't think that you want to do this uncondition
chcunningham
2016/03/02 21:46:19
Ack, happy to add a flag.
In our chat earlier I t
| |
| 478 // Update the PictureBuffer size to match that of the Picture. Some VDA's | |
| 479 // (e.g. Android) will handle resolution changes internally without | |
| 480 // requesting new PictureBuffers. Sending a Picture of unmatched size is | |
| 481 // the signal that we should update the size of our PictureBuffer. | |
| 482 LOG(ERROR) << __FUNCTION__ << " Updating size of PictureBuffer[" << pb.id() | |
| 483 << "]" | |
| 484 << " from:" << pb.size().ToString() | |
| 485 << " to:" << picture.visible_rect().size().ToString(); | |
| 486 pb.set_size(picture.visible_rect().size()); | |
| 487 } | |
| 477 | 488 |
| 478 // Update frame's timestamp. | 489 // Update frame's timestamp. |
| 479 base::TimeDelta timestamp; | 490 base::TimeDelta timestamp; |
| 480 // Some of the VDAs like DXVA, AVDA, and VTVDA don't support and thus don't | 491 // Some of the VDAs like DXVA, AVDA, and VTVDA don't support and thus don't |
| 481 // provide us with visible size in picture.size, passing (0, 0) instead, so | 492 // provide us with visible size in picture.size, passing (0, 0) instead, so |
| 482 // for those cases drop it and use config information instead. | 493 // for those cases drop it and use config information instead. |
| 483 gfx::Rect visible_rect; | 494 gfx::Rect visible_rect; |
| 484 gfx::Size natural_size; | 495 gfx::Size natural_size; |
| 485 GetBufferData(picture.bitstream_buffer_id(), ×tamp, &visible_rect, | 496 GetBufferData(picture.bitstream_buffer_id(), ×tamp, &visible_rect, |
| 486 &natural_size); | 497 &natural_size); |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 705 } | 716 } |
| 706 return false; | 717 return false; |
| 707 } | 718 } |
| 708 | 719 |
| 709 void GpuVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() | 720 void GpuVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() |
| 710 const { | 721 const { |
| 711 DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread()); | 722 DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread()); |
| 712 } | 723 } |
| 713 | 724 |
| 714 } // namespace media | 725 } // namespace media |
| OLD | NEW |