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

Side by Side Diff: content/renderer/render_frame_impl.cc

Issue 2681643006: Remove kDisableUnifiedMediaPipeline (Closed)
Patch Set: Addressed comments Created 3 years, 10 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 | « content/browser/renderer_host/render_process_host_impl.cc ('k') | media/base/key_systems.cc » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 "content/renderer/render_frame_impl.h" 5 #include "content/renderer/render_frame_impl.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 816 matching lines...) Expand 10 before | Expand all | Expand 10 after
827 break; 827 break;
828 } 828 }
829 } 829 }
830 // Explicitly close |file| here to make sure to include any flush operations 830 // Explicitly close |file| here to make sure to include any flush operations
831 // in the UMA metric. 831 // in the UMA metric.
832 file.Close(); 832 file.Close();
833 return save_status; 833 return save_status;
834 } 834 }
835 835
836 #if defined(OS_ANDROID) 836 #if defined(OS_ANDROID)
837 // Returns true if WMPI should be used for playback, false otherwise. 837 // Returns true if the MediaPlayerRenderer should be used for playback, false
838 // if the default renderer should be used instead.
838 // 839 //
839 // Note that HLS and MP4 detection are pre-redirect and path-based. It is 840 // Note that HLS and MP4 detection are pre-redirect and path-based. It is
840 // possible to load such a URL and find different content. 841 // possible to load such a URL and find different content.
841 bool UseWebMediaPlayerImpl(const GURL& url) { 842 bool UseMediaPlayerRenderer(const GURL& url) {
842 // Always use WMPI for playing blob URLs since WMPA could never play them very 843 // Always use the default renderer for playing blob URLs.
843 // well and no longer has support for MSE based playbacks.
844 if (url.SchemeIsBlob()) 844 if (url.SchemeIsBlob())
845 return false;
846
847 // The default renderer does not support HLS.
848 if (media::MediaCodecUtil::IsHLSURL(url))
845 return true; 849 return true;
846 850
847 // WMPI does not support HLS. 851 // Don't use the default renderer if the container likely contains a codec we
848 if (media::MediaCodecUtil::IsHLSURL(url)) 852 // can't decode in software and platform decoders are not available.
849 return false;
850
851 // Don't use WMPI if the container likely contains a codec we can't decode in
852 // software and platform decoders are not available.
853 if (!media::HasPlatformDecoderSupport()) { 853 if (!media::HasPlatformDecoderSupport()) {
854 // Assume that "mp4" means H264. Without platform decoder support we cannot 854 // Assume that "mp4" means H264. Without platform decoder support we cannot
855 // play it with Spitzer, thus fall back to AVDA. http://crbug.com/642988. 855 // play it with Spitzer, thus fall back to AVDA. http://crbug.com/642988.
watk 2017/02/09 20:25:41 I think the "AVDA" in this comment was always wron
856 if (base::ToLowerASCII(url.spec()).find("mp4") != std::string::npos) 856 if (base::ToLowerASCII(url.spec()).find("mp4") != std::string::npos)
857 return false; 857 return true;
858 } 858 }
859 859
860 // Indicates if the Android MediaPlayer should be used instead of WMPI. 860 // Indicates if the Android MediaPlayer should be used instead of WMPI.
861 if (GetContentClient()->renderer()->ShouldUseMediaPlayerForURL(url)) 861 if (GetContentClient()->renderer()->ShouldUseMediaPlayerForURL(url))
862 return false; 862 return true;
863 863
864 // Otherwise enable WMPI if indicated via experiment or command line. 864 // Otherwise, use the default renderer.
865 return media::IsUnifiedMediaPipelineEnabled(); 865 return false;
866 } 866 }
867 #endif // defined(OS_ANDROID) 867 #endif // defined(OS_ANDROID)
868 868
869 #if defined(ENABLE_MOJO_CDM)
870 // Returns whether mojo CDM should be used at runtime. Note that even when mojo
871 // CDM is enabled at compile time (ENABLE_MOJO_CDM is defined), there are cases
872 // where we want to choose other CDM types. For example, in the future, when we
873 // experiment mojo CDM on desktop, we will choose between mojo CDM and pepper
874 // CDM at runtime.
875 // TODO(xhwang): Remove this when we use mojo CDM for all remote CDM cases by
876 // default.
877 bool UseMojoCdm() {
878 #if defined(OS_ANDROID)
879 return media::IsUnifiedMediaPipelineEnabled();
880 #else
881 return true;
882 #endif
883 }
884 #endif // defined(ENABLE_MOJO_CDM)
885
886 double ConvertToBlinkTime(const base::TimeTicks& time_ticks) { 869 double ConvertToBlinkTime(const base::TimeTicks& time_ticks) {
887 return (time_ticks - base::TimeTicks()).InSecondsF(); 870 return (time_ticks - base::TimeTicks()).InSecondsF();
888 } 871 }
889 872
890 } // namespace 873 } // namespace
891 874
892 struct RenderFrameImpl::PendingFileChooser { 875 struct RenderFrameImpl::PendingFileChooser {
893 PendingFileChooser(const FileChooserParams& p, 876 PendingFileChooser(const FileChooserParams& p,
894 blink::WebFileChooserCompletion* c) 877 blink::WebFileChooserCompletion* c)
895 : params(p), completion(c) {} 878 : params(p), completion(c) {}
(...skipping 1930 matching lines...) Expand 10 before | Expand all | Expand 10 after
2826 // TODO(piman): replace media::Context3D to scoped_refptr<ContextProvider> in 2809 // TODO(piman): replace media::Context3D to scoped_refptr<ContextProvider> in
2827 // media/ once ContextProvider is in gpu/. 2810 // media/ once ContextProvider is in gpu/.
2828 media::WebMediaPlayerParams::Context3DCB context_3d_cb = base::Bind( 2811 media::WebMediaPlayerParams::Context3DCB context_3d_cb = base::Bind(
2829 &GetSharedMainThreadContext3D, 2812 &GetSharedMainThreadContext3D,
2830 RenderThreadImpl::current()->SharedMainThreadContextProvider()); 2813 RenderThreadImpl::current()->SharedMainThreadContextProvider());
2831 2814
2832 scoped_refptr<media::MediaLog> media_log( 2815 scoped_refptr<media::MediaLog> media_log(
2833 new RenderMediaLog(url::Origin(frame_->getSecurityOrigin()).GetURL())); 2816 new RenderMediaLog(url::Origin(frame_->getSecurityOrigin()).GetURL()));
2834 2817
2835 #if defined(OS_ANDROID) 2818 #if defined(OS_ANDROID)
2836 if (UseWebMediaPlayerImpl(url) && !media_surface_manager_) 2819 if (!UseMediaPlayerRenderer(url) && !media_surface_manager_)
2837 media_surface_manager_ = new RendererSurfaceViewManager(this); 2820 media_surface_manager_ = new RendererSurfaceViewManager(this);
2838 #endif // defined(OS_ANDROID) 2821 #endif // defined(OS_ANDROID)
2839 2822
2840 #if BUILDFLAG(ENABLE_MEDIA_REMOTING) 2823 #if BUILDFLAG(ENABLE_MEDIA_REMOTING)
2841 media::mojom::RemotingSourcePtr remoting_source; 2824 media::mojom::RemotingSourcePtr remoting_source;
2842 media::mojom::RemotingSourceRequest remoting_source_request(&remoting_source); 2825 media::mojom::RemotingSourceRequest remoting_source_request(&remoting_source);
2843 media::mojom::RemoterPtr remoter; 2826 media::mojom::RemoterPtr remoter;
2844 GetRemoterFactory()->Create(std::move(remoting_source), 2827 GetRemoterFactory()->Create(std::move(remoting_source),
2845 mojo::MakeRequest(&remoter)); 2828 mojo::MakeRequest(&remoter));
2846 using RemotingController = media::remoting::RendererController; 2829 using RemotingController = media::remoting::RendererController;
(...skipping 18 matching lines...) Expand all
2865 base::Unretained(blink::mainThreadIsolate())), 2848 base::Unretained(blink::mainThreadIsolate())),
2866 initial_cdm, media_surface_manager_, media_observer, 2849 initial_cdm, media_surface_manager_, media_observer,
2867 // TODO(avayvod, asvitkine): Query the value directly when it is available 2850 // TODO(avayvod, asvitkine): Query the value directly when it is available
2868 // in the renderer process. See https://crbug.com/681160. 2851 // in the renderer process. See https://crbug.com/681160.
2869 GetWebkitPreferences().max_keyframe_distance_to_disable_background_video, 2852 GetWebkitPreferences().max_keyframe_distance_to_disable_background_video,
2870 GetWebkitPreferences().enable_instant_source_buffer_gc, 2853 GetWebkitPreferences().enable_instant_source_buffer_gc,
2871 GetContentClient()->renderer()->AllowMediaSuspend()); 2854 GetContentClient()->renderer()->AllowMediaSuspend());
2872 2855
2873 bool use_fallback_path = false; 2856 bool use_fallback_path = false;
2874 #if defined(OS_ANDROID) 2857 #if defined(OS_ANDROID)
2875 use_fallback_path = !UseWebMediaPlayerImpl(url); 2858 use_fallback_path = UseMediaPlayerRenderer(url);
2876 #endif // defined(OS_ANDROID) 2859 #endif // defined(OS_ANDROID)
2877 2860
2878 std::unique_ptr<media::RendererFactory> media_renderer_factory; 2861 std::unique_ptr<media::RendererFactory> media_renderer_factory;
2879 if (use_fallback_path) { 2862 if (use_fallback_path) {
2880 #if defined(OS_ANDROID) 2863 #if defined(OS_ANDROID)
2881 auto mojo_renderer_factory = base::MakeUnique<media::MojoRendererFactory>( 2864 auto mojo_renderer_factory = base::MakeUnique<media::MojoRendererFactory>(
2882 media::MojoRendererFactory::GetGpuFactoriesCB(), 2865 media::MojoRendererFactory::GetGpuFactoriesCB(),
2883 GetRemoteInterfaces()->get()); 2866 GetRemoteInterfaces()->get());
2884 2867
2885 media_renderer_factory = base::MakeUnique<MediaPlayerRendererClientFactory>( 2868 media_renderer_factory = base::MakeUnique<MediaPlayerRendererClientFactory>(
(...skipping 3651 matching lines...) Expand 10 before | Expand all | Expand 10 after
6537 GetRemoteInterfaces()->GetInterface(&remoter_factory_); 6520 GetRemoteInterfaces()->GetInterface(&remoter_factory_);
6538 return remoter_factory_.get(); 6521 return remoter_factory_.get();
6539 } 6522 }
6540 #endif 6523 #endif
6541 6524
6542 media::CdmFactory* RenderFrameImpl::GetCdmFactory() { 6525 media::CdmFactory* RenderFrameImpl::GetCdmFactory() {
6543 if (cdm_factory_) 6526 if (cdm_factory_)
6544 return cdm_factory_.get(); 6527 return cdm_factory_.get();
6545 6528
6546 #if defined(ENABLE_MOJO_CDM) 6529 #if defined(ENABLE_MOJO_CDM)
6547 if (UseMojoCdm()) { 6530 cdm_factory_.reset(new media::MojoCdmFactory(GetMediaInterfaceProvider()));
6548 cdm_factory_.reset(new media::MojoCdmFactory(GetMediaInterfaceProvider())); 6531 return cdm_factory_.get();
6549 return cdm_factory_.get();
6550 }
6551 #endif // defined(ENABLE_MOJO_CDM) 6532 #endif // defined(ENABLE_MOJO_CDM)
6552 6533
6553 #if BUILDFLAG(ENABLE_PEPPER_CDMS) 6534 #if BUILDFLAG(ENABLE_PEPPER_CDMS)
6554 DCHECK(frame_); 6535 DCHECK(frame_);
6555 cdm_factory_.reset( 6536 cdm_factory_.reset(
6556 new RenderCdmFactory(base::Bind(&PepperCdmWrapperImpl::Create, frame_))); 6537 new RenderCdmFactory(base::Bind(&PepperCdmWrapperImpl::Create, frame_)));
6557 #endif // BUILDFLAG(ENABLE_PEPPER_CDMS) 6538 #endif // BUILDFLAG(ENABLE_PEPPER_CDMS)
6558 6539
6559 #if BUILDFLAG(ENABLE_MEDIA_REMOTING) 6540 #if BUILDFLAG(ENABLE_MEDIA_REMOTING)
6560 cdm_factory_.reset(new media::remoting::RemotingCdmFactory( 6541 cdm_factory_.reset(new media::remoting::RemotingCdmFactory(
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
6826 // event target. Potentially a Pepper plugin will receive the event. 6807 // event target. Potentially a Pepper plugin will receive the event.
6827 // In order to tell whether a plugin gets the last mouse event and which it 6808 // In order to tell whether a plugin gets the last mouse event and which it
6828 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets 6809 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets
6829 // the event, it will notify us via DidReceiveMouseEvent() and set itself as 6810 // the event, it will notify us via DidReceiveMouseEvent() and set itself as
6830 // |pepper_last_mouse_event_target_|. 6811 // |pepper_last_mouse_event_target_|.
6831 pepper_last_mouse_event_target_ = nullptr; 6812 pepper_last_mouse_event_target_ = nullptr;
6832 #endif 6813 #endif
6833 } 6814 }
6834 6815
6835 } // namespace content 6816 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_process_host_impl.cc ('k') | media/base/key_systems.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698