| 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 #endif // BUILDFLAG(ENABLE_HEVC_DEMUXING) | 117 #endif // BUILDFLAG(ENABLE_HEVC_DEMUXING) |
| 118 } | 118 } |
| 119 | 119 |
| 120 TEST(MimeUtilTest, CommonMediaMimeType) { | 120 TEST(MimeUtilTest, CommonMediaMimeType) { |
| 121 EXPECT_TRUE(IsSupportedMediaMimeType("audio/webm")); | 121 EXPECT_TRUE(IsSupportedMediaMimeType("audio/webm")); |
| 122 EXPECT_TRUE(IsSupportedMediaMimeType("video/webm")); | 122 EXPECT_TRUE(IsSupportedMediaMimeType("video/webm")); |
| 123 | 123 |
| 124 EXPECT_TRUE(IsSupportedMediaMimeType("audio/wav")); | 124 EXPECT_TRUE(IsSupportedMediaMimeType("audio/wav")); |
| 125 EXPECT_TRUE(IsSupportedMediaMimeType("audio/x-wav")); | 125 EXPECT_TRUE(IsSupportedMediaMimeType("audio/x-wav")); |
| 126 | 126 |
| 127 EXPECT_TRUE(IsSupportedMediaMimeType("audio/flac")); |
| 128 |
| 127 EXPECT_TRUE(IsSupportedMediaMimeType("audio/ogg")); | 129 EXPECT_TRUE(IsSupportedMediaMimeType("audio/ogg")); |
| 128 EXPECT_TRUE(IsSupportedMediaMimeType("application/ogg")); | 130 EXPECT_TRUE(IsSupportedMediaMimeType("application/ogg")); |
| 129 #if defined(OS_ANDROID) | 131 #if defined(OS_ANDROID) |
| 130 EXPECT_FALSE(IsSupportedMediaMimeType("video/ogg")); | 132 EXPECT_FALSE(IsSupportedMediaMimeType("video/ogg")); |
| 131 #else | 133 #else |
| 132 EXPECT_TRUE(IsSupportedMediaMimeType("video/ogg")); | 134 EXPECT_TRUE(IsSupportedMediaMimeType("video/ogg")); |
| 133 #endif // OS_ANDROID | 135 #endif // OS_ANDROID |
| 134 | 136 |
| 135 #if defined(OS_ANDROID) && defined(USE_PROPRIETARY_CODECS) | 137 #if defined(OS_ANDROID) && defined(USE_PROPRIETARY_CODECS) |
| 136 // HLS is supported on Android API level 14 and higher and Chrome supports | 138 // HLS is supported on Android API level 14 and higher and Chrome supports |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 case MimeUtil::MPEG2_AAC: | 259 case MimeUtil::MPEG2_AAC: |
| 258 case MimeUtil::THEORA: | 260 case MimeUtil::THEORA: |
| 259 EXPECT_FALSE(result); | 261 EXPECT_FALSE(result); |
| 260 break; | 262 break; |
| 261 | 263 |
| 262 // These codecs are always available with platform decoder support. | 264 // These codecs are always available with platform decoder support. |
| 263 case MimeUtil::PCM: | 265 case MimeUtil::PCM: |
| 264 case MimeUtil::MP3: | 266 case MimeUtil::MP3: |
| 265 case MimeUtil::MPEG4_AAC: | 267 case MimeUtil::MPEG4_AAC: |
| 266 case MimeUtil::VORBIS: | 268 case MimeUtil::VORBIS: |
| 269 case MimeUtil::FLAC: |
| 267 case MimeUtil::H264: | 270 case MimeUtil::H264: |
| 268 EXPECT_TRUE(result); | 271 EXPECT_TRUE(result); |
| 269 break; | 272 break; |
| 270 | 273 |
| 271 // The remaining codecs are not available on all platforms even when | 274 // The remaining codecs are not available on all platforms even when |
| 272 // a platform decoder is available. | 275 // a platform decoder is available. |
| 273 case MimeUtil::OPUS: | 276 case MimeUtil::OPUS: |
| 274 EXPECT_EQ(info.supports_opus, result); | 277 EXPECT_EQ(info.supports_opus, result); |
| 275 break; | 278 break; |
| 276 | 279 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 307 // These codecs are never supported by the Android platform. | 310 // These codecs are never supported by the Android platform. |
| 308 case MimeUtil::INVALID_CODEC: | 311 case MimeUtil::INVALID_CODEC: |
| 309 case MimeUtil::AC3: | 312 case MimeUtil::AC3: |
| 310 case MimeUtil::EAC3: | 313 case MimeUtil::EAC3: |
| 311 case MimeUtil::MPEG2_AAC: | 314 case MimeUtil::MPEG2_AAC: |
| 312 case MimeUtil::THEORA: | 315 case MimeUtil::THEORA: |
| 313 EXPECT_FALSE(result); | 316 EXPECT_FALSE(result); |
| 314 break; | 317 break; |
| 315 | 318 |
| 316 // These codecs are always available via MediaPlayer. | 319 // These codecs are always available via MediaPlayer. |
| 320 case MimeUtil::FLAC: |
| 317 case MimeUtil::PCM: | 321 case MimeUtil::PCM: |
| 318 case MimeUtil::MP3: | 322 case MimeUtil::MP3: |
| 319 case MimeUtil::MPEG4_AAC: | 323 case MimeUtil::MPEG4_AAC: |
| 320 case MimeUtil::VORBIS: | 324 case MimeUtil::VORBIS: |
| 321 case MimeUtil::H264: | 325 case MimeUtil::H264: |
| 322 case MimeUtil::VP8: | 326 case MimeUtil::VP8: |
| 323 EXPECT_TRUE(result); | 327 EXPECT_TRUE(result); |
| 324 break; | 328 break; |
| 325 | 329 |
| 326 // The remaining codecs depend on the platform version. | 330 // The remaining codecs depend on the platform version. |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 switch (codec) { | 371 switch (codec) { |
| 368 // These codecs are never supported by the Android platform. | 372 // These codecs are never supported by the Android platform. |
| 369 case MimeUtil::INVALID_CODEC: | 373 case MimeUtil::INVALID_CODEC: |
| 370 case MimeUtil::AC3: | 374 case MimeUtil::AC3: |
| 371 case MimeUtil::EAC3: | 375 case MimeUtil::EAC3: |
| 372 case MimeUtil::THEORA: | 376 case MimeUtil::THEORA: |
| 373 EXPECT_FALSE(result); | 377 EXPECT_FALSE(result); |
| 374 break; | 378 break; |
| 375 | 379 |
| 376 // These codecs are always supported with the unified pipeline. | 380 // These codecs are always supported with the unified pipeline. |
| 381 case MimeUtil::FLAC: |
| 377 case MimeUtil::PCM: | 382 case MimeUtil::PCM: |
| 378 case MimeUtil::MPEG2_AAC: | 383 case MimeUtil::MPEG2_AAC: |
| 379 case MimeUtil::MP3: | 384 case MimeUtil::MP3: |
| 380 case MimeUtil::MPEG4_AAC: | 385 case MimeUtil::MPEG4_AAC: |
| 381 case MimeUtil::OPUS: | 386 case MimeUtil::OPUS: |
| 382 case MimeUtil::VORBIS: | 387 case MimeUtil::VORBIS: |
| 383 case MimeUtil::VP8: | 388 case MimeUtil::VP8: |
| 384 case MimeUtil::VP9: | 389 case MimeUtil::VP9: |
| 385 EXPECT_TRUE(result); | 390 EXPECT_TRUE(result); |
| 386 break; | 391 break; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 [](const MimeUtil::PlatformInfo& info, MimeUtil::Codec codec) { | 426 [](const MimeUtil::PlatformInfo& info, MimeUtil::Codec codec) { |
| 422 EXPECT_FALSE(MimeUtil::IsCodecSupportedOnPlatform( | 427 EXPECT_FALSE(MimeUtil::IsCodecSupportedOnPlatform( |
| 423 MimeUtil::MPEG2_AAC, "application/x-mpegurl", false, info)); | 428 MimeUtil::MPEG2_AAC, "application/x-mpegurl", false, info)); |
| 424 EXPECT_FALSE(MimeUtil::IsCodecSupportedOnPlatform( | 429 EXPECT_FALSE(MimeUtil::IsCodecSupportedOnPlatform( |
| 425 MimeUtil::MPEG2_AAC, "application/vnd.apple.mpegurl", false, info)); | 430 MimeUtil::MPEG2_AAC, "application/vnd.apple.mpegurl", false, info)); |
| 426 }); | 431 }); |
| 427 } | 432 } |
| 428 | 433 |
| 429 } // namespace internal | 434 } // namespace internal |
| 430 } // namespace media | 435 } // namespace media |
| OLD | NEW |