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 // 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 "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 if (target_codec == CODEC_TYPE_VIDEO && video_threads > 0) { | 342 if (target_codec == CODEC_TYPE_VIDEO && video_threads > 0) { |
343 if (avcodec_thread_init(codec_context, video_threads) < 0) { | 343 if (avcodec_thread_init(codec_context, video_threads) < 0) { |
344 std::cerr << "Warning: Could not initialize threading!\n" | 344 std::cerr << "Warning: Could not initialize threading!\n" |
345 << "Did you build with pthread/w32thread support?" << std::endl; | 345 << "Did you build with pthread/w32thread support?" << std::endl; |
346 } | 346 } |
347 } | 347 } |
348 | 348 |
349 // Initialize our codec. | 349 // Initialize our codec. |
350 if (avcodec_open(codec_context, codec) < 0) { | 350 if (avcodec_open(codec_context, codec) < 0) { |
351 std::cerr << "Error: Could not open codec " | 351 std::cerr << "Error: Could not open codec " |
352 << codec_context->codec->name << " for " | 352 << (codec_context->codec ? codec_context->codec->name : "(NULL)") |
353 << in_path.value() << std::endl; | 353 << " for " << in_path.value() << std::endl; |
354 return 1; | 354 return 1; |
355 } | 355 } |
356 | 356 |
357 // Buffer used for audio decoding. | 357 // Buffer used for audio decoding. |
358 scoped_ptr_malloc<int16, media::ScopedPtrAVFree> samples( | 358 scoped_ptr_malloc<int16, media::ScopedPtrAVFree> samples( |
359 reinterpret_cast<int16*>(av_malloc(AVCODEC_MAX_AUDIO_FRAME_SIZE))); | 359 reinterpret_cast<int16*>(av_malloc(AVCODEC_MAX_AUDIO_FRAME_SIZE))); |
360 | 360 |
361 // Buffer used for video decoding. | 361 // Buffer used for video decoding. |
362 scoped_ptr_malloc<AVFrame, media::ScopedPtrAVFree> frame( | 362 scoped_ptr_malloc<AVFrame, media::ScopedPtrAVFree> frame( |
363 avcodec_alloc_frame()); | 363 avcodec_alloc_frame()); |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 #if defined(ENABLE_WINDOWS_EXCEPTIONS) | 586 #if defined(ENABLE_WINDOWS_EXCEPTIONS) |
587 } __except(EXCEPTION_EXECUTE_HANDLER) { | 587 } __except(EXCEPTION_EXECUTE_HANDLER) { |
588 *log_out << " Exception:" << std::setw(11) << GetExceptionCode() | 588 *log_out << " Exception:" << std::setw(11) << GetExceptionCode() |
589 << " " << in_path.value() << std::endl; | 589 << " " << in_path.value() << std::endl; |
590 return 1; | 590 return 1; |
591 } | 591 } |
592 #endif | 592 #endif |
593 CommandLine::Reset(); | 593 CommandLine::Reset(); |
594 return 0; | 594 return 0; |
595 } | 595 } |
OLD | NEW |