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

Side by Side Diff: media/gpu/android_video_decode_accelerator.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: Addressed comments, fixed Windows compilation 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/gpu/android_video_decode_accelerator.h ('k') | media/video/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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/gpu/android_video_decode_accelerator.h" 5 #include "media/gpu/android_video_decode_accelerator.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 auto gles_decoder = get_gles2_decoder_cb_.Run(); 523 auto gles_decoder = get_gles2_decoder_cb_.Run();
524 if (!gles_decoder) { 524 if (!gles_decoder) {
525 LOG(ERROR) << "Failed to get gles2 decoder instance."; 525 LOG(ERROR) << "Failed to get gles2 decoder instance.";
526 return false; 526 return false;
527 } 527 }
528 528
529 const gpu::GpuPreferences& gpu_preferences = 529 const gpu::GpuPreferences& gpu_preferences =
530 gles_decoder->GetContextGroup()->gpu_preferences(); 530 gles_decoder->GetContextGroup()->gpu_preferences();
531 531
532 if (UseDeferredRenderingStrategy(gpu_preferences)) { 532 if (UseDeferredRenderingStrategy(gpu_preferences)) {
533 // TODO(liberato, watk): Figure out what we want to do about zero copy for
534 // fullscreen external SurfaceView in WebView. http://crbug.com/582170.
535 DCHECK(!gles_decoder->GetContextGroup()->mailbox_manager()->UsesSync());
536 DVLOG(1) << __FUNCTION__ << ", using deferred rendering strategy."; 533 DVLOG(1) << __FUNCTION__ << ", using deferred rendering strategy.";
537 strategy_.reset(new AndroidDeferredRenderingBackingStrategy(this)); 534 strategy_.reset(new AndroidDeferredRenderingBackingStrategy(this));
538 } else { 535 } else {
539 DVLOG(1) << __FUNCTION__ << ", using copy back strategy."; 536 DVLOG(1) << __FUNCTION__ << ", using copy back strategy.";
540 strategy_.reset(new AndroidCopyingBackingStrategy(this)); 537 strategy_.reset(new AndroidCopyingBackingStrategy(this));
541 } 538 }
542 539
543 if (!make_context_current_cb_.Run()) { 540 if (!make_context_current_cb_.Run()) {
544 LOG(ERROR) << "Failed to make this decoder's GL context current."; 541 LOG(ERROR) << "Failed to make this decoder's GL context current.";
545 return false; 542 return false;
(...skipping 1115 matching lines...) Expand 10 before | Expand all | Expand 10 after
1661 1658
1662 if (should_be_running) 1659 if (should_be_running)
1663 g_avda_timer.Pointer()->StartTimer(this); 1660 g_avda_timer.Pointer()->StartTimer(this);
1664 else 1661 else
1665 g_avda_timer.Pointer()->StopTimer(this); 1662 g_avda_timer.Pointer()->StopTimer(this);
1666 } 1663 }
1667 1664
1668 // static 1665 // static
1669 bool AndroidVideoDecodeAccelerator::UseDeferredRenderingStrategy( 1666 bool AndroidVideoDecodeAccelerator::UseDeferredRenderingStrategy(
1670 const gpu::GpuPreferences& gpu_preferences) { 1667 const gpu::GpuPreferences& gpu_preferences) {
1671 // TODO(liberato, watk): Figure out what we want to do about zero copy for 1668 return true;
1672 // fullscreen external SurfaceView in WebView. http://crbug.com/582170.
1673 return !gpu_preferences.enable_threaded_texture_mailboxes;
1674 } 1669 }
1675 1670
1676 // static 1671 // static
1672 bool AndroidVideoDecodeAccelerator::UseTextureCopyForDeferredStrategy(
1673 const gpu::GpuPreferences& gpu_preferences) {
1674 // http://crbug.com/582170
1675 return gpu_preferences.enable_threaded_texture_mailboxes;
1676 }
1677
1678 // static
1677 VideoDecodeAccelerator::Capabilities 1679 VideoDecodeAccelerator::Capabilities
1678 AndroidVideoDecodeAccelerator::GetCapabilities( 1680 AndroidVideoDecodeAccelerator::GetCapabilities(
1679 const gpu::GpuPreferences& gpu_preferences) { 1681 const gpu::GpuPreferences& gpu_preferences) {
1680 Capabilities capabilities; 1682 Capabilities capabilities;
1681 SupportedProfiles& profiles = capabilities.supported_profiles; 1683 SupportedProfiles& profiles = capabilities.supported_profiles;
1682 1684
1683 // Only support VP8 on Android versions where we don't have to synchronously 1685 // Only support VP8 on Android versions where we don't have to synchronously
1684 // tear down the MediaCodec on surface destruction because VP8 requires 1686 // tear down the MediaCodec on surface destruction because VP8 requires
1685 // us to completely drain the decoder before releasing it, which is difficult 1687 // us to completely drain the decoder before releasing it, which is difficult
1686 // and time consuming to do while the surface is being destroyed. 1688 // and time consuming to do while the surface is being destroyed.
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1730 // software fallback for H264 on Android anyway. 1732 // software fallback for H264 on Android anyway.
1731 profile.max_resolution.SetSize(3840, 2160); 1733 profile.max_resolution.SetSize(3840, 2160);
1732 profiles.push_back(profile); 1734 profiles.push_back(profile);
1733 } 1735 }
1734 1736
1735 capabilities.flags = 1737 capabilities.flags =
1736 VideoDecodeAccelerator::Capabilities::SUPPORTS_DEFERRED_INITIALIZATION; 1738 VideoDecodeAccelerator::Capabilities::SUPPORTS_DEFERRED_INITIALIZATION;
1737 if (UseDeferredRenderingStrategy(gpu_preferences)) { 1739 if (UseDeferredRenderingStrategy(gpu_preferences)) {
1738 capabilities.flags |= VideoDecodeAccelerator::Capabilities:: 1740 capabilities.flags |= VideoDecodeAccelerator::Capabilities::
1739 NEEDS_ALL_PICTURE_BUFFERS_TO_DECODE; 1741 NEEDS_ALL_PICTURE_BUFFERS_TO_DECODE;
1740 if (MediaCodecUtil::IsSurfaceViewOutputSupported()) { 1742 if (UseTextureCopyForDeferredStrategy(gpu_preferences)) {
1741 capabilities.flags |= VideoDecodeAccelerator::Capabilities:: 1743 capabilities.flags |=
1744 media::VideoDecodeAccelerator::Capabilities::REQUIRES_TEXTURE_COPY;
1745 } else if (media::MediaCodecUtil::IsSurfaceViewOutputSupported()) {
1746 // Fullscreen external SurfaceView is disabled for WebView.
1747 // http://crbug.com/582170
1748 capabilities.flags |= media::VideoDecodeAccelerator::Capabilities::
1742 SUPPORTS_EXTERNAL_OUTPUT_SURFACE; 1749 SUPPORTS_EXTERNAL_OUTPUT_SURFACE;
1743 } 1750 }
1744 } 1751 }
1745 1752
1746 return capabilities; 1753 return capabilities;
1747 } 1754 }
1748 1755
1749 } // namespace media 1756 } // namespace media
OLDNEW
« no previous file with comments | « media/gpu/android_video_decode_accelerator.h ('k') | media/video/video_decode_accelerator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698