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

Commit 11aaefb5 authored by Marco Nelissen's avatar Marco Nelissen
Browse files

SoftAVCDec: Added support for level greater than level at init

Bug: 21144884

Change-Id: Idda3fbf6c30e99d6df2b1e53a1f65c8ec55586ce
parent 05421987
Loading
Loading
Loading
Loading
+40 −11
Original line number Diff line number Diff line
@@ -121,6 +121,7 @@ SoftAVC::SoftAVC(
      mIvColorFormat(IV_YUV_420P),
      mNewWidth(mWidth),
      mNewHeight(mHeight),
      mNewLevel(0),
      mChangingResolution(false) {
    initPorts(
            kNumBuffers, INPUT_BUF_SIZE, kNumBuffers, CODEC_MIME_TYPE);
@@ -303,6 +304,7 @@ status_t SoftAVC::initDecoder() {
    uint32_t displayHeight = outputBufferHeight();
    uint32_t displaySizeY = displayStride * displayHeight;

    if(mNewLevel == 0){
        if (displaySizeY > (1920 * 1088)) {
            i4_level = 50;
        } else if (displaySizeY > (1280 * 720)) {
@@ -316,6 +318,9 @@ status_t SoftAVC::initDecoder() {
        } else {
            i4_level = 20;
        }
    } else {
        i4_level = mNewLevel;
    }

    {
        iv_num_mem_rec_ip_t s_num_mem_rec_ip;
@@ -691,6 +696,7 @@ void SoftAVC::onQueueFilled(OMX_U32 portIndex) {
            bool unsupportedDimensions =
                (IVD_STREAM_WIDTH_HEIGHT_NOT_SUPPORTED == (s_dec_op.u4_error_code & 0xFF));
            bool resChanged = (IVD_RES_CHANGED == (s_dec_op.u4_error_code & 0xFF));
            bool unsupportedLevel = (IH264D_UNSUPPORTED_LEVEL == (s_dec_op.u4_error_code & 0xFF));

            GETTIME(&mTimeEnd, NULL);
            /* Compute time taken for decode() */
@@ -722,6 +728,18 @@ void SoftAVC::onQueueFilled(OMX_U32 portIndex) {
                return;
            }

            if (unsupportedLevel && !mFlushNeeded) {

                mNewLevel = 51;

                CHECK_EQ(reInitDecoder(), (status_t)OK);

                setDecodeArgs(&s_dec_ip, &s_dec_op, inHeader, outHeader, timeStampIx);

                ivdec_api_function(mCodecCtx, (void *)&s_dec_ip, (void *)&s_dec_op);
                return;
            }

            // If the decoder is in the changing resolution mode and there is no output present,
            // that means the switching is done and it's ready to reset the decoder and the plugin.
            if (mChangingResolution && !s_dec_op.u4_output_present) {
@@ -745,6 +763,17 @@ void SoftAVC::onQueueFilled(OMX_U32 portIndex) {
                continue;
            }

            if (unsupportedLevel) {

                if (mFlushNeeded) {
                    setFlushMode();
                }

                mNewLevel = 51;
                mInitNeeded = true;
                continue;
            }

            if ((0 < s_dec_op.u4_pic_wd) && (0 < s_dec_op.u4_pic_ht)) {
                uint32_t width = s_dec_op.u4_pic_wd;
                uint32_t height = s_dec_op.u4_pic_ht;
+1 −0
Original line number Diff line number Diff line
@@ -100,6 +100,7 @@ private:
    bool mInitNeeded;
    uint32_t mNewWidth;
    uint32_t mNewHeight;
    uint32_t mNewLevel;
    // The input stream has changed to a different resolution, which is still supported by the
    // codec. So the codec is switching to decode the new resolution.
    bool mChangingResolution;