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

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

Merge "Transcoder: Default benchmark to AVC output." into sc-dev

parents 35d3c544 4aef0de9
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -238,7 +238,12 @@ media_status_t VideoTrackTranscoder::configureDestinationFormat(
    int32_t operatingRate = getDefaultOperatingRate(encoderFormat);

    if (operatingRate != -1) {
        SetDefaultFormatValueInt32(AMEDIAFORMAT_KEY_OPERATING_RATE, encoderFormat, operatingRate);
        float tmpf;
        int32_t tmpi;
        if (!AMediaFormat_getFloat(encoderFormat, AMEDIAFORMAT_KEY_OPERATING_RATE, &tmpf) &&
            !AMediaFormat_getInt32(encoderFormat, AMEDIAFORMAT_KEY_OPERATING_RATE, &tmpi)) {
            AMediaFormat_setInt32(encoderFormat, AMEDIAFORMAT_KEY_OPERATING_RATE, operatingRate);
        }
    }

    SetDefaultFormatValueInt32(AMEDIAFORMAT_KEY_PRIORITY, encoderFormat, kDefaultCodecPriority);
+3 −1
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@
#include <binder/ProcessState.h>
#include <fcntl.h>
#include <media/MediaTranscoder.h>
#include <media/NdkCommon.h>

#include <iostream>

@@ -87,6 +88,7 @@ static AMediaFormat* CreateDefaultVideoFormat() {

    AMediaFormat* videoFormat = AMediaFormat_new();
    AMediaFormat_setInt32(videoFormat, AMEDIAFORMAT_KEY_BIT_RATE, kVideoBitRate);
    AMediaFormat_setString(videoFormat, AMEDIAFORMAT_KEY_MIME, AMEDIA_MIMETYPE_VIDEO_AVC);
    return videoFormat;
}

@@ -222,7 +224,7 @@ static void TranscodeMediaFile(benchmark::State& state, const std::string& srcFi
}

static void SetMaxOperatingRate(AMediaFormat* format) {
    AMediaFormat_setFloat(format, AMEDIAFORMAT_KEY_OPERATING_RATE, INT32_MAX);
    AMediaFormat_setInt32(format, AMEDIAFORMAT_KEY_OPERATING_RATE, INT32_MAX);
    AMediaFormat_setInt32(format, AMEDIAFORMAT_KEY_PRIORITY, 1);
}