Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 825 // in the UMA metric. | 825 // in the UMA metric. |
| 826 file.Close(); | 826 file.Close(); |
| 827 return save_status; | 827 return save_status; |
| 828 } | 828 } |
| 829 | 829 |
| 830 #if defined(OS_ANDROID) | 830 #if defined(OS_ANDROID) |
| 831 // Returns true if WMPI should be used for playback, false otherwise. | 831 // Returns true if WMPI should be used for playback, false otherwise. |
| 832 // | 832 // |
| 833 // Note that HLS and MP4 detection are pre-redirect and path-based. It is | 833 // Note that HLS and MP4 detection are pre-redirect and path-based. It is |
| 834 // possible to load such a URL and find different content. | 834 // possible to load such a URL and find different content. |
| 835 bool UseWebMediaPlayerImpl(const GURL& url) { | 835 bool UseWebMediaPlayerImpl(const GURL& url) { |
|
watk
2017/02/08 00:52:30
This needs updating to talk about the renderer and
tguilbert
2017/02/09 02:32:17
Done.
| |
| 836 // Always use WMPI for playing blob URLs since WMPA could never play them very | 836 // Always use WMPI for playing blob URLs since WMPA could never play them very |
|
xhwang
2017/02/08 02:46:01
Drop any reference to WMPA, here and in
https://cs
tguilbert
2017/02/09 02:32:17
I have dropped the references here. However, for t
| |
| 837 // well and no longer has support for MSE based playbacks. | 837 // well and no longer has support for MSE based playbacks. |
| 838 if (url.SchemeIsBlob()) | 838 if (url.SchemeIsBlob()) |
| 839 return true; | 839 return true; |
| 840 | 840 |
| 841 // WMPI does not support HLS. | 841 // WMPI does not support HLS. |
| 842 if (media::MediaCodecUtil::IsHLSURL(url)) | 842 if (media::MediaCodecUtil::IsHLSURL(url)) |
| 843 return false; | 843 return false; |
| 844 | 844 |
| 845 // Don't use WMPI if the container likely contains a codec we can't decode in | 845 // Don't use WMPI if the container likely contains a codec we can't decode in |
| 846 // software and platform decoders are not available. | 846 // software and platform decoders are not available. |
| 847 if (!media::HasPlatformDecoderSupport()) { | 847 if (!media::HasPlatformDecoderSupport()) { |
| 848 // Assume that "mp4" means H264. Without platform decoder support we cannot | 848 // Assume that "mp4" means H264. Without platform decoder support we cannot |
| 849 // play it with Spitzer, thus fall back to AVDA. http://crbug.com/642988. | 849 // play it with Spitzer, thus fall back to AVDA. http://crbug.com/642988. |
| 850 if (base::ToLowerASCII(url.spec()).find("mp4") != std::string::npos) | 850 if (base::ToLowerASCII(url.spec()).find("mp4") != std::string::npos) |
| 851 return false; | 851 return false; |
| 852 } | 852 } |
| 853 | 853 |
| 854 // Indicates if the Android MediaPlayer should be used instead of WMPI. | 854 // Indicates if the Android MediaPlayer should be used instead of WMPI. |
| 855 if (GetContentClient()->renderer()->ShouldUseMediaPlayerForURL(url)) | 855 if (GetContentClient()->renderer()->ShouldUseMediaPlayerForURL(url)) |
| 856 return false; | 856 return false; |
| 857 | 857 |
| 858 // Otherwise enable WMPI if indicated via experiment or command line. | 858 // Otherwise, use WMPI. |
| 859 return media::IsUnifiedMediaPipelineEnabled(); | 859 return true; |
| 860 } | 860 } |
| 861 #endif // defined(OS_ANDROID) | 861 #endif // defined(OS_ANDROID) |
| 862 | 862 |
| 863 #if defined(ENABLE_MOJO_CDM) | |
| 864 // Returns whether mojo CDM should be used at runtime. Note that even when mojo | |
| 865 // CDM is enabled at compile time (ENABLE_MOJO_CDM is defined), there are cases | |
| 866 // where we want to choose other CDM types. For example, in the future, when we | |
| 867 // experiment mojo CDM on desktop, we will choose between mojo CDM and pepper | |
| 868 // CDM at runtime. | |
| 869 // TODO(xhwang): Remove this when we use mojo CDM for all remote CDM cases by | |
| 870 // default. | |
| 871 bool UseMojoCdm() { | |
| 872 #if defined(OS_ANDROID) | |
| 873 return media::IsUnifiedMediaPipelineEnabled(); | |
| 874 #else | |
| 875 return true; | |
| 876 #endif | |
| 877 } | |
| 878 #endif // defined(ENABLE_MOJO_CDM) | |
| 879 | |
| 880 double ConvertToBlinkTime(const base::TimeTicks& time_ticks) { | 863 double ConvertToBlinkTime(const base::TimeTicks& time_ticks) { |
| 881 return (time_ticks - base::TimeTicks()).InSecondsF(); | 864 return (time_ticks - base::TimeTicks()).InSecondsF(); |
| 882 } | 865 } |
| 883 | 866 |
| 884 } // namespace | 867 } // namespace |
| 885 | 868 |
| 886 struct RenderFrameImpl::PendingFileChooser { | 869 struct RenderFrameImpl::PendingFileChooser { |
| 887 PendingFileChooser(const FileChooserParams& p, | 870 PendingFileChooser(const FileChooserParams& p, |
| 888 blink::WebFileChooserCompletion* c) | 871 blink::WebFileChooserCompletion* c) |
| 889 : params(p), completion(c) {} | 872 : params(p), completion(c) {} |
| (...skipping 5629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6519 GetRemoteInterfaces()->GetInterface(&remoter_factory_); | 6502 GetRemoteInterfaces()->GetInterface(&remoter_factory_); |
| 6520 return remoter_factory_.get(); | 6503 return remoter_factory_.get(); |
| 6521 } | 6504 } |
| 6522 #endif | 6505 #endif |
| 6523 | 6506 |
| 6524 media::CdmFactory* RenderFrameImpl::GetCdmFactory() { | 6507 media::CdmFactory* RenderFrameImpl::GetCdmFactory() { |
| 6525 if (cdm_factory_) | 6508 if (cdm_factory_) |
| 6526 return cdm_factory_.get(); | 6509 return cdm_factory_.get(); |
| 6527 | 6510 |
| 6528 #if defined(ENABLE_MOJO_CDM) | 6511 #if defined(ENABLE_MOJO_CDM) |
| 6529 if (UseMojoCdm()) { | 6512 cdm_factory_.reset(new media::MojoCdmFactory(GetMediaInterfaceProvider())); |
| 6530 cdm_factory_.reset(new media::MojoCdmFactory(GetMediaInterfaceProvider())); | 6513 return cdm_factory_.get(); |
| 6531 return cdm_factory_.get(); | |
| 6532 } | |
| 6533 #endif // defined(ENABLE_MOJO_CDM) | 6514 #endif // defined(ENABLE_MOJO_CDM) |
| 6534 | 6515 |
| 6535 #if BUILDFLAG(ENABLE_PEPPER_CDMS) | 6516 #if BUILDFLAG(ENABLE_PEPPER_CDMS) |
| 6536 DCHECK(frame_); | 6517 DCHECK(frame_); |
| 6537 cdm_factory_.reset( | 6518 cdm_factory_.reset( |
| 6538 new RenderCdmFactory(base::Bind(&PepperCdmWrapperImpl::Create, frame_))); | 6519 new RenderCdmFactory(base::Bind(&PepperCdmWrapperImpl::Create, frame_))); |
| 6539 #endif // BUILDFLAG(ENABLE_PEPPER_CDMS) | 6520 #endif // BUILDFLAG(ENABLE_PEPPER_CDMS) |
| 6540 | 6521 |
| 6541 #if BUILDFLAG(ENABLE_MEDIA_REMOTING) | 6522 #if BUILDFLAG(ENABLE_MEDIA_REMOTING) |
| 6542 cdm_factory_.reset(new media::remoting::RemotingCdmFactory( | 6523 cdm_factory_.reset(new media::remoting::RemotingCdmFactory( |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6808 // event target. Potentially a Pepper plugin will receive the event. | 6789 // event target. Potentially a Pepper plugin will receive the event. |
| 6809 // In order to tell whether a plugin gets the last mouse event and which it | 6790 // In order to tell whether a plugin gets the last mouse event and which it |
| 6810 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets | 6791 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets |
| 6811 // the event, it will notify us via DidReceiveMouseEvent() and set itself as | 6792 // the event, it will notify us via DidReceiveMouseEvent() and set itself as |
| 6812 // |pepper_last_mouse_event_target_|. | 6793 // |pepper_last_mouse_event_target_|. |
| 6813 pepper_last_mouse_event_target_ = nullptr; | 6794 pepper_last_mouse_event_target_ = nullptr; |
| 6814 #endif | 6795 #endif |
| 6815 } | 6796 } |
| 6816 | 6797 |
| 6817 } // namespace content | 6798 } // namespace content |
| OLD | NEW |