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

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 compile error. 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
« no previous file with comments | « media/base/media.h ('k') | media/base/mime_util.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/media.cc
diff --git a/media/base/media.cc b/media/base/media.cc
index f55d1c437a5bf6e3baee3b23a10355ce635153de..efc495b682e3150fd0d40496d5859e13d5dc5d82 100644
--- a/media/base/media.cc
+++ b/media/base/media.cc
@@ -4,15 +4,19 @@
#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 "base/android/build_info.h"
+#include "media/base/android/media_codec_util.h"
+#endif
+
#if !defined(MEDIA_DISABLE_FFMPEG)
#include "media/ffmpeg/ffmpeg_common.h"
#endif
@@ -21,6 +25,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 +62,8 @@ class MediaInitializer {
NOTREACHED() << "MediaInitializer should be leaky!";
}
+ bool has_platform_decoder_support_ = false;
+
DISALLOW_COPY_AND_ASSIGN(MediaInitializer);
};
@@ -61,4 +74,47 @@ void InitializeMediaLibrary() {
g_media_library.Get();
}
+#if defined(OS_ANDROID)
+void EnablePlatformDecoderSupport() {
+ g_media_library.Pointer()->enable_platform_decoder_support();
+}
+
+bool HasPlatformDecoderSupport() {
+ return g_media_library.Pointer()->has_platform_decoder_support();
+}
+
+bool PlatformHasOpusSupport() {
+ return base::android::BuildInfo::GetInstance()->sdk_int() >= 21;
+}
+
+bool PlatformHasVp9Support() {
+ return base::android::BuildInfo::GetInstance()->sdk_int() >= 19;
+}
+
+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() {
+ // Don't check IsUnifiedMediaPipelineEnabled() here since we don't want MSE to
+ // be enabled via experiment yet; only when the existing implementation can't
+ // be used (i.e. MediaCodec unavailable).
+ return base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableUnifiedMediaPipeline) ||
+ !MediaCodecUtil::IsMediaCodecAvailable();
+}
+#endif
+
} // namespace media
« no previous file with comments | « media/base/media.h ('k') | media/base/mime_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698