| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // Standalone benchmarking application based on FFmpeg. This tool is used to | 5 // Standalone benchmarking application based on FFmpeg. This tool is used to |
| 6 // measure decoding performance between different FFmpeg compile and run-time | 6 // measure decoding performance between different FFmpeg compile and run-time |
| 7 // options. We also use this tool to measure performance regressions when | 7 // options. We also use this tool to measure performance regressions when |
| 8 // testing newer builds of FFmpeg from trunk. | 8 // testing newer builds of FFmpeg from trunk. |
| 9 | 9 |
| 10 #include <iomanip> | 10 #include <iomanip> |
| 11 #include <iostream> | 11 #include <iostream> |
| 12 #include <string> | 12 #include <string> |
| 13 | 13 |
| 14 #include "base/at_exit.h" | 14 #include "base/at_exit.h" |
| 15 #include "base/basictypes.h" | 15 #include "base/basictypes.h" |
| 16 #include "base/command_line.h" | 16 #include "base/command_line.h" |
| 17 #include "base/file_util.h" | 17 #include "base/file_util.h" |
| 18 #include "base/files/file_path.h" | 18 #include "base/files/file_path.h" |
| 19 #include "base/files/memory_mapped_file.h" |
| 19 #include "base/logging.h" | 20 #include "base/logging.h" |
| 20 #include "base/md5.h" | 21 #include "base/md5.h" |
| 21 #include "base/path_service.h" | 22 #include "base/path_service.h" |
| 22 #include "base/string_number_conversions.h" | 23 #include "base/string_number_conversions.h" |
| 23 #include "base/string_util.h" | 24 #include "base/string_util.h" |
| 24 #include "base/time.h" | 25 #include "base/time.h" |
| 25 #include "base/utf_string_conversions.h" | 26 #include "base/utf_string_conversions.h" |
| 26 #include "build/build_config.h" | 27 #include "build/build_config.h" |
| 27 #include "media/base/djb2.h" | 28 #include "media/base/djb2.h" |
| 28 #include "media/base/media.h" | 29 #include "media/base/media.h" |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 skip = 0; | 212 skip = 0; |
| 212 } | 213 } |
| 213 } | 214 } |
| 214 | 215 |
| 215 std::ostream* log_out = &std::cout; | 216 std::ostream* log_out = &std::cout; |
| 216 #if defined(ENABLE_WINDOWS_EXCEPTIONS) | 217 #if defined(ENABLE_WINDOWS_EXCEPTIONS) |
| 217 // Catch exceptions so this tool can be used in automated testing. | 218 // Catch exceptions so this tool can be used in automated testing. |
| 218 __try { | 219 __try { |
| 219 #endif | 220 #endif |
| 220 | 221 |
| 221 file_util::MemoryMappedFile file_data; | 222 base::MemoryMappedFile file_data; |
| 222 file_data.Initialize(in_path); | 223 file_data.Initialize(in_path); |
| 223 media::InMemoryUrlProtocol protocol( | 224 media::InMemoryUrlProtocol protocol( |
| 224 file_data.data(), file_data.length(), false); | 225 file_data.data(), file_data.length(), false); |
| 225 | 226 |
| 226 // Register FFmpeg and attempt to open file. | 227 // Register FFmpeg and attempt to open file. |
| 227 media::FFmpegGlue glue(&protocol); | 228 media::FFmpegGlue glue(&protocol); |
| 228 if (!glue.OpenContext()) { | 229 if (!glue.OpenContext()) { |
| 229 std::cerr << "Error: Could not open input for " | 230 std::cerr << "Error: Could not open input for " |
| 230 << in_path.value() << std::endl; | 231 << in_path.value() << std::endl; |
| 231 return 1; | 232 return 1; |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 #if defined(ENABLE_WINDOWS_EXCEPTIONS) | 582 #if defined(ENABLE_WINDOWS_EXCEPTIONS) |
| 582 } __except(EXCEPTION_EXECUTE_HANDLER) { | 583 } __except(EXCEPTION_EXECUTE_HANDLER) { |
| 583 *log_out << " Exception:" << std::setw(11) << GetExceptionCode() | 584 *log_out << " Exception:" << std::setw(11) << GetExceptionCode() |
| 584 << " " << in_path.value() << std::endl; | 585 << " " << in_path.value() << std::endl; |
| 585 return 1; | 586 return 1; |
| 586 } | 587 } |
| 587 #endif | 588 #endif |
| 588 CommandLine::Reset(); | 589 CommandLine::Reset(); |
| 589 return 0; | 590 return 0; |
| 590 } | 591 } |
| OLD | NEW |