| 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..397de5cefbe9a212b3d985e42e13376e9a995cb8 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) {
|
| + // 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,14 @@ blink::WebMediaPlayer* RenderFrameImpl::createMediaPlayer(
|
| GetMediaPermission(), initial_cdm);
|
|
|
| #if defined(OS_ANDROID)
|
| + // TODO(sandersd): Blacklist devices.
|
| + GURL gurl = url;
|
| 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)
|
|
|