Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(86)

Side by Side Diff: media/base/mime_util_unittest.cc

Issue 2572573007: Use passthrough decoder for (E)AC3 formats (Closed)
Patch Set: Sanity checks Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/base/mime_util_internal.cc ('k') | media/filters/android/media_codec_audio_decoder.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 return false; 117 return false;
118 #endif // BUILDFLAG(ENABLE_HEVC_DEMUXING) 118 #endif // BUILDFLAG(ENABLE_HEVC_DEMUXING)
119 } 119 }
120 120
121 // This is to validate MimeUtil::IsCodecSupportedOnPlatform(), which is used 121 // This is to validate MimeUtil::IsCodecSupportedOnPlatform(), which is used
122 // only on Android platform. 122 // only on Android platform.
123 static bool HasDolbyVisionSupport() { 123 static bool HasDolbyVisionSupport() {
124 return false; 124 return false;
125 } 125 }
126 126
127 static bool HasEac3Support() {
128 #if BUILDFLAG(ENABLE_AC3_EAC3_AUDIO_DEMUXING)
129 return true;
130 #else
131 return false;
132 #endif
133 }
134
127 TEST(MimeUtilTest, CommonMediaMimeType) { 135 TEST(MimeUtilTest, CommonMediaMimeType) {
128 EXPECT_TRUE(IsSupportedMediaMimeType("audio/webm")); 136 EXPECT_TRUE(IsSupportedMediaMimeType("audio/webm"));
129 EXPECT_TRUE(IsSupportedMediaMimeType("video/webm")); 137 EXPECT_TRUE(IsSupportedMediaMimeType("video/webm"));
130 138
131 EXPECT_TRUE(IsSupportedMediaMimeType("audio/wav")); 139 EXPECT_TRUE(IsSupportedMediaMimeType("audio/wav"));
132 EXPECT_TRUE(IsSupportedMediaMimeType("audio/x-wav")); 140 EXPECT_TRUE(IsSupportedMediaMimeType("audio/x-wav"));
133 141
134 EXPECT_TRUE(IsSupportedMediaMimeType("audio/flac")); 142 EXPECT_TRUE(IsSupportedMediaMimeType("audio/flac"));
135 143
136 EXPECT_TRUE(IsSupportedMediaMimeType("audio/ogg")); 144 EXPECT_TRUE(IsSupportedMediaMimeType("audio/ogg"));
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 test_states.has_platform_decoders = true; 275 test_states.has_platform_decoders = true;
268 276
269 RunCodecSupportTest( 277 RunCodecSupportTest(
270 states_to_vary, test_states, 278 states_to_vary, test_states,
271 [](const MimeUtil::PlatformInfo& info, MimeUtil::Codec codec) { 279 [](const MimeUtil::PlatformInfo& info, MimeUtil::Codec codec) {
272 const bool result = MimeUtil::IsCodecSupportedOnAndroid( 280 const bool result = MimeUtil::IsCodecSupportedOnAndroid(
273 codec, kTestMimeType, true, info); 281 codec, kTestMimeType, true, info);
274 switch (codec) { 282 switch (codec) {
275 // These codecs are never supported by the Android platform. 283 // These codecs are never supported by the Android platform.
276 case MimeUtil::INVALID_CODEC: 284 case MimeUtil::INVALID_CODEC:
277 case MimeUtil::AC3:
278 case MimeUtil::EAC3:
279 case MimeUtil::MPEG2_AAC: 285 case MimeUtil::MPEG2_AAC:
280 case MimeUtil::THEORA: 286 case MimeUtil::THEORA:
281 EXPECT_FALSE(result); 287 EXPECT_FALSE(result);
282 break; 288 break;
283 289
284 // These codecs are always available with platform decoder support. 290 // These codecs are always available with platform decoder support.
285 case MimeUtil::PCM: 291 case MimeUtil::PCM:
286 case MimeUtil::MP3: 292 case MimeUtil::MP3:
287 case MimeUtil::MPEG4_AAC: 293 case MimeUtil::MPEG4_AAC:
288 case MimeUtil::VORBIS: 294 case MimeUtil::VORBIS:
(...skipping 16 matching lines...) Expand all
305 EXPECT_EQ(info.has_platform_vp9_decoder, result); 311 EXPECT_EQ(info.has_platform_vp9_decoder, result);
306 break; 312 break;
307 313
308 case MimeUtil::HEVC: 314 case MimeUtil::HEVC:
309 EXPECT_EQ(HasHevcSupport(), result); 315 EXPECT_EQ(HasHevcSupport(), result);
310 break; 316 break;
311 317
312 case MimeUtil::DOLBY_VISION: 318 case MimeUtil::DOLBY_VISION:
313 EXPECT_EQ(HasDolbyVisionSupport(), result); 319 EXPECT_EQ(HasDolbyVisionSupport(), result);
314 break; 320 break;
321
322 case MimeUtil::AC3:
323 case MimeUtil::EAC3:
324 EXPECT_EQ(HasEac3Support(), result);
325 break;
315 } 326 }
316 }); 327 });
317 } 328 }
318 329
319 TEST(IsCodecSupportedOnAndroidTest, ClearCodecBehavior) { 330 TEST(IsCodecSupportedOnAndroidTest, ClearCodecBehavior) {
320 MimeUtil::PlatformInfo states_to_vary = VaryAllFields(); 331 MimeUtil::PlatformInfo states_to_vary = VaryAllFields();
321 332
322 MimeUtil::PlatformInfo test_states; 333 MimeUtil::PlatformInfo test_states;
323 334
324 RunCodecSupportTest( 335 RunCodecSupportTest(
325 states_to_vary, test_states, 336 states_to_vary, test_states,
326 [](const MimeUtil::PlatformInfo& info, MimeUtil::Codec codec) { 337 [](const MimeUtil::PlatformInfo& info, MimeUtil::Codec codec) {
327 const bool result = MimeUtil::IsCodecSupportedOnAndroid( 338 const bool result = MimeUtil::IsCodecSupportedOnAndroid(
328 codec, kTestMimeType, false, info); 339 codec, kTestMimeType, false, info);
329 switch (codec) { 340 switch (codec) {
330 // These codecs are never supported by the Android platform. 341 // These codecs are never supported by the Android platform.
331 case MimeUtil::INVALID_CODEC: 342 case MimeUtil::INVALID_CODEC:
332 case MimeUtil::AC3:
333 case MimeUtil::EAC3:
334 case MimeUtil::THEORA: 343 case MimeUtil::THEORA:
335 EXPECT_FALSE(result); 344 EXPECT_FALSE(result);
336 break; 345 break;
337 346
338 // These codecs are always supported with the unified pipeline. 347 // These codecs are always supported with the unified pipeline.
339 case MimeUtil::FLAC: 348 case MimeUtil::FLAC:
340 case MimeUtil::H264: 349 case MimeUtil::H264:
341 case MimeUtil::PCM: 350 case MimeUtil::PCM:
342 case MimeUtil::MPEG2_AAC: 351 case MimeUtil::MPEG2_AAC:
343 case MimeUtil::MP3: 352 case MimeUtil::MP3:
344 case MimeUtil::MPEG4_AAC: 353 case MimeUtil::MPEG4_AAC:
345 case MimeUtil::OPUS: 354 case MimeUtil::OPUS:
346 case MimeUtil::VORBIS: 355 case MimeUtil::VORBIS:
347 case MimeUtil::VP8: 356 case MimeUtil::VP8:
348 case MimeUtil::VP9: 357 case MimeUtil::VP9:
349 EXPECT_TRUE(result); 358 EXPECT_TRUE(result);
350 break; 359 break;
351 360
352 // These codecs are only supported if platform decoders are supported. 361 // These codecs are only supported if platform decoders are supported.
353 case MimeUtil::HEVC: 362 case MimeUtil::HEVC:
354 EXPECT_EQ(HasHevcSupport() && info.has_platform_decoders, result); 363 EXPECT_EQ(HasHevcSupport() && info.has_platform_decoders, result);
355 break; 364 break;
356 365
357 case MimeUtil::DOLBY_VISION: 366 case MimeUtil::DOLBY_VISION:
358 EXPECT_EQ(HasDolbyVisionSupport(), result); 367 EXPECT_EQ(HasDolbyVisionSupport(), result);
359 break; 368 break;
369
370 case MimeUtil::AC3:
371 case MimeUtil::EAC3:
372 EXPECT_EQ(HasEac3Support(), result);
373 break;
360 } 374 }
361 }); 375 });
362 } 376 }
363 377
364 TEST(IsCodecSupportedOnAndroidTest, OpusOggSupport) { 378 TEST(IsCodecSupportedOnAndroidTest, OpusOggSupport) {
365 // Vary all parameters; thus use default initial state. 379 // Vary all parameters; thus use default initial state.
366 MimeUtil::PlatformInfo states_to_vary = VaryAllFields(); 380 MimeUtil::PlatformInfo states_to_vary = VaryAllFields();
367 MimeUtil::PlatformInfo test_states; 381 MimeUtil::PlatformInfo test_states;
368 382
369 RunCodecSupportTest( 383 RunCodecSupportTest(
(...skipping 18 matching lines...) Expand all
388 MimeUtil::MPEG2_AAC, "application/vnd.apple.mpegurl", false, info)); 402 MimeUtil::MPEG2_AAC, "application/vnd.apple.mpegurl", false, info));
389 EXPECT_FALSE(MimeUtil::IsCodecSupportedOnAndroid( 403 EXPECT_FALSE(MimeUtil::IsCodecSupportedOnAndroid(
390 MimeUtil::MPEG2_AAC, "audio/mpegurl", false, info)); 404 MimeUtil::MPEG2_AAC, "audio/mpegurl", false, info));
391 EXPECT_FALSE(MimeUtil::IsCodecSupportedOnAndroid( 405 EXPECT_FALSE(MimeUtil::IsCodecSupportedOnAndroid(
392 MimeUtil::MPEG2_AAC, "audio/x-mpegurl", false, info)); 406 MimeUtil::MPEG2_AAC, "audio/x-mpegurl", false, info));
393 }); 407 });
394 } 408 }
395 409
396 } // namespace internal 410 } // namespace internal
397 } // namespace media 411 } // namespace media
OLDNEW
« no previous file with comments | « media/base/mime_util_internal.cc ('k') | media/filters/android/media_codec_audio_decoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698