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

Commit 81ee8913 authored by Treehugger Robot's avatar Treehugger Robot Committed by Automerger Merge Worker
Browse files

Merge "MediaTranscoding: Use MediaPreparer to download test files" into main am: d1155c61

parents 370e62fa d1155c61
Loading
Loading
Loading
Loading
+10 −4
Original line number Diff line number Diff line
@@ -18,11 +18,17 @@
    <target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
        <option name="cleanup" value="false" />
        <option name="push-file" key="{MODULE}" value="/data/local/tmp/{MODULE}" />
        <option name="push-file"
            key="https://dl.google.com/android-unittest/media/frameworks/av/media/module/libmediatranscoding/transcoder/benchmark/TranscodingBenchmark-1.2.zip?unzip=true"
            value="/data/local/tmp/TranscodingBenchmark/" />
    </target_preparer>

    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.DynamicConfigPusher">
        <option name="target" value="host" />
        <option name="config-filename" value="{MODULE}" />
        <option name="version" value="1.0"/>
    </target_preparer>
    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.MediaPreparer">
        <option name="push-all" value="true" />
        <option name="media-folder-name" value="TranscodingBenchmark-1.2" />
        <option name="dynamic-config-module" value="{MODULE}" />
    </target_preparer>
    <test class="com.android.tradefed.testtype.GoogleBenchmarkTest" >
        <option name="native-benchmark-device-path" value="/data/local/tmp" />
        <option name="benchmark-module-name" value="{MODULE}" />
+28 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2023 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef __BENCHMARK_COMMON_H__
#define __BENCHMARK_COMMON_H__


#include <string>

namespace android {

static const std::string kAssetDirectory = "/sdcard/test/TranscodingBenchmark-1.2/";

}  // namespace android
#endif  // __BENCHMARK_COMMON_H__
+20 −0
Original line number Diff line number Diff line
<!-- Copyright (C) 2023 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->

<dynamicConfig>
    <entry key="media_files_url">
            <value>https://dl.google.com/android-unittest/media/frameworks/av/media/module/libmediatranscoding/transcoder/benchmark/TranscodingBenchmark-1.2.zip</value>
    </entry>
</dynamicConfig>
+2 −4
Original line number Diff line number Diff line
@@ -39,18 +39,16 @@

#include <thread>

#include "BenchmarkCommon.h"
using namespace android;

static void ReadMediaSamples(benchmark::State& state, const std::string& srcFileName,
                             bool readAudio, bool sequentialAccess = false) {
    // Asset directory.
    static const std::string kAssetDirectory = "/data/local/tmp/TranscodingBenchmark/";

    int srcFd = 0;
    std::string srcPath = kAssetDirectory + srcFileName;

    if ((srcFd = open(srcPath.c_str(), O_RDONLY)) < 0) {
        state.SkipWithError("Unable to open source file");
        state.SkipWithError("Unable to open source file: " + srcPath);
        return;
    }

+3 −4
Original line number Diff line number Diff line
@@ -44,6 +44,8 @@
#include <media/PassthroughTrackTranscoder.h>
#include <media/VideoTrackTranscoder.h>

#include "BenchmarkCommon.h"

using namespace android;

typedef enum {
@@ -249,9 +251,6 @@ static std::shared_ptr<AMediaFormat> GetDefaultTrackFormat(MediaType mediaType,
/** Gets a MediaSampleReader for the source file */
static std::shared_ptr<MediaSampleReader> GetSampleReader(const std::string& srcFileName,
                                                          bool mock) {
    // Asset directory
    static const std::string kAssetDirectory = "/data/local/tmp/TranscodingBenchmark/";

    int srcFd = 0;
    std::string srcPath = kAssetDirectory + srcFileName;

@@ -362,7 +361,7 @@ static void BenchmarkTranscoder(benchmark::State& state, const std::string& srcF

        std::shared_ptr<MediaSampleReader> sampleReader = GetSampleReader(srcFileName, mockReader);
        if (sampleReader == nullptr) {
            state.SkipWithError("Unable to create sample reader");
            state.SkipWithError("Unable to create sample reader: " + srcFileName);
            return;
        }

Loading