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

Commit 504394a0 authored by Linus Nilsson's avatar Linus Nilsson
Browse files

Transcoder: Don't set operating rate for 4K

4K is failing on some devices due to operating rate.

Bug: 175406816
Test: Unit test
Change-Id: I9b518ad34fed1a8c5ba8aa86a37099f1aada1f60
parent 204fafe4
Loading
Loading
Loading
Loading
+3 −8
Original line number Original line Diff line number Diff line
@@ -40,12 +40,10 @@ static constexpr int32_t kColorFormatSurface = 0x7f000789;
// Default key frame interval in seconds.
// Default key frame interval in seconds.
static constexpr float kDefaultKeyFrameIntervalSeconds = 1.0f;
static constexpr float kDefaultKeyFrameIntervalSeconds = 1.0f;
// Default codec operating rate.
// Default codec operating rate.
static int32_t kDefaultCodecOperatingRate7200P = base::GetIntProperty(
static int32_t kDefaultCodecOperatingRate720P = base::GetIntProperty(
        "debug.media.transcoding.codec_max_operating_rate_720P", /*default*/ 480);
        "debug.media.transcoding.codec_max_operating_rate_720P", /*default*/ 480);
static int32_t kDefaultCodecOperatingRate1080P = base::GetIntProperty(
static int32_t kDefaultCodecOperatingRate1080P = base::GetIntProperty(
        "debug.media.transcoding.codec_max_operating_rate_1080P", /*default*/ 240);
        "debug.media.transcoding.codec_max_operating_rate_1080P", /*default*/ 240);
static int32_t kDefaultCodecOperatingRate4K = base::GetIntProperty(
        "debug.media.transcoding.codec_max_operating_rate_4K", /*default*/ 120);
// Default codec priority.
// Default codec priority.
static constexpr int32_t kDefaultCodecPriority = 1;
static constexpr int32_t kDefaultCodecPriority = 1;
// Default bitrate, in case source estimation fails.
// Default bitrate, in case source estimation fails.
@@ -193,15 +191,12 @@ static int32_t getDefaultOperatingRate(AMediaFormat* encoderFormat) {
    if (AMediaFormat_getInt32(encoderFormat, AMEDIAFORMAT_KEY_WIDTH, &width) && (width > 0) &&
    if (AMediaFormat_getInt32(encoderFormat, AMEDIAFORMAT_KEY_WIDTH, &width) && (width > 0) &&
        AMediaFormat_getInt32(encoderFormat, AMEDIAFORMAT_KEY_HEIGHT, &height) && (height > 0)) {
        AMediaFormat_getInt32(encoderFormat, AMEDIAFORMAT_KEY_HEIGHT, &height) && (height > 0)) {
        if ((width == 1280 && height == 720) || (width == 720 && height == 1280)) {
        if ((width == 1280 && height == 720) || (width == 720 && height == 1280)) {
            return kDefaultCodecOperatingRate1080P;
            return kDefaultCodecOperatingRate720P;
        } else if ((width == 1920 && height == 1080) || (width == 1080 && height == 1920)) {
        } else if ((width == 1920 && height == 1080) || (width == 1080 && height == 1920)) {
            return kDefaultCodecOperatingRate1080P;
            return kDefaultCodecOperatingRate1080P;
        } else if (((width == 3840 && height == 2160) || (width == 2160 && height == 3840))) {
            return kDefaultCodecOperatingRate4K;
        } else {
        } else {
            LOG(WARNING) << "Could not find default operating rate: " << width << " " << height;
            LOG(WARNING) << "Could not find default operating rate: " << width << " " << height;
            // Use 4K as that should be the lowest for the devices.
            // Don't set operating rate if the correct dimensions are not found.
            return kDefaultCodecOperatingRate4K;
        }
        }
    } else {
    } else {
        LOG(ERROR) << "Failed to get default operating rate due to missing resolution";
        LOG(ERROR) << "Failed to get default operating rate due to missing resolution";