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

Commit f4bbe5bf authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Updating benchmark library with Large audio frame API" into main

parents 865775da f9e32648
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -69,6 +69,6 @@ android_library {
java_defaults {
    name: "MediaBenchmark-defaults",

    min_sdk_version: "29",
    target_sdk_version: "30",
    min_sdk_version: "35",
    target_sdk_version: "35",
}
+1 −1
Original line number Diff line number Diff line
@@ -26,7 +26,7 @@
        tools:ignore="AllowBackup,GoogleAppIndexingWarning,MissingApplicationIcon"
        tools:remove="android:appComponentFactory">
    </application>
    <uses-sdk android:minSdkVersion="29" android:targetSdkVersion="31"/>
    <uses-sdk android:minSdkVersion="35" android:targetSdkVersion="35"/>
    <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
            android:targetPackage="com.android.media.benchmark"
            android:label="Benchmark Media Test"/>
+2 −2
Original line number Diff line number Diff line
@@ -27,11 +27,11 @@ buildscript {
apply plugin: 'com.android.application'

android {
    compileSdkVersion 30
    compileSdkVersion 35
    defaultConfig {
        applicationId "com.android.media.benchmark"
        minSdkVersion 29
        targetSdkVersion 30
        targetSdkVersion 35
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
+4 −3
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;

import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertEquals;
@@ -118,7 +119,7 @@ public class DecoderTest {
    }

    @Test(timeout = PER_TEST_TIMEOUT_MS)
    public void testDecoder() throws IOException {
    public void testDecoder() throws IOException, InterruptedException {
        File inputFile = new File(mInputFilePath + mInputFile);
        assertTrue("Cannot find " + mInputFile + " in directory " + mInputFilePath,
                inputFile.exists());
@@ -133,7 +134,7 @@ public class DecoderTest {
            extractor.selectExtractorTrack(currentTrack);
            MediaFormat format = extractor.getFormat(currentTrack);
            String mime = format.getString(MediaFormat.KEY_MIME);
            ArrayList<String> mediaCodecs = CodecUtils.selectCodecs(mime, false);
            List<String> mediaCodecs = CodecUtils.selectCodecs(mime, false);
            assertTrue("No suitable codecs found for file: " + mInputFile + " track : " +
                    currentTrack + " mime: " + mime, (mediaCodecs.size() > 0));

@@ -205,7 +206,7 @@ public class DecoderTest {
            extractor.selectExtractorTrack(currentTrack);
            MediaFormat format = extractor.getFormat(currentTrack);
            String mime = format.getString(MediaFormat.KEY_MIME);
            ArrayList<String> mediaCodecs = CodecUtils.selectCodecs(mime, false);
            List<String> mediaCodecs = CodecUtils.selectCodecs(mime, false);
            for (String codecName : mediaCodecs) {
                Log.i("Test: %s\n", mInputFile);
                Native nativeDecoder = new Native();
+6 −4
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@ import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;

import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertEquals;
@@ -150,7 +151,7 @@ public class EncoderTest {
    }

    @BeforeClass
    public static void prepareInput() throws IOException {
    public static void prepareInput() throws IOException, InterruptedException {

        mDecodedFileFullHd = new File(mFileDirPath + DECODE_FULLHD_UNPACKED);
        int status = decodeFile(mInputFilePath + DECODE_FULLHD_INPUT, mDecodedFileFullHd);
@@ -165,7 +166,8 @@ public class EncoderTest {
        assertEquals("Decoder returned error " + status, 0, status);
    }

    private static int decodeFile(String inputFileName, File outputDecodeFile) throws IOException {
    private static int decodeFile(String inputFileName, File outputDecodeFile)
            throws IOException, InterruptedException {
        int status = -1;
        File inputFile = new File(inputFileName);
        assertTrue("Cannot open input file " + inputFileName, inputFile.exists());
@@ -220,7 +222,7 @@ public class EncoderTest {
        int status;
        int frameSize;

        ArrayList<String> mediaCodecs = CodecUtils.selectCodecs(mMime, true);
        List<String> mediaCodecs = CodecUtils.selectCodecs(mMime, true);
        assertTrue("No suitable codecs found for mimetype: " + mMime, (mediaCodecs.size() > 0));
        Boolean[] encodeMode = {true, false};
        // Encoding the decoded input file
@@ -297,7 +299,7 @@ public class EncoderTest {

    @Test(timeout = PER_TEST_TIMEOUT_MS)
    public void testNativeEncoder() {
        ArrayList<String> mediaCodecs = CodecUtils.selectCodecs(mMime, true);
        List<String> mediaCodecs = CodecUtils.selectCodecs(mMime, true);
        assertTrue("No suitable codecs found for mimetype: " + mMime, (mediaCodecs.size() > 0));
        for (String codecName : mediaCodecs) {
            Native nativeEncoder = new Native();
Loading