| 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 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 534 visible_rect = picture.visible_rect(); | 534 visible_rect = picture.visible_rect(); |
| 535 } | 535 } |
| 536 if (!gfx::Rect(pb.size()).Contains(visible_rect)) { | 536 if (!gfx::Rect(pb.size()).Contains(visible_rect)) { |
| 537 LOG(WARNING) << "Visible size " << visible_rect.ToString() | 537 LOG(WARNING) << "Visible size " << visible_rect.ToString() |
| 538 << " is larger than coded size " << pb.size().ToString(); | 538 << " is larger than coded size " << pb.size().ToString(); |
| 539 visible_rect = gfx::Rect(pb.size()); | 539 visible_rect = gfx::Rect(pb.size()); |
| 540 } | 540 } |
| 541 | 541 |
| 542 DCHECK(decoder_texture_target_); | 542 DCHECK(decoder_texture_target_); |
| 543 | 543 |
| 544 bool opaque = IsOpaque(config_.format()); | 544 VideoPixelFormat pixel_format = vda_->GetOutputFormat(); |
| 545 if (pixel_format == PIXEL_FORMAT_UNKNOWN) { |
| 546 pixel_format = |
| 547 IsOpaque(config_.format()) ? PIXEL_FORMAT_XRGB : PIXEL_FORMAT_ARGB; |
| 548 } |
| 545 | 549 |
| 546 scoped_refptr<VideoFrame> frame(VideoFrame::WrapNativeTexture( | 550 scoped_refptr<VideoFrame> frame(VideoFrame::WrapNativeTexture( |
| 547 opaque ? PIXEL_FORMAT_XRGB : PIXEL_FORMAT_ARGB, | 551 pixel_format, gpu::MailboxHolder(pb.texture_mailbox(0), gpu::SyncToken(), |
| 548 gpu::MailboxHolder(pb.texture_mailbox(0), gpu::SyncToken(), | 552 decoder_texture_target_), |
| 549 decoder_texture_target_), | |
| 550 BindToCurrentLoop(base::Bind( | 553 BindToCurrentLoop(base::Bind( |
| 551 &GpuVideoDecoder::ReleaseMailbox, weak_factory_.GetWeakPtr(), | 554 &GpuVideoDecoder::ReleaseMailbox, weak_factory_.GetWeakPtr(), |
| 552 factories_, picture.picture_buffer_id(), pb.texture_ids())), | 555 factories_, picture.picture_buffer_id(), pb.texture_ids())), |
| 553 pb.size(), visible_rect, natural_size, timestamp)); | 556 pb.size(), visible_rect, natural_size, timestamp)); |
| 554 if (!frame) { | 557 if (!frame) { |
| 555 DLOG(ERROR) << "Create frame failed for: " << picture.picture_buffer_id(); | 558 DLOG(ERROR) << "Create frame failed for: " << picture.picture_buffer_id(); |
| 556 NotifyError(VideoDecodeAccelerator::PLATFORM_FAILURE); | 559 NotifyError(VideoDecodeAccelerator::PLATFORM_FAILURE); |
| 557 return; | 560 return; |
| 558 } | 561 } |
| 559 if (picture.allow_overlay()) | 562 if (picture.allow_overlay()) |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 764 } | 767 } |
| 765 return false; | 768 return false; |
| 766 } | 769 } |
| 767 | 770 |
| 768 void GpuVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() | 771 void GpuVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() |
| 769 const { | 772 const { |
| 770 DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread()); | 773 DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread()); |
| 771 } | 774 } |
| 772 | 775 |
| 773 } // namespace media | 776 } // namespace media |
| OLD | NEW |