| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/strings/string_split.h" | 8 #include "base/strings/string_split.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "base/test/scoped_command_line.h" | 10 #include "base/test/scoped_command_line.h" |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 base::test::ScopedCommandLine scoped_command_line; | 227 base::test::ScopedCommandLine scoped_command_line; |
| 228 | 228 |
| 229 // Multi-part VP9 string not enabled by default. | 229 // Multi-part VP9 string not enabled by default. |
| 230 EXPECT_FALSE(IsSupportedMediaFormat("video/webm", {"vp09.00.10.08"})); | 230 EXPECT_FALSE(IsSupportedMediaFormat("video/webm", {"vp09.00.10.08"})); |
| 231 | 231 |
| 232 // Should work if enabled. | 232 // Should work if enabled. |
| 233 EnableNewVp9CodecStringSupport(); | 233 EnableNewVp9CodecStringSupport(); |
| 234 EXPECT_TRUE(IsSupportedMediaFormat("video/webm", {"vp09.00.10.08"})); | 234 EXPECT_TRUE(IsSupportedMediaFormat("video/webm", {"vp09.00.10.08"})); |
| 235 } | 235 } |
| 236 | 236 |
| 237 TEST(MimeUtilTest, Vp9ProfileSupport) { |
| 238 // TODO(chcunningham): remove when enabled by default. |
| 239 EnableNewVp9CodecStringSupport(); |
| 240 |
| 241 #if !defined(OS_ANDROID) |
| 242 // For all non-android platforms, support for any VP9 profile should be |
| 243 // unambiguous. |
| 244 |
| 245 // All platforms support profiles 0 and 1 |
| 246 EXPECT_EQ(IsSupported, |
| 247 IsSupportedMediaFormat("video/webm", {"vp09.00.10.08"})); |
| 248 EXPECT_EQ(IsSupported, |
| 249 IsSupportedMediaFormat("video/webm", {"vp09.01.10.08"})); |
| 250 |
| 251 // Support for 2 and 3 is platform dependent, but should never be ambiguous. |
| 252 EXPECT_NE(MayBeSupported, |
| 253 IsSupportedMediaFormat("video/webm", {"vp09.02.10.08"})); |
| 254 EXPECT_NE(MayBeSupported, |
| 255 IsSupportedMediaFormat("video/webm", {"vp09.03.10.08"})); |
| 256 #else |
| 257 // Android should always support profile 0. Support for higher profiles is |
| 258 // ambiguous. |
| 259 EXPECT_EQ(IsSupported, |
| 260 IsSupportedMediaFormat("video/webm", {"vp09.00.10.08"})); |
| 261 EXPECT_EQ(MayBeSupported, |
| 262 IsSupportedMediaFormat("video/webm", {"vp09.01.10.08"})); |
| 263 EXPECT_EQ(MayBeSupported, |
| 264 IsSupportedMediaFormat("video/webm", {"vp09.02.10.08"})); |
| 265 EXPECT_EQ(MayBeSupported, |
| 266 IsSupportedMediaFormat("video/webm", {"vp09.03.10.08"})); |
| 267 #endif |
| 268 |
| 269 // When using CDM decoders, support is currently only known for profile 0. |
| 270 EXPECT_EQ(IsSupported, |
| 271 IsSupportedEncryptedMediaFormat("video/webm", {"vp09.00.10.08"})); |
| 272 EXPECT_EQ(MayBeSupported, |
| 273 IsSupportedEncryptedMediaFormat("video/webm", {"vp09.01.10.08"})); |
| 274 EXPECT_EQ(MayBeSupported, |
| 275 IsSupportedEncryptedMediaFormat("video/webm", {"vp09.02.10.08"})); |
| 276 EXPECT_EQ(MayBeSupported, |
| 277 IsSupportedEncryptedMediaFormat("video/webm", {"vp09.03.10.08"})); |
| 278 } |
| 279 |
| 237 TEST(IsCodecSupportedOnAndroidTest, EncryptedCodecsFailWithoutPlatformSupport) { | 280 TEST(IsCodecSupportedOnAndroidTest, EncryptedCodecsFailWithoutPlatformSupport) { |
| 238 // Vary all parameters except |has_platform_decoders|. | 281 // Vary all parameters except |has_platform_decoders|. |
| 239 MimeUtil::PlatformInfo states_to_vary = VaryAllFields(); | 282 MimeUtil::PlatformInfo states_to_vary = VaryAllFields(); |
| 240 states_to_vary.has_platform_decoders = false; | 283 states_to_vary.has_platform_decoders = false; |
| 241 | 284 |
| 242 // Disable platform decoders. | 285 // Disable platform decoders. |
| 243 MimeUtil::PlatformInfo test_states; | 286 MimeUtil::PlatformInfo test_states; |
| 244 test_states.has_platform_decoders = false; | 287 test_states.has_platform_decoders = false; |
| 245 | 288 |
| 246 // Every codec should fail since platform support is missing and we've | 289 // Every codec should fail since platform support is missing and we've |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 MimeUtil::MPEG2_AAC, "application/vnd.apple.mpegurl", false, info)); | 430 MimeUtil::MPEG2_AAC, "application/vnd.apple.mpegurl", false, info)); |
| 388 EXPECT_FALSE(MimeUtil::IsCodecSupportedOnAndroid( | 431 EXPECT_FALSE(MimeUtil::IsCodecSupportedOnAndroid( |
| 389 MimeUtil::MPEG2_AAC, "audio/mpegurl", false, info)); | 432 MimeUtil::MPEG2_AAC, "audio/mpegurl", false, info)); |
| 390 EXPECT_FALSE(MimeUtil::IsCodecSupportedOnAndroid( | 433 EXPECT_FALSE(MimeUtil::IsCodecSupportedOnAndroid( |
| 391 MimeUtil::MPEG2_AAC, "audio/x-mpegurl", false, info)); | 434 MimeUtil::MPEG2_AAC, "audio/x-mpegurl", false, info)); |
| 392 }); | 435 }); |
| 393 } | 436 } |
| 394 | 437 |
| 395 } // namespace internal | 438 } // namespace internal |
| 396 } // namespace media | 439 } // namespace media |
| OLD | NEW |