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 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 469 DVLOG(3) << "PictureReady()"; | 469 DVLOG(3) << "PictureReady()"; |
| 470 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent(); | 470 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent(); |
| 471 | 471 |
| 472 PictureBufferMap::iterator it = | 472 PictureBufferMap::iterator it = |
| 473 assigned_picture_buffers_.find(picture.picture_buffer_id()); | 473 assigned_picture_buffers_.find(picture.picture_buffer_id()); |
| 474 if (it == assigned_picture_buffers_.end()) { | 474 if (it == assigned_picture_buffers_.end()) { |
| 475 DLOG(ERROR) << "Missing picture buffer: " << picture.picture_buffer_id(); | 475 DLOG(ERROR) << "Missing picture buffer: " << picture.picture_buffer_id(); |
| 476 NotifyError(VideoDecodeAccelerator::PLATFORM_FAILURE); | 476 NotifyError(VideoDecodeAccelerator::PLATFORM_FAILURE); |
| 477 return; | 477 return; |
| 478 } | 478 } |
| 479 const PictureBuffer& pb = it->second; | 479 PictureBuffer& pb = it->second; |
| 480 if (picture.size_changed()) { | |
| 481 // Update the PictureBuffer size to match that of the Picture. Some VDA's | |
| 482 // (e.g. Android) will handle resolution changes internally without | |
| 483 // requesting new PictureBuffers. Sending a Picture of unmatched size is | |
| 484 // the signal that we should update the size of our PictureBuffer. | |
| 485 DCHECK(pb.size() != picture.visible_rect().size()); | |
| 486 DVLOG(3) << __FUNCTION__ << " Updating size of PictureBuffer[" << pb.id() | |
| 487 << "] from:" << pb.size().ToString() | |
| 488 << " to:" << picture.visible_rect().size().ToString(); | |
| 489 pb.set_size(picture.visible_rect().size()); | |
|
jbauman
2016/03/07 23:53:50
Hmm, should it be using the coded size instead? I'
chcunningham
2016/03/08 03:19:36
I had the same concern, but Frank convinced me thi
| |
| 490 } | |
| 480 | 491 |
| 481 // Update frame's timestamp. | 492 // Update frame's timestamp. |
| 482 base::TimeDelta timestamp; | 493 base::TimeDelta timestamp; |
| 483 // Some of the VDAs like DXVA, AVDA, and VTVDA don't support and thus don't | 494 // Some of the VDAs like DXVA, AVDA, and VTVDA don't support and thus don't |
|
jbauman
2016/03/07 23:53:50
Is this comment still true with AVDA?
chcunningham
2016/03/08 03:19:36
No longer true for AVDA. I've updated this comment
| |
| 484 // provide us with visible size in picture.size, passing (0, 0) instead, so | 495 // provide us with visible size in picture.size, passing (0, 0) instead, so |
| 485 // for those cases drop it and use config information instead. | 496 // for those cases drop it and use config information instead. |
| 486 gfx::Rect visible_rect; | 497 gfx::Rect visible_rect; |
| 487 gfx::Size natural_size; | 498 gfx::Size natural_size; |
| 488 GetBufferData(picture.bitstream_buffer_id(), ×tamp, &visible_rect, | 499 GetBufferData(picture.bitstream_buffer_id(), ×tamp, &visible_rect, |
| 489 &natural_size); | 500 &natural_size); |
| 490 | 501 |
| 491 if (!picture.visible_rect().IsEmpty()) { | 502 if (!picture.visible_rect().IsEmpty()) { |
| 492 visible_rect = picture.visible_rect(); | 503 visible_rect = picture.visible_rect(); |
| 493 } | 504 } |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 708 } | 719 } |
| 709 return false; | 720 return false; |
| 710 } | 721 } |
| 711 | 722 |
| 712 void GpuVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() | 723 void GpuVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() |
| 713 const { | 724 const { |
| 714 DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread()); | 725 DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread()); |
| 715 } | 726 } |
| 716 | 727 |
| 717 } // namespace media | 728 } // namespace media |
| OLD | NEW |