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