OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // Software qualification test for FFmpeg. This test is used to certify that | 5 // Software qualification test for FFmpeg. This test is used to certify that |
6 // software decoding quality and performance of FFmpeg meets a mimimum | 6 // software decoding quality and performance of FFmpeg meets a mimimum |
7 // standard. | 7 // standard. |
8 | 8 |
9 #include <iomanip> | 9 #include <iomanip> |
10 #include <iostream> | 10 #include <iostream> |
(...skipping 12 matching lines...) Expand all Loading... |
23 #include "media/ffmpeg/file_protocol.h" | 23 #include "media/ffmpeg/file_protocol.h" |
24 #include "media/filters/ffmpeg_video_decoder.h" | 24 #include "media/filters/ffmpeg_video_decoder.h" |
25 | 25 |
26 #ifdef DEBUG | 26 #ifdef DEBUG |
27 #define SHOW_VERBOSE 1 | 27 #define SHOW_VERBOSE 1 |
28 #else | 28 #else |
29 #define SHOW_VERBOSE 0 | 29 #define SHOW_VERBOSE 0 |
30 #endif | 30 #endif |
31 | 31 |
32 #if defined(OS_WIN) | 32 #if defined(OS_WIN) |
| 33 |
| 34 // Enable to build with exception handler |
| 35 //#define ENABLE_WINDOWS_EXCEPTIONS 1 |
| 36 |
| 37 #ifdef ENABLE_WINDOWS_EXCEPTIONS |
33 // warning: disable warning about exception handler. | 38 // warning: disable warning about exception handler. |
34 #pragma warning(disable:4509) | 39 #pragma warning(disable:4509) |
| 40 #endif |
35 | 41 |
36 // Thread priorities to make benchmark more stable. | 42 // Thread priorities to make benchmark more stable. |
37 | 43 |
38 void EnterTimingSection() { | 44 void EnterTimingSection() { |
39 SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_ABOVE_NORMAL); | 45 SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_ABOVE_NORMAL); |
40 } | 46 } |
41 | 47 |
42 void LeaveTimingSection() { | 48 void LeaveTimingSection() { |
43 SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_NORMAL); | 49 SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_NORMAL); |
44 } | 50 } |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 bool flush = false; | 100 bool flush = false; |
95 | 101 |
96 unsigned int hash_value = 5381u; // Seed for DJB2. | 102 unsigned int hash_value = 5381u; // Seed for DJB2. |
97 bool hash_djb2 = false; | 103 bool hash_djb2 = false; |
98 | 104 |
99 MD5Context ctx; // Intermediate MD5 data: do not use | 105 MD5Context ctx; // Intermediate MD5 data: do not use |
100 MD5Init(&ctx); | 106 MD5Init(&ctx); |
101 bool hash_md5 = false; | 107 bool hash_md5 = false; |
102 | 108 |
103 std::ostream* log_out = &std::cout; | 109 std::ostream* log_out = &std::cout; |
104 #if defined(OS_WIN) | 110 #if defined(ENABLE_WINDOWS_EXCEPTIONS) |
105 // Catch exceptions so this tool can be used in automated testing. | 111 // Catch exceptions so this tool can be used in automated testing. |
106 __try { | 112 __try { |
107 #endif | 113 #endif |
108 | 114 |
109 // Register FFmpeg and attempt to open file. | 115 // Register FFmpeg and attempt to open file. |
110 avcodec_init(); | 116 avcodec_init(); |
111 av_log_set_level(verbose_level); | 117 av_log_set_level(verbose_level); |
112 av_register_all(); | 118 av_register_all(); |
113 av_register_protocol(&kFFmpegFileProtocol); | 119 av_register_protocol(&kFFmpegFileProtocol); |
114 AVFormatContext* format_context = NULL; | 120 AVFormatContext* format_context = NULL; |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
468 *log_out << " DJB2 Hash:" << std::setw(11) << hash_value | 474 *log_out << " DJB2 Hash:" << std::setw(11) << hash_value |
469 << " " << in_path << std::endl; | 475 << " " << in_path << std::endl; |
470 } | 476 } |
471 if (hash_md5) { | 477 if (hash_md5) { |
472 MD5Digest digest; // The result of the computation. | 478 MD5Digest digest; // The result of the computation. |
473 MD5Final(&digest, &ctx); | 479 MD5Final(&digest, &ctx); |
474 *log_out << " MD5 Hash: " << MD5DigestToBase16(digest) | 480 *log_out << " MD5 Hash: " << MD5DigestToBase16(digest) |
475 << " " << in_path << std::endl; | 481 << " " << in_path << std::endl; |
476 } | 482 } |
477 #endif // SHOW_VERBOSE | 483 #endif // SHOW_VERBOSE |
478 #if defined(OS_WIN) | 484 #if defined(ENABLE_WINDOWS_EXCEPTIONS) |
479 } __except(EXCEPTION_EXECUTE_HANDLER) { | 485 } __except(EXCEPTION_EXECUTE_HANDLER) { |
480 *log_out << " Exception:" << std::setw(11) << GetExceptionCode() | 486 *log_out << " Exception:" << std::setw(11) << GetExceptionCode() |
481 << " " << in_path << std::endl; | 487 << " " << in_path << std::endl; |
482 return 1; | 488 return 1; |
483 } | 489 } |
484 #endif | 490 #endif |
485 CommandLine::Reset(); | 491 CommandLine::Reset(); |
486 return 0; | 492 return 0; |
487 } | 493 } |
488 | 494 |
OLD | NEW |