| 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 "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 #if defined(OS_ANDROID) | 110 #if defined(OS_ANDROID) |
| 111 return base::android::BuildInfo::GetInstance()->sdk_int() >= 21; | 111 return base::android::BuildInfo::GetInstance()->sdk_int() >= 21; |
| 112 #else | 112 #else |
| 113 return true; | 113 return true; |
| 114 #endif // defined(OS_ANDROID) | 114 #endif // defined(OS_ANDROID) |
| 115 #else | 115 #else |
| 116 return false; | 116 return false; |
| 117 #endif // BUILDFLAG(ENABLE_HEVC_DEMUXING) | 117 #endif // BUILDFLAG(ENABLE_HEVC_DEMUXING) |
| 118 } | 118 } |
| 119 | 119 |
| 120 static bool HasDolbyVisionSupport() { |
| 121 #if BUILDFLAG(ENABLE_DOLBY_VISION_DEMUXING) && !defined(OS_ANDROID) |
| 122 return true; |
| 123 #else |
| 124 return false; |
| 125 #endif // BUILDFLAG(ENABLE_DOLBY_VISION_DEMUXING) && !defined(OS_ANDROID) |
| 126 } |
| 127 |
| 120 TEST(MimeUtilTest, CommonMediaMimeType) { | 128 TEST(MimeUtilTest, CommonMediaMimeType) { |
| 121 EXPECT_TRUE(IsSupportedMediaMimeType("audio/webm")); | 129 EXPECT_TRUE(IsSupportedMediaMimeType("audio/webm")); |
| 122 EXPECT_TRUE(IsSupportedMediaMimeType("video/webm")); | 130 EXPECT_TRUE(IsSupportedMediaMimeType("video/webm")); |
| 123 | 131 |
| 124 EXPECT_TRUE(IsSupportedMediaMimeType("audio/wav")); | 132 EXPECT_TRUE(IsSupportedMediaMimeType("audio/wav")); |
| 125 EXPECT_TRUE(IsSupportedMediaMimeType("audio/x-wav")); | 133 EXPECT_TRUE(IsSupportedMediaMimeType("audio/x-wav")); |
| 126 | 134 |
| 127 EXPECT_TRUE(IsSupportedMediaMimeType("audio/flac")); | 135 EXPECT_TRUE(IsSupportedMediaMimeType("audio/flac")); |
| 128 | 136 |
| 129 EXPECT_TRUE(IsSupportedMediaMimeType("audio/ogg")); | 137 EXPECT_TRUE(IsSupportedMediaMimeType("audio/ogg")); |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 EXPECT_EQ(info.has_platform_vp8_decoder, result); | 289 EXPECT_EQ(info.has_platform_vp8_decoder, result); |
| 282 break; | 290 break; |
| 283 | 291 |
| 284 case MimeUtil::VP9: | 292 case MimeUtil::VP9: |
| 285 EXPECT_EQ(info.has_platform_vp9_decoder, result); | 293 EXPECT_EQ(info.has_platform_vp9_decoder, result); |
| 286 break; | 294 break; |
| 287 | 295 |
| 288 case MimeUtil::HEVC: | 296 case MimeUtil::HEVC: |
| 289 EXPECT_EQ(HasHevcSupport(), result); | 297 EXPECT_EQ(HasHevcSupport(), result); |
| 290 break; | 298 break; |
| 299 |
| 300 case MimeUtil::DolbyVision: |
| 301 EXPECT_EQ(HasDolbyVisionSupport(), result); |
| 302 break; |
| 291 } | 303 } |
| 292 }); | 304 }); |
| 293 } | 305 } |
| 294 | 306 |
| 295 TEST(IsCodecSupportedOnPlatformTest, ClearCodecBehaviorWithAndroidPipeline) { | 307 TEST(IsCodecSupportedOnPlatformTest, ClearCodecBehaviorWithAndroidPipeline) { |
| 296 // Vary all parameters except |is_unified_media_pipeline_enabled|. | 308 // Vary all parameters except |is_unified_media_pipeline_enabled|. |
| 297 MimeUtil::PlatformInfo states_to_vary = VaryAllFields(); | 309 MimeUtil::PlatformInfo states_to_vary = VaryAllFields(); |
| 298 states_to_vary.is_unified_media_pipeline_enabled = false; | 310 states_to_vary.is_unified_media_pipeline_enabled = false; |
| 299 | 311 |
| 300 // Disable the unified pipeline. | 312 // Disable the unified pipeline. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 break; | 345 break; |
| 334 | 346 |
| 335 case MimeUtil::VP9: | 347 case MimeUtil::VP9: |
| 336 // MediaPlayer only supports VP9 in WebM. | 348 // MediaPlayer only supports VP9 in WebM. |
| 337 EXPECT_FALSE(result); | 349 EXPECT_FALSE(result); |
| 338 break; | 350 break; |
| 339 | 351 |
| 340 case MimeUtil::HEVC: | 352 case MimeUtil::HEVC: |
| 341 EXPECT_EQ(HasHevcSupport(), result); | 353 EXPECT_EQ(HasHevcSupport(), result); |
| 342 break; | 354 break; |
| 355 |
| 356 case MimeUtil::DolbyVision: |
| 357 EXPECT_EQ(HasDolbyVisionSupport(), result); |
| 358 break; |
| 343 } | 359 } |
| 344 }); | 360 }); |
| 345 | 361 |
| 346 // Verify vp9 support in WebM. | 362 // Verify vp9 support in WebM. |
| 347 RunCodecSupportTest( | 363 RunCodecSupportTest( |
| 348 states_to_vary, test_states, | 364 states_to_vary, test_states, |
| 349 [](const MimeUtil::PlatformInfo& info, MimeUtil::Codec codec) { | 365 [](const MimeUtil::PlatformInfo& info, MimeUtil::Codec codec) { |
| 350 const bool result = MimeUtil::IsCodecSupportedOnPlatform( | 366 const bool result = MimeUtil::IsCodecSupportedOnPlatform( |
| 351 codec, "video/webm", true, info); | 367 codec, "video/webm", true, info); |
| 352 if (codec == MimeUtil::VP9) | 368 if (codec == MimeUtil::VP9) |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 break; | 407 break; |
| 392 | 408 |
| 393 // These codecs are only supported if platform decoders are supported. | 409 // These codecs are only supported if platform decoders are supported. |
| 394 case MimeUtil::H264: | 410 case MimeUtil::H264: |
| 395 EXPECT_EQ(info.has_platform_decoders, result); | 411 EXPECT_EQ(info.has_platform_decoders, result); |
| 396 break; | 412 break; |
| 397 | 413 |
| 398 case MimeUtil::HEVC: | 414 case MimeUtil::HEVC: |
| 399 EXPECT_EQ(HasHevcSupport() && info.has_platform_decoders, result); | 415 EXPECT_EQ(HasHevcSupport() && info.has_platform_decoders, result); |
| 400 break; | 416 break; |
| 417 |
| 418 case MimeUtil::DolbyVision: |
| 419 EXPECT_EQ(HasDolbyVisionSupport(), result); |
| 420 break; |
| 401 } | 421 } |
| 402 }); | 422 }); |
| 403 } | 423 } |
| 404 | 424 |
| 405 TEST(IsCodecSupportedOnPlatformTest, OpusOggSupport) { | 425 TEST(IsCodecSupportedOnPlatformTest, OpusOggSupport) { |
| 406 // Vary all parameters; thus use default initial state. | 426 // Vary all parameters; thus use default initial state. |
| 407 MimeUtil::PlatformInfo states_to_vary = VaryAllFields(); | 427 MimeUtil::PlatformInfo states_to_vary = VaryAllFields(); |
| 408 MimeUtil::PlatformInfo test_states; | 428 MimeUtil::PlatformInfo test_states; |
| 409 | 429 |
| 410 RunCodecSupportTest( | 430 RunCodecSupportTest( |
| (...skipping 15 matching lines...) Expand all Loading... |
| 426 [](const MimeUtil::PlatformInfo& info, MimeUtil::Codec codec) { | 446 [](const MimeUtil::PlatformInfo& info, MimeUtil::Codec codec) { |
| 427 EXPECT_FALSE(MimeUtil::IsCodecSupportedOnPlatform( | 447 EXPECT_FALSE(MimeUtil::IsCodecSupportedOnPlatform( |
| 428 MimeUtil::MPEG2_AAC, "application/x-mpegurl", false, info)); | 448 MimeUtil::MPEG2_AAC, "application/x-mpegurl", false, info)); |
| 429 EXPECT_FALSE(MimeUtil::IsCodecSupportedOnPlatform( | 449 EXPECT_FALSE(MimeUtil::IsCodecSupportedOnPlatform( |
| 430 MimeUtil::MPEG2_AAC, "application/vnd.apple.mpegurl", false, info)); | 450 MimeUtil::MPEG2_AAC, "application/vnd.apple.mpegurl", false, info)); |
| 431 }); | 451 }); |
| 432 } | 452 } |
| 433 | 453 |
| 434 } // namespace internal | 454 } // namespace internal |
| 435 } // namespace media | 455 } // namespace media |
| OLD | NEW |