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

Unified Diff: media/base/media.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: media/base/media.cc
diff --git a/media/base/media.cc b/media/base/media.cc
index f55d1c437a5bf6e3baee3b23a10355ce635153de..da810368cfedcefffe0900aac0b02d31db3284cc 100644
--- a/media/base/media.cc
+++ b/media/base/media.cc
@@ -4,15 +4,18 @@
#include "media/base/media.h"
-#include "base/files/file_path.h"
+#include "base/command_line.h"
#include "base/lazy_instance.h"
#include "base/macros.h"
-#include "base/path_service.h"
-#include "base/synchronization/lock.h"
+#include "base/metrics/field_trial.h"
#include "base/trace_event/trace_event.h"
-#include "build/build_config.h"
+#include "media/base/media_switches.h"
#include "media/base/yuv_convert.h"
+#if defined(OS_ANDROID)
+#include "media/base/android/media_codec_util.h"
+#endif
+
#if !defined(MEDIA_DISABLE_FFMPEG)
#include "media/ffmpeg/ffmpeg_common.h"
#endif
@@ -21,6 +24,13 @@ namespace media {
// Media must only be initialized once, so use a LazyInstance to ensure this.
class MediaInitializer {
+ public:
+ void enable_platform_decoder_support() {
+ has_platform_decoder_support_ = true;
+ }
+
+ bool has_platform_decoder_support() { return has_platform_decoder_support_; }
+
private:
friend struct base::DefaultLazyInstanceTraits<MediaInitializer>;
@@ -51,6 +61,8 @@ class MediaInitializer {
NOTREACHED() << "MediaInitializer should be leaky!";
}
+ bool has_platform_decoder_support_ = false;
+
DISALLOW_COPY_AND_ASSIGN(MediaInitializer);
};
@@ -61,4 +73,38 @@ void InitializeMediaLibrary() {
g_media_library.Get();
}
+void EnablePlatformDecoderSupport() {
+ g_media_library.Pointer()->enable_platform_decoder_support();
+}
+
+bool HasPlatformDecoderSupport() {
+ return g_media_library.Pointer()->has_platform_decoder_support();
+}
+
+#if defined(OS_ANDROID)
+bool IsUnifiedMediaPipelineEnabled() {
+ // 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);
+ return enabled_via_cli ||
+ base::StartsWith(group_name, "Enabled", base::CompareCase::SENSITIVE);
+}
+
+bool IsUnifiedMediaPipelineEnabledForMse() {
+ // The unified media pipeline is available for MSE even when not normally
ddorwin 2016/02/16 20:34:36 This comment applies to the second half of the con
DaleCurtis 2016/02/17 03:01:05 Removed the comment and put it on the method proto
+ // enabled if the MediaCodec is not available -- since otherwise it would
ddorwin 2016/02/16 20:34:36 This won't work unless you change the path that di
DaleCurtis 2016/02/17 03:01:05 Thanks for the pointer, done!
+ // mean that MSE can't be used at all.
ddorwin 2016/02/16 20:34:37 Codecs that are only supported by the platform (e.
+ return IsUnifiedMediaPipelineEnabled() ||
DaleCurtis 2016/02/13 05:54:28 Just realized this part is wrong. It should not in
DaleCurtis 2016/02/17 03:01:05 Disregard, this seems okay. Don't remember why I w
+ !MediaCodecUtil::IsMediaCodecAvailable();
+}
+#endif
+
} // namespace media

Powered by Google App Engine
This is Rietveld 408576698