| 1 | #include "benchmark_openh264.h" |
| 2 | |
| 3 | #include "api/environment/environment_factory.h" |
| 4 | #include "modules/video_coding/codecs/h264/include/h264.h" |
| 5 | #include "fileutils.h" |
| 6 | |
| 7 | using namespace webrtc; |
| 8 | |
| 9 | OpenH264Benchmark::OpenH264Benchmark() |
| 10 | : Benchmark("OpenH264Benchmark", |
| 11 | "OpenH264 benchmark over a range of test cases", |
| 12 | webrtc::test::OutputPath() + "OpenH264Benchmark.txt", |
| 13 | "openh264_bitstream_output.h264") {} |
| 14 | |
| 15 | OpenH264Benchmark::OpenH264Benchmark(std::string name, std::string description) |
| 16 | : Benchmark(name, |
| 17 | description, |
| 18 | webrtc::test::OutputPath() + "OpenH264Benchmark.txt", |
| 19 | "openh264_bitstream_output.h264") {} |
| 20 | |
| 21 | OpenH264Benchmark::OpenH264Benchmark(std::string name, |
| 22 | std::string description, |
| 23 | std::string resultsFileName) |
| 24 | : Benchmark(name, description, resultsFileName, "openh264_bitstream_output.h264") {} |
| 25 | |
| 26 | VideoEncoder* OpenH264Benchmark::GetNewEncoder(webrtc::Environment &env) { |
| 27 | auto enc = CreateH264Encoder(env); |
| 28 | if (!enc) { |
| 29 | fprintf(stderr, "Failed to create H264 encoder.\n"); |
| 30 | return nullptr; |
| 31 | } |
| 32 | _encoder = std::move(enc); |
| 33 | |
| 34 | return _encoder.get(); |
| 35 | } |