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 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 } | 555 } |
556 | 556 |
557 DCHECK(decoder_texture_target_); | 557 DCHECK(decoder_texture_target_); |
558 | 558 |
559 VideoPixelFormat pixel_format = vda_->GetOutputFormat(); | 559 VideoPixelFormat pixel_format = vda_->GetOutputFormat(); |
560 if (pixel_format == PIXEL_FORMAT_UNKNOWN) { | 560 if (pixel_format == PIXEL_FORMAT_UNKNOWN) { |
561 pixel_format = | 561 pixel_format = |
562 IsOpaque(config_.format()) ? PIXEL_FORMAT_XRGB : PIXEL_FORMAT_ARGB; | 562 IsOpaque(config_.format()) ? PIXEL_FORMAT_XRGB : PIXEL_FORMAT_ARGB; |
563 } | 563 } |
564 | 564 |
565 scoped_refptr<VideoFrame> frame(VideoFrame::WrapNativeTexture( | 565 gpu::MailboxHolder mailbox_holders[VideoFrame::kMaxPlanes]; |
566 pixel_format, gpu::MailboxHolder(pb.texture_mailbox(0), gpu::SyncToken(), | 566 for (size_t i = 0; i < pb.texture_ids().size(); ++i) { |
567 decoder_texture_target_), | 567 mailbox_holders[i] = gpu::MailboxHolder( |
| 568 pb.texture_mailbox(i), gpu::SyncToken(), decoder_texture_target_); |
| 569 } |
| 570 |
| 571 scoped_refptr<VideoFrame> frame(VideoFrame::WrapNativeTextures( |
| 572 pixel_format, mailbox_holders, |
568 base::Bind(&ReleaseMailboxTrampoline, factories_->GetTaskRunner(), | 573 base::Bind(&ReleaseMailboxTrampoline, factories_->GetTaskRunner(), |
569 base::Bind(&GpuVideoDecoder::ReleaseMailbox, | 574 base::Bind(&GpuVideoDecoder::ReleaseMailbox, |
570 weak_factory_.GetWeakPtr(), factories_, | 575 weak_factory_.GetWeakPtr(), factories_, |
571 picture.picture_buffer_id(), pb.texture_ids())), | 576 picture.picture_buffer_id(), pb.texture_ids())), |
572 pb.size(), visible_rect, natural_size, timestamp)); | 577 pb.size(), visible_rect, natural_size, timestamp)); |
573 if (!frame) { | 578 if (!frame) { |
574 DLOG(ERROR) << "Create frame failed for: " << picture.picture_buffer_id(); | 579 DLOG(ERROR) << "Create frame failed for: " << picture.picture_buffer_id(); |
575 NotifyError(VideoDecodeAccelerator::PLATFORM_FAILURE); | 580 NotifyError(VideoDecodeAccelerator::PLATFORM_FAILURE); |
576 return; | 581 return; |
577 } | 582 } |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
783 } | 788 } |
784 return false; | 789 return false; |
785 } | 790 } |
786 | 791 |
787 void GpuVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() | 792 void GpuVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() |
788 const { | 793 const { |
789 DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread()); | 794 DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread()); |
790 } | 795 } |
791 | 796 |
792 } // namespace media | 797 } // namespace media |
OLD | NEW |