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

Unified Diff: content/renderer/render_frame_impl.cc

Issue 1690063002: Fix mime type mappings when the unified media pipeline is enabled. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix all teh things. Created 4 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/render_frame_impl.cc
diff --git a/content/renderer/render_frame_impl.cc b/content/renderer/render_frame_impl.cc
index 3b26d3960814b3d34edddb01cd5555e1ff998597..b1d07d40a744ee53101ce164a600586e4729200b 100644
--- a/content/renderer/render_frame_impl.cc
+++ b/content/renderer/render_frame_impl.cc
@@ -133,6 +133,7 @@
#include "gin/modules/module_registry.h"
#include "media/audio/audio_output_device.h"
#include "media/base/audio_renderer_mixer_input.h"
+#include "media/base/media.h"
#include "media/base/media_log.h"
#include "media/base/media_switches.h"
#include "media/blink/url_index.h"
@@ -743,42 +744,33 @@ bool IsContentWithCertificateErrorsRelevantToUI(
}
#if defined(OS_ANDROID)
-// Returns true if WMPI must be used for playback because WMPA will not work.
-bool MustUseWebMediaPlayerImpl(blink::WebMediaPlayer::LoadType load_type,
- const GURL& url) {
- // WMPA can't play MSE if MediaCodec is unavailable. In this case WMPI may
- // still work (via libvpx).
- return (load_type == blink::WebMediaPlayer::LoadTypeMediaSource &&
- !media::MediaCodecUtil::IsMediaCodecAvailable());
-}
-
-// Returns true if WMPI can be used for playback, false if it may not work.
+// Returns true if WMPI should be used for playback, false otherwise.
//
-// Note that HLS and WebM detection are pre-redirect and path-based. It is
+// Note that HLS and MP4 detection are pre-redirect and path-based. It is
// possible to load such a URL and find different content.
-bool CanUseWebMediaPlayerImpl(blink::WebMediaPlayer::LoadType load_type,
- const GURL& url) {
- if (MustUseWebMediaPlayerImpl(load_type, url))
- return true;
+bool UseWebMediaPlayerImpl(blink::WebMediaPlayer::LoadType load_type,
+ const GURL& url) {
+ if (load_type == blink::WebMediaPlayer::LoadTypeMediaSource)
+ return media::IsUnifiedMediaPipelineEnabledForMse();
// WMPI does not support HLS.
if (media::MediaCodecUtil::IsHLSPath(url))
return false;
- // Otherwise --enable-unified-media-pipeline always enables WMPI.
- if (base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableUnifiedMediaPipeline)) {
- return true;
+ // Don't use WMPI if the container likely contains h264 and hardware decoders
ddorwin 2016/02/16 20:34:36 nit: s/h264/non-vpx codec/? IOW, if we don't have
DaleCurtis 2016/02/17 03:01:05 Done.
+ // are not available.
+ if (base::EndsWith(url.path(), ".mp4",
+ base::CompareCase::INSENSITIVE_ASCII) &&
+ (base::CommandLine::ForCurrentProcess()->HasSwitch(
ddorwin 2016/02/16 20:34:36 Should this be a call to HasPlatformDecoderSupport
DaleCurtis 2016/02/17 03:01:05 Done.
+ switches::kDisableAcceleratedVideoDecode) ||
+ !media::MediaCodecUtil::IsMediaCodecAvailable())) {
+ return false;
}
- // WMPI can always play WebM (via libvpx).
- if (base::EndsWith(url.path(), ".webm", base::CompareCase::INSENSITIVE_ASCII))
- return true;
-
- // Otherwise, WMPI can only be used if AVDA is working.
- return (!base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kDisableAcceleratedVideoDecode) &&
- media::MediaCodecUtil::IsMediaCodecAvailable());
+ // Otherwise enable WMPI if indicated via experiment or command line. Video
+ // decode may still be blacklisted for some codecs and platforms based on
ddorwin 2016/02/16 20:34:36 nit: Make it clearer that this means "there could
DaleCurtis 2016/02/17 03:01:05 Deleted this whole comment since I think it's just
+ // the GPU feature blacklist or the hardcoded blacklist inside MediaCodecUtil.
+ return media::IsUnifiedMediaPipelineEnabled();
}
#endif // defined(OS_ANDROID)
@@ -2494,27 +2486,8 @@ blink::WebMediaPlayer* RenderFrameImpl::createMediaPlayer(
GetMediaPermission(), initial_cdm);
#if defined(OS_ANDROID)
- if (!CanUseWebMediaPlayerImpl(load_type, url)) {
+ if (!UseWebMediaPlayerImpl(load_type, url))
return CreateAndroidWebMediaPlayer(client, encrypted_client, params);
- } else if (!MustUseWebMediaPlayerImpl(load_type, url)) {
- // TODO(dalecurtis): This experiment is temporary and should be removed once
- // we have enough data to support the primacy of the unified media pipeline;
- // see http://crbug.com/533190 for details.
- //
- // Note: It's important to query the field trial state first, to ensure that
- // UMA reports the correct group.
- const std::string group_name =
- base::FieldTrialList::FindFullName("UnifiedMediaPipelineTrial");
- const bool enabled_via_cli =
- base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableUnifiedMediaPipeline);
- const bool enable_unified_media_pipeline =
- enabled_via_cli ||
- base::StartsWith(group_name, "Enabled", base::CompareCase::SENSITIVE);
-
- if (!enable_unified_media_pipeline)
- return CreateAndroidWebMediaPlayer(client, encrypted_client, params);
- }
#endif // defined(OS_ANDROID)
#if defined(ENABLE_MOJO_MEDIA) && !defined(OS_ANDROID)

Powered by Google App Engine
This is Rietveld 408576698