Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2d074bad authored by Naveen Kumar Ponnusamy's avatar Naveen Kumar Ponnusamy Committed by hkuang
Browse files

transcoder: Add startThreadPool to benchmark

Adding ProcessState startThreadPool fixes a
hang, related to Extractor, seen for running
benchmark for many assets or multiple
iterations.

Bug: 175889103
Test: ./MediaTranscoderBenchmark
--benchmark_filter=BM_TranscodeVideoPassthrough
--benchmark_min_time=60

Change-Id: Ib4f1bbf131b4e97b0cf3391747dc5541f5f8fcd9
parent 0dbe8719
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
cc_defaults {
    name: "benchmarkdefaults",
    shared_libs: ["libmediandk", "libbase", "libbinder_ndk", "libutils", "libnativewindow"],
    shared_libs: [
        "libmediandk",
        "libbase",
        "libbinder_ndk",
        "libbinder",
        "libutils",
        "libnativewindow",
    ],
    static_libs: ["libmediatranscoder", "libgoogle-benchmark"],
    test_config_template: "AndroidTestTemplate.xml",
    test_suites: ["device-tests", "TranscoderBenchmarks"],
+2 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@
 */

#include <benchmark/benchmark.h>
#include <binder/ProcessState.h>
#include <fcntl.h>
#include <media/MediaTranscoder.h>
#include <iostream>
@@ -390,6 +391,7 @@ void CustomCsvReporter::PrintRunData(const Run& run) {
}

int main(int argc, char** argv) {
    android::ProcessState::self()->startThreadPool();
    std::unique_ptr<benchmark::BenchmarkReporter> fileReporter;
    for (int i = 1; i < argc; ++i) {
        if (std::string(argv[i]).find("--benchmark_out") != std::string::npos) {