| OLD | NEW |
| 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/allocator/features.h" | 7 #include "base/allocator/features.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 #if defined(OS_ANDROID) | 51 #if defined(OS_ANDROID) |
| 52 void enable_platform_decoder_support() { | 52 void enable_platform_decoder_support() { |
| 53 has_platform_decoder_support_ = true; | 53 has_platform_decoder_support_ = true; |
| 54 } | 54 } |
| 55 | 55 |
| 56 bool has_platform_decoder_support() const { | 56 bool has_platform_decoder_support() const { |
| 57 return has_platform_decoder_support_; | 57 return has_platform_decoder_support_; |
| 58 } | 58 } |
| 59 #endif // defined(OS_ANDROID) | 59 #endif // defined(OS_ANDROID) |
| 60 | 60 |
| 61 void enable_new_vp9_codec_string_support(bool enable) { | |
| 62 has_new_vp9_codec_string_support_ = enable; | |
| 63 } | |
| 64 | |
| 65 bool has_new_vp9_codec_string_support() { | |
| 66 return has_new_vp9_codec_string_support_; | |
| 67 } | |
| 68 | |
| 69 private: | 61 private: |
| 70 ~MediaInitializer() = delete; | 62 ~MediaInitializer() = delete; |
| 71 | 63 |
| 72 #if defined(OS_ANDROID) | 64 #if defined(OS_ANDROID) |
| 73 bool has_platform_decoder_support_ = false; | 65 bool has_platform_decoder_support_ = false; |
| 74 #endif // defined(OS_ANDROID) | 66 #endif // defined(OS_ANDROID) |
| 75 | 67 |
| 76 bool has_new_vp9_codec_string_support_ = false; | |
| 77 | |
| 78 DISALLOW_COPY_AND_ASSIGN(MediaInitializer); | 68 DISALLOW_COPY_AND_ASSIGN(MediaInitializer); |
| 79 }; | 69 }; |
| 80 | 70 |
| 81 static MediaInitializer* GetMediaInstance() { | 71 static MediaInitializer* GetMediaInstance() { |
| 82 static MediaInitializer* instance = new MediaInitializer(); | 72 static MediaInitializer* instance = new MediaInitializer(); |
| 83 return instance; | 73 return instance; |
| 84 } | 74 } |
| 85 | 75 |
| 86 void InitializeMediaLibrary() { | 76 void InitializeMediaLibrary() { |
| 87 GetMediaInstance(); | 77 GetMediaInstance(); |
| 88 } | 78 } |
| 89 | 79 |
| 90 #if defined(OS_ANDROID) | 80 #if defined(OS_ANDROID) |
| 91 void EnablePlatformDecoderSupport() { | 81 void EnablePlatformDecoderSupport() { |
| 92 GetMediaInstance()->enable_platform_decoder_support(); | 82 GetMediaInstance()->enable_platform_decoder_support(); |
| 93 } | 83 } |
| 94 | 84 |
| 95 bool HasPlatformDecoderSupport() { | 85 bool HasPlatformDecoderSupport() { |
| 96 return GetMediaInstance()->has_platform_decoder_support(); | 86 return GetMediaInstance()->has_platform_decoder_support(); |
| 97 } | 87 } |
| 98 | 88 |
| 99 bool PlatformHasOpusSupport() { | 89 bool PlatformHasOpusSupport() { |
| 100 return base::android::BuildInfo::GetInstance()->sdk_int() >= 21; | 90 return base::android::BuildInfo::GetInstance()->sdk_int() >= 21; |
| 101 } | 91 } |
| 102 #endif // defined(OS_ANDROID) | 92 #endif // defined(OS_ANDROID) |
| 103 | 93 |
| 104 void EnableNewVp9CodecStringSupport() { | |
| 105 GetMediaInstance()->enable_new_vp9_codec_string_support(true); | |
| 106 } | |
| 107 | |
| 108 void DisableNewVp9CodecStringSupport_ForTesting() { | |
| 109 GetMediaInstance()->enable_new_vp9_codec_string_support(false); | |
| 110 } | |
| 111 | |
| 112 bool HasNewVp9CodecStringSupport() { | |
| 113 return GetMediaInstance()->has_new_vp9_codec_string_support(); | |
| 114 } | |
| 115 | |
| 116 } // namespace media | 94 } // namespace media |
| OLD | NEW |