| 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 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 return; | 489 return; |
| 490 } | 490 } |
| 491 | 491 |
| 492 pixel_format_ = format; | 492 pixel_format_ = format; |
| 493 if (!factories_->CreateTextures(count * textures_per_buffer, size, | 493 if (!factories_->CreateTextures(count * textures_per_buffer, size, |
| 494 &texture_ids, &texture_mailboxes, | 494 &texture_ids, &texture_mailboxes, |
| 495 decoder_texture_target_)) { | 495 decoder_texture_target_)) { |
| 496 NotifyError(VideoDecodeAccelerator::PLATFORM_FAILURE); | 496 NotifyError(VideoDecodeAccelerator::PLATFORM_FAILURE); |
| 497 return; | 497 return; |
| 498 } | 498 } |
| 499 sync_token_ = factories_->CreateSyncToken(); |
| 499 DCHECK_EQ(count * textures_per_buffer, texture_ids.size()); | 500 DCHECK_EQ(count * textures_per_buffer, texture_ids.size()); |
| 500 DCHECK_EQ(count * textures_per_buffer, texture_mailboxes.size()); | 501 DCHECK_EQ(count * textures_per_buffer, texture_mailboxes.size()); |
| 501 | 502 |
| 502 if (!vda_) | 503 if (!vda_) |
| 503 return; | 504 return; |
| 504 | 505 |
| 505 std::vector<PictureBuffer> picture_buffers; | 506 std::vector<PictureBuffer> picture_buffers; |
| 506 size_t index = 0; | 507 size_t index = 0; |
| 507 for (size_t i = 0; i < count; ++i) { | 508 for (size_t i = 0; i < count; ++i) { |
| 508 PictureBuffer::TextureIds ids; | 509 PictureBuffer::TextureIds ids; |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 if (!gfx::Rect(pb.size()).Contains(visible_rect)) { | 590 if (!gfx::Rect(pb.size()).Contains(visible_rect)) { |
| 590 LOG(WARNING) << "Visible size " << visible_rect.ToString() | 591 LOG(WARNING) << "Visible size " << visible_rect.ToString() |
| 591 << " is larger than coded size " << pb.size().ToString(); | 592 << " is larger than coded size " << pb.size().ToString(); |
| 592 visible_rect = gfx::Rect(pb.size()); | 593 visible_rect = gfx::Rect(pb.size()); |
| 593 } | 594 } |
| 594 | 595 |
| 595 DCHECK(decoder_texture_target_); | 596 DCHECK(decoder_texture_target_); |
| 596 | 597 |
| 597 gpu::MailboxHolder mailbox_holders[VideoFrame::kMaxPlanes]; | 598 gpu::MailboxHolder mailbox_holders[VideoFrame::kMaxPlanes]; |
| 598 for (size_t i = 0; i < pb.texture_ids().size(); ++i) { | 599 for (size_t i = 0; i < pb.texture_ids().size(); ++i) { |
| 599 mailbox_holders[i] = gpu::MailboxHolder( | 600 mailbox_holders[i] = gpu::MailboxHolder(pb.texture_mailbox(i), sync_token_, |
| 600 pb.texture_mailbox(i), gpu::SyncToken(), decoder_texture_target_); | 601 decoder_texture_target_); |
| 601 } | 602 } |
| 602 | 603 |
| 603 scoped_refptr<VideoFrame> frame(VideoFrame::WrapNativeTextures( | 604 scoped_refptr<VideoFrame> frame(VideoFrame::WrapNativeTextures( |
| 604 pixel_format_, mailbox_holders, | 605 pixel_format_, mailbox_holders, |
| 605 base::Bind(&ReleaseMailboxTrampoline, factories_->GetTaskRunner(), | 606 base::Bind(&ReleaseMailboxTrampoline, factories_->GetTaskRunner(), |
| 606 base::Bind(&GpuVideoDecoder::ReleaseMailbox, | 607 base::Bind(&GpuVideoDecoder::ReleaseMailbox, |
| 607 weak_factory_.GetWeakPtr(), factories_, | 608 weak_factory_.GetWeakPtr(), factories_, |
| 608 picture.picture_buffer_id(), pb.texture_ids())), | 609 picture.picture_buffer_id(), pb.texture_ids())), |
| 609 pb.size(), visible_rect, natural_size, timestamp)); | 610 pb.size(), visible_rect, natural_size, timestamp)); |
| 610 if (!frame) { | 611 if (!frame) { |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 824 } | 825 } |
| 825 return false; | 826 return false; |
| 826 } | 827 } |
| 827 | 828 |
| 828 void GpuVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() | 829 void GpuVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() |
| 829 const { | 830 const { |
| 830 DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread()); | 831 DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread()); |
| 831 } | 832 } |
| 832 | 833 |
| 833 } // namespace media | 834 } // namespace media |
| OLD | NEW |