Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(337)

Side by Side Diff: media/filters/gpu_video_decoder.cc

Issue 2254993003: Avoid creating sync token when only change is new hardware video frame. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix deps Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/filters/gpu_video_decoder.h ('k') | media/renderers/gpu_video_accelerator_factories.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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
OLDNEW
« no previous file with comments | « media/filters/gpu_video_decoder.h ('k') | media/renderers/gpu_video_accelerator_factories.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698