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

Side by Side Diff: media/base/media.cc

Issue 1825763002: media: Enable Unified Media Pipeline for MSE and EME on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/base/media.h" 5 #include "media/base/media.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/metrics/field_trial.h" 10 #include "base/metrics/field_trial.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 DISALLOW_COPY_AND_ASSIGN(MediaInitializer); 67 DISALLOW_COPY_AND_ASSIGN(MediaInitializer);
68 }; 68 };
69 69
70 static base::LazyInstance<MediaInitializer>::Leaky g_media_library = 70 static base::LazyInstance<MediaInitializer>::Leaky g_media_library =
71 LAZY_INSTANCE_INITIALIZER; 71 LAZY_INSTANCE_INITIALIZER;
72 72
73 void InitializeMediaLibrary() { 73 void InitializeMediaLibrary() {
74 g_media_library.Get(); 74 g_media_library.Get();
75 } 75 }
76 76
77 bool IsMojoCdmEnabled() {
ddorwin 2016/03/24 18:05:11 Should this be ifdef'd to ENABLE_MOJO_CDMS?
xhwang 2016/03/24 21:26:04 Good point. Actually "media" should not know about
78 #if defined(OS_ANDROID)
79 return IsUnifiedMediaPipelineEnabled();
80 #else
81 return true;
82 #endif
83 }
84
77 #if defined(OS_ANDROID) 85 #if defined(OS_ANDROID)
78 void EnablePlatformDecoderSupport() { 86 void EnablePlatformDecoderSupport() {
79 g_media_library.Pointer()->enable_platform_decoder_support(); 87 g_media_library.Pointer()->enable_platform_decoder_support();
80 } 88 }
81 89
82 bool HasPlatformDecoderSupport() { 90 bool HasPlatformDecoderSupport() {
83 return g_media_library.Pointer()->has_platform_decoder_support(); 91 return g_media_library.Pointer()->has_platform_decoder_support();
84 } 92 }
85 93
86 bool PlatformHasOpusSupport() { 94 bool PlatformHasOpusSupport() {
(...skipping 13 matching lines...) Expand all
100 // UMA reports the correct group. 108 // UMA reports the correct group.
101 const std::string group_name = 109 const std::string group_name =
102 base::FieldTrialList::FindFullName("UnifiedMediaPipelineTrial"); 110 base::FieldTrialList::FindFullName("UnifiedMediaPipelineTrial");
103 const bool enabled_via_cli = 111 const bool enabled_via_cli =
104 base::CommandLine::ForCurrentProcess()->HasSwitch( 112 base::CommandLine::ForCurrentProcess()->HasSwitch(
105 switches::kEnableUnifiedMediaPipeline); 113 switches::kEnableUnifiedMediaPipeline);
106 return enabled_via_cli || 114 return enabled_via_cli ||
107 base::StartsWith(group_name, "Enabled", base::CompareCase::SENSITIVE); 115 base::StartsWith(group_name, "Enabled", base::CompareCase::SENSITIVE);
108 } 116 }
109 117
110 bool IsUnifiedMediaPipelineEnabledForMse() {
111 // Don't check IsUnifiedMediaPipelineEnabled() here since we don't want MSE to
112 // be enabled via experiment yet; only when the existing implementation can't
113 // be used (i.e. MediaCodec unavailable).
114 return base::CommandLine::ForCurrentProcess()->HasSwitch(
115 switches::kEnableUnifiedMediaPipeline) ||
116 !MediaCodecUtil::IsMediaCodecAvailable();
117 }
118
119 bool ArePlatformDecodersAvailable() { 118 bool ArePlatformDecodersAvailable() {
120 return IsUnifiedMediaPipelineEnabled() 119 return IsUnifiedMediaPipelineEnabled()
121 ? HasPlatformDecoderSupport() 120 ? HasPlatformDecoderSupport()
122 : MediaCodecUtil::IsMediaCodecAvailable(); 121 : MediaCodecUtil::IsMediaCodecAvailable();
123 } 122 }
124 #endif 123 #endif
125 124
126 } // namespace media 125 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698