Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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)); |
|
watk
2016/06/24 17:54:46
No way to get into this branch now. I hope that me
| |
| 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; |
| 546 } | 543 } |
| 547 | 544 |
| 548 if (g_avda_timer.Pointer()->AllocateSurface(config_.surface_id, this)) { | 545 if (g_avda_timer.Pointer()->AllocateSurface(config_.surface_id, this)) { |
| 549 // We have succesfully owned the surface, so finish initialization now. | 546 // We have succesfully owned the surface, so finish initialization now. |
| 550 return InitializeStrategy(); | 547 return InitializeStrategy(); |
| (...skipping 1110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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; |
|
watk
2016/06/24 17:54:46
Delete this now?
liberato (no reviews please)
2016/06/24 17:59:13
i think holding onto it still has value. once we
| |
| 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::RequiresTextureCopy( | |
| 1673 const gpu::GpuPreferences& gpu_preferences) { | |
| 1674 // http://crbug.com/582170 | |
| 1675 return gpu_preferences.enable_threaded_texture_mailboxes; | |
|
liberato (no reviews please)
2016/06/24 17:15:45
i think that it should either (a) return false if
Tima Vaisburd
2016/06/24 17:22:54
I think only (b) is correct: we always use deferre
liberato (no reviews please)
2016/06/24 17:28:32
either a or b works. if we (a) keep the current n
Tima Vaisburd
2016/06/24 17:42:22
I see. I renamed the method to UseTextureCopyForDe
| |
| 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 Loading... | |
| 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 (RequiresTextureCopy(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 WenView. | |
|
watk
2016/06/24 17:54:46
s/wenview/webview
Tima Vaisburd
2016/06/24 18:12:37
Done.
| |
| 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 |
| OLD | NEW |