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

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

Issue 2052103002: Enable deferred rendering strategy for Android WebView for Spitzer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@spitzer-aw-disable-tests
Patch Set: Created 4 years, 6 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/gpu/android_video_decode_accelerator.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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 factories_(factories), 78 factories_(factories),
79 state_(kNormal), 79 state_(kNormal),
80 request_surface_cb_(request_surface_cb), 80 request_surface_cb_(request_surface_cb),
81 decoder_texture_target_(0), 81 decoder_texture_target_(0),
82 pixel_format_(PIXEL_FORMAT_UNKNOWN), 82 pixel_format_(PIXEL_FORMAT_UNKNOWN),
83 next_picture_buffer_id_(0), 83 next_picture_buffer_id_(0),
84 next_bitstream_buffer_id_(0), 84 next_bitstream_buffer_id_(0),
85 available_pictures_(0), 85 available_pictures_(0),
86 needs_all_picture_buffers_to_decode_(false), 86 needs_all_picture_buffers_to_decode_(false),
87 supports_deferred_initialization_(false), 87 supports_deferred_initialization_(false),
88 requires_texture_copy_(false),
88 weak_factory_(this) { 89 weak_factory_(this) {
89 DCHECK(factories_); 90 DCHECK(factories_);
90 } 91 }
91 92
92 void GpuVideoDecoder::Reset(const base::Closure& closure) { 93 void GpuVideoDecoder::Reset(const base::Closure& closure) {
93 DVLOG(3) << "Reset()"; 94 DVLOG(3) << "Reset()";
94 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent(); 95 DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent();
95 96
96 if (state_ == kDrainingDecoder) { 97 if (state_ == kDrainingDecoder) {
97 base::ThreadTaskRunnerHandle::Get()->PostTask( 98 base::ThreadTaskRunnerHandle::Get()->PostTask(
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 << " is_encrypted: " << (config.is_encrypted() ? "yes." : "no."); 195 << " is_encrypted: " << (config.is_encrypted() ? "yes." : "no.");
195 bound_init_cb.Run(false); 196 bound_init_cb.Run(false);
196 return; 197 return;
197 } 198 }
198 199
199 config_ = config; 200 config_ = config;
200 needs_all_picture_buffers_to_decode_ = 201 needs_all_picture_buffers_to_decode_ =
201 capabilities.flags & 202 capabilities.flags &
202 VideoDecodeAccelerator::Capabilities::NEEDS_ALL_PICTURE_BUFFERS_TO_DECODE; 203 VideoDecodeAccelerator::Capabilities::NEEDS_ALL_PICTURE_BUFFERS_TO_DECODE;
203 needs_bitstream_conversion_ = (config.codec() == kCodecH264); 204 needs_bitstream_conversion_ = (config.codec() == kCodecH264);
205 requires_texture_copy_ =
Tima Vaisburd 2016/06/09 22:51:26 Bo Liu> do this: Bo Liu> https://cs.chromium.org/c
boliu 2016/06/10 00:41:03 You are not actually using the command line here t
Tima Vaisburd 2016/06/10 00:49:41 VideoDecodeAccelerator::Capabilities extracts the
boliu 2016/06/10 00:53:33 which is fine
206 capabilities.flags &
207 VideoDecodeAccelerator::Capabilities::REQUIRES_TEXTURE_COPY;
204 supports_deferred_initialization_ = !!( 208 supports_deferred_initialization_ = !!(
205 capabilities.flags & 209 capabilities.flags &
206 VideoDecodeAccelerator::Capabilities::SUPPORTS_DEFERRED_INITIALIZATION); 210 VideoDecodeAccelerator::Capabilities::SUPPORTS_DEFERRED_INITIALIZATION);
207 output_cb_ = output_cb; 211 output_cb_ = output_cb;
208 212
209 if (config.is_encrypted() && !supports_deferred_initialization_) { 213 if (config.is_encrypted() && !supports_deferred_initialization_) {
210 DVLOG(1) << __FUNCTION__ 214 DVLOG(1) << __FUNCTION__
211 << " Encrypted stream requires deferred initialialization."; 215 << " Encrypted stream requires deferred initialialization.";
212 bound_init_cb.Run(false); 216 bound_init_cb.Run(false);
213 return; 217 return;
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 if (!frame) { 585 if (!frame) {
582 DLOG(ERROR) << "Create frame failed for: " << picture.picture_buffer_id(); 586 DLOG(ERROR) << "Create frame failed for: " << picture.picture_buffer_id();
583 NotifyError(VideoDecodeAccelerator::PLATFORM_FAILURE); 587 NotifyError(VideoDecodeAccelerator::PLATFORM_FAILURE);
584 return; 588 return;
585 } 589 }
586 if (picture.allow_overlay()) 590 if (picture.allow_overlay())
587 frame->metadata()->SetBoolean(VideoFrameMetadata::ALLOW_OVERLAY, true); 591 frame->metadata()->SetBoolean(VideoFrameMetadata::ALLOW_OVERLAY, true);
588 #if defined(OS_MACOSX) || defined(OS_WIN) 592 #if defined(OS_MACOSX) || defined(OS_WIN)
589 frame->metadata()->SetBoolean(VideoFrameMetadata::DECODER_OWNS_FRAME, true); 593 frame->metadata()->SetBoolean(VideoFrameMetadata::DECODER_OWNS_FRAME, true);
590 #endif 594 #endif
595
596 // We keep deferred rendering strategy for Android WebView, that can only work
597 // with COPY_REQUIRED. See http://crbug.com/582170.
598 if (requires_texture_copy_)
599 frame->metadata()->SetBoolean(VideoFrameMetadata::COPY_REQUIRED, true);
600
591 CHECK_GT(available_pictures_, 0); 601 CHECK_GT(available_pictures_, 0);
592 --available_pictures_; 602 --available_pictures_;
593 603
594 bool inserted = 604 bool inserted =
595 picture_buffers_at_display_ 605 picture_buffers_at_display_
596 .insert(std::make_pair(picture.picture_buffer_id(), pb.texture_ids())) 606 .insert(std::make_pair(picture.picture_buffer_id(), pb.texture_ids()))
597 .second; 607 .second;
598 DCHECK(inserted); 608 DCHECK(inserted);
599 609
600 DeliverFrame(frame); 610 DeliverFrame(frame);
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
791 } 801 }
792 return false; 802 return false;
793 } 803 }
794 804
795 void GpuVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent() 805 void GpuVideoDecoder::DCheckGpuVideoAcceleratorFactoriesTaskRunnerIsCurrent()
796 const { 806 const {
797 DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread()); 807 DCHECK(factories_->GetTaskRunner()->BelongsToCurrentThread());
798 } 808 }
799 809
800 } // namespace media 810 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/gpu_video_decoder.h ('k') | media/gpu/android_video_decode_accelerator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698