Chromium Code Reviews| Index: content/renderer/render_frame_impl.cc |
| diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc |
| index 9ea32c42984c04e9f13f96ab843861983d9c65d7..940e2be77ec950cd29f4ac61d5a31ae53e9cffd7 100644 |
| --- a/content/renderer/render_frame_impl.cc |
| +++ b/content/renderer/render_frame_impl.cc |
| @@ -132,6 +132,7 @@ |
| #include "crypto/sha2.h" |
| #include "gin/modules/module_registry.h" |
| #include "media/audio/audio_output_device.h" |
| +#include "media/base/android/media_codec_util.h" |
| #include "media/base/audio_renderer_mixer_input.h" |
| #include "media/base/media_log.h" |
| #include "media/base/media_switches.h" |
| @@ -2319,6 +2320,19 @@ blink::WebPlugin* RenderFrameImpl::createPlugin( |
| #endif // defined(ENABLE_PLUGINS) |
| } |
| +#if defined(OS_ANDROID) |
| +// Checks whether we should use MediaPlayer to play a URL because it is likely |
| +// to be HLS. |
| +static bool IsHLSURL(GURL& url) { |
|
watk
2016/01/06 01:17:21
The style guide says refs must be const (https://g
sandersd (OOO until July 31)
2016/01/06 01:27:01
Done.
|
| + // Other schemes are not supported by MediaPlayer for HLS playback. |
| + if (!url.SchemeIsHTTPOrHTTPS() && !url.SchemeIsFile()) |
| + return false; |
| + |
| + std::string path = url.path(); |
| + return base::EndsWith(path, ".m3u8", base::CompareCase::INSENSITIVE_ASCII); |
| +} |
| +#endif // defined(OS_ANDROID) |
| + |
| blink::WebMediaPlayer* RenderFrameImpl::createMediaPlayer( |
| blink::WebLocalFrame* frame, |
| const blink::WebURL& url, |
| @@ -2361,10 +2375,13 @@ blink::WebMediaPlayer* RenderFrameImpl::createMediaPlayer( |
| GetMediaPermission(), initial_cdm); |
| #if defined(OS_ANDROID) |
| + GURL gurl = url; |
|
watk
2016/01/06 01:17:20
I'm guessing you can delete this and pass url dire
sandersd (OOO until July 31)
2016/01/06 01:27:01
And the world makes sense once again. (Done)
|
| if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| - switches::kEnableUnifiedMediaPipeline)) { |
| - // TODO(sandersd): This check should be grown to include HLS and blacklist |
| - // checks. http://crbug.com/516765 |
| + switches::kEnableUnifiedMediaPipeline) || |
| + base::CommandLine::ForCurrentProcess()->HasSwitch( |
| + switches::kDisableAcceleratedVideoDecode) || |
| + !media::MediaCodecUtil::IsMediaCodecAvailable() || |
| + IsHLSURL(gurl)) { |
| return CreateAndroidWebMediaPlayer(client, encrypted_client, params); |
| } |
| #endif // defined(OS_ANDROID) |