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

Commit b273c020 authored by Manikanta Kanamarlapudi's avatar Manikanta Kanamarlapudi Committed by Steve Kondik
Browse files

libstagefright: Avoid fallback to software encoders

Avoid fallback to software encoders during start
of the recording in case of thermal ctitical and venus
overload states.

Change-Id: I047bed0e8c31f837bba701cb5d2646aa8171091d
parent 801682ed
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -1729,6 +1729,9 @@ status_t StagefrightRecorder::setupVideoEncoder(
    if (mRecorderExtendedStats != NULL) {
        format->setObject(MEDIA_EXTENDED_STATS, mRecorderExtendedStats);
    }

    flags |= ExtendedUtils::getEncoderTypeFlags();

    sp<MediaCodecSource> encoder =
            MediaCodecSource::Create(mLooper, format, cameraSource, flags);
    if (encoder == NULL) {
+16 −1
Original line number Diff line number Diff line
@@ -1909,6 +1909,18 @@ void ExtendedUtils::showImageInNativeWindow(const sp<AMessage> &msg,
    format->setInt32("height", (int32_t)bufheight);
}

int32_t ExtendedUtils::getEncoderTypeFlags() {
    int32_t flags = 0;

    char mDeviceName[PROPERTY_VALUE_MAX];
    property_get("ro.board.platform", mDeviceName, "0");
    if (!strncmp(mDeviceName, "msm8909", 7)) {
        flags |= OMXCodec::kHardwareCodecsOnly;
    }

    return flags;
}

}
#else //ENABLE_AV_ENHANCEMENTS

@@ -2098,7 +2110,6 @@ bool ExtendedUtils::checkDPFromVOLHeader(const uint8_t *data, size_t size) {
    return false;
}


void ExtendedUtils::detectAndPostImage(const sp<ABuffer> accessUnit,
        const sp<AMessage> &notify) {
    ARG_TOUCH(accessUnit);
@@ -2111,6 +2122,10 @@ void ExtendedUtils::showImageInNativeWindow(const sp<AMessage> &msg,
    ARG_TOUCH(format);
}

int32_t ExtendedUtils::getEncoderTypeFlags() {
    return false;
}

bool ExtendedUtils::RTSPStream::ParseURL_V6(
        AString *host, const char **colonPos) {
    return false;
+19 −2
Original line number Diff line number Diff line
@@ -437,6 +437,7 @@ status_t MediaCodecSource::initEncoder() {
    }

    AString outputMIME;
    AString componentName;
    CHECK(mOutputFormat->findString("mime", &outputMIME));

    int width, height;
@@ -450,9 +451,25 @@ status_t MediaCodecSource::initEncoder() {
    {
        ExtendedStats::AutoProfile autoProfile(
                STATS_PROFILE_ALLOCATE_NODE(mIsVideo), mRecorderExtendedStats);

        if (mIsVideo && (mFlags & OMXCodec::kHardwareCodecsOnly)) {
            Vector<OMXCodec::CodecNameAndQuirks> matchingCodecs;

            OMXCodec::findMatchingCodecs(
                    outputMIME.c_str(),
                    true, // createEncoder
                    NULL,  // matchComponentName
                    OMXCodec::kHardwareCodecsOnly,     // flags
                    &matchingCodecs);

            componentName = matchingCodecs.itemAt(0).mName.string();
            mEncoder = MediaCodec::CreateByComponentName(
                    mCodecLooper, componentName.c_str());
        } else {
            mEncoder = MediaCodec::CreateByType(
                    mCodecLooper, outputMIME.c_str(), true /* encoder */);
        }
    }

    if (mEncoder == NULL) {
        return NO_INIT;
+2 −0
Original line number Diff line number Diff line
@@ -248,6 +248,8 @@ struct ExtendedUtils {

    static void detectAndPostImage(const sp<ABuffer> accessunit, const sp<AMessage> &notify);
    static void showImageInNativeWindow(const sp<AMessage> &msg, const sp<AMessage> &format);

    static int32_t getEncoderTypeFlags();
};

}