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

Commit acc9757b authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 6601700 from e28883fe to rvc-release

Change-Id: Iad823ba0bca6fb0afbef2f3632a0e77983c64b3f
parents 5ba1d6bf e28883fe
Loading
Loading
Loading
Loading
+64 −4
Original line number Diff line number Diff line
@@ -89,10 +89,17 @@ public:
        addParameter(
                DefineParam(mChannelCount, C2_PARAMKEY_CHANNEL_COUNT)
                .withDefault(new C2StreamChannelCountInfo::output(0u, 1))
                .withFields({C2F(mChannelCount, value).inRange(1, 8)})
                .withFields({C2F(mChannelCount, value).inRange(1, MAX_CHANNEL_COUNT)})
                .withSetter(Setter<decltype(*mChannelCount)>::StrictValueWithNoDeps)
                .build());

        addParameter(
                DefineParam(mMaxChannelCount, C2_PARAMKEY_MAX_CHANNEL_COUNT)
                .withDefault(new C2StreamMaxChannelCountInfo::input(0u, MAX_CHANNEL_COUNT))
                .withFields({C2F(mMaxChannelCount, value).inRange(1, MAX_CHANNEL_COUNT)})
                .withSetter(Setter<decltype(*mMaxChannelCount)>::StrictValueWithNoDeps)
                .build());

        addParameter(
                DefineParam(mBitrate, C2_PARAMKEY_BITRATE)
                .withDefault(new C2StreamBitrateInfo::input(0u, 64000))
@@ -225,6 +232,7 @@ public:
    int32_t getDrcAttenuationFactor() const { return mDrcAttenuationFactor->value * 127. + 0.5; }
    int32_t getDrcEffectType() const { return mDrcEffectType->value; }
    int32_t getDrcAlbumMode() const { return mDrcAlbumMode->value; }
    u_int32_t getMaxChannelCount() const { return mMaxChannelCount->value; }
    int32_t getDrcOutputLoudness() const { return (mDrcOutputLoudness->value <= 0 ? -mDrcOutputLoudness->value * 4. + 0.5 : -1); }

private:
@@ -241,6 +249,7 @@ private:
    std::shared_ptr<C2StreamDrcAttenuationFactorTuning::input> mDrcAttenuationFactor;
    std::shared_ptr<C2StreamDrcEffectTypeTuning::input> mDrcEffectType;
    std::shared_ptr<C2StreamDrcAlbumModeTuning::input> mDrcAlbumMode;
    std::shared_ptr<C2StreamMaxChannelCountInfo::input> mMaxChannelCount;
    std::shared_ptr<C2StreamDrcOutputLoudnessTuning::output> mDrcOutputLoudness;
    // TODO Add : C2StreamAacSbrModeTuning
};
@@ -366,9 +375,10 @@ status_t C2SoftAacDec::initDecoder() {
    ALOGV("AAC decoder using MPEG-D DRC album mode %d", albumMode);
    aacDecoder_SetParam(mAACDecoder, AAC_UNIDRC_ALBUM_MODE, albumMode);

    // By default, the decoder creates a 5.1 channel downmix signal.
    // For seven and eight channel input streams, enable 6.1 and 7.1 channel output
    aacDecoder_SetParam(mAACDecoder, AAC_PCM_MAX_OUTPUT_CHANNELS, -1);
    // AAC_PCM_MAX_OUTPUT_CHANNELS
    u_int32_t maxChannelCount = mIntf->getMaxChannelCount();
    ALOGV("AAC decoder using maximum output channel count %d", maxChannelCount);
    aacDecoder_SetParam(mAACDecoder, AAC_PCM_MAX_OUTPUT_CHANNELS, maxChannelCount);

    return status;
}
@@ -707,6 +717,11 @@ void C2SoftAacDec::process(
        ALOGV("AAC decoder using MPEG-D DRC album mode %d", albumMode);
        aacDecoder_SetParam(mAACDecoder, AAC_UNIDRC_ALBUM_MODE, albumMode);

        // AAC_PCM_MAX_OUTPUT_CHANNELS
        int32_t maxChannelCount = mIntf->getMaxChannelCount();
        ALOGV("AAC decoder using maximum output channel count %d", maxChannelCount);
        aacDecoder_SetParam(mAACDecoder, AAC_PCM_MAX_OUTPUT_CHANNELS, maxChannelCount);

        mDrcWrap.update();

        UINT inBufferUsedLength = inBufferLength[0] - bytesValid[0];
@@ -847,6 +862,51 @@ void C2SoftAacDec::process(
                    ALOGE("Getting output loudness failed");
                }
            }

            // update config with values used for decoding:
            //    Album mode, target reference level, DRC effect type, DRC attenuation and boost
            //    factor, DRC compression mode, encoder target level and max channel count
            // with input values as they were not modified by decoder

            C2StreamDrcAttenuationFactorTuning::input currentAttenuationFactor(0u,
                    (C2FloatValue) (attenuationFactor/127.));
            work->worklets.front()->output.configUpdate.push_back(
                    C2Param::Copy(currentAttenuationFactor));

            C2StreamDrcBoostFactorTuning::input currentBoostFactor(0u,
                    (C2FloatValue) (boostFactor/127.));
            work->worklets.front()->output.configUpdate.push_back(
                    C2Param::Copy(currentBoostFactor));

            C2StreamDrcCompressionModeTuning::input currentCompressMode(0u,
                    (C2Config::drc_compression_mode_t) compressMode);
            work->worklets.front()->output.configUpdate.push_back(
                    C2Param::Copy(currentCompressMode));

            C2StreamDrcEncodedTargetLevelTuning::input currentEncodedTargetLevel(0u,
                    (C2FloatValue) (encTargetLevel*-0.25));
            work->worklets.front()->output.configUpdate.push_back(
                    C2Param::Copy(currentEncodedTargetLevel));

            C2StreamDrcAlbumModeTuning::input currentAlbumMode(0u,
                    (C2Config::drc_album_mode_t) albumMode);
            work->worklets.front()->output.configUpdate.push_back(
                    C2Param::Copy(currentAlbumMode));

            C2StreamDrcTargetReferenceLevelTuning::input currentTargetRefLevel(0u,
                    (float) (targetRefLevel*-0.25));
            work->worklets.front()->output.configUpdate.push_back(
                    C2Param::Copy(currentTargetRefLevel));

            C2StreamDrcEffectTypeTuning::input currentEffectype(0u,
                    (C2Config::drc_effect_type_t) effectType);
            work->worklets.front()->output.configUpdate.push_back(
                    C2Param::Copy(currentEffectype));

            C2StreamMaxChannelCountInfo::input currentMaxChannelCnt(0u, maxChannelCount);
            work->worklets.front()->output.configUpdate.push_back(
                    C2Param::Copy(currentMaxChannelCnt));

        } while (decoderErr == AAC_DEC_OK);
    }

+4 −1
Original line number Diff line number Diff line
@@ -732,6 +732,9 @@ status_t CCodecBufferChannel::renderOutputBuffer(
    std::shared_ptr<const C2StreamHdr10PlusInfo::output> hdr10PlusInfo =
        std::static_pointer_cast<const C2StreamHdr10PlusInfo::output>(
                c2Buffer->getInfo(C2StreamHdr10PlusInfo::output::PARAM_TYPE));
    if (hdr10PlusInfo && hdr10PlusInfo->flexCount() == 0) {
        hdr10PlusInfo.reset();
    }

    {
        Mutexed<OutputSurface>::Locked output(mOutputSurface);
@@ -783,7 +786,7 @@ status_t CCodecBufferChannel::renderOutputBuffer(
                    .maxLuminance = hdrStaticInfo->mastering.maxLuminance,
                    .minLuminance = hdrStaticInfo->mastering.minLuminance,
                };
                hdr.validTypes = HdrMetadata::SMPTE2086;
                hdr.validTypes |= HdrMetadata::SMPTE2086;
                hdr.smpte2086 = smpte2086_meta;
            }
            // If the content light level fields are 0, do not use them, it
+4 −0
Original line number Diff line number Diff line
@@ -164,6 +164,10 @@ status_t AudioStreamOut::open(
        stream = outStream;
        mHalFormatHasProportionalFrames = audio_has_proportional_frames(config->format);
        status = stream->getFrameSize(&mHalFrameSize);
        LOG_ALWAYS_FATAL_IF(status != OK, "Error retrieving frame size from HAL: %d", status);
        LOG_ALWAYS_FATAL_IF(mHalFrameSize <= 0, "Error frame size was %zu but must be greater than"
                " zero", mHalFrameSize);

    }

    return status;
+7 −4
Original line number Diff line number Diff line
@@ -8436,13 +8436,14 @@ void AudioFlinger::RecordThread::readInputParameters_l()
    }
    result = mInput->stream->getFrameSize(&mFrameSize);
    LOG_ALWAYS_FATAL_IF(result != OK, "Error retrieving frame size from HAL: %d", result);
    LOG_ALWAYS_FATAL_IF(mFrameSize <= 0, "Error frame size was %zu but must be greater than zero",
            mFrameSize);
    result = mInput->stream->getBufferSize(&mBufferSize);
    LOG_ALWAYS_FATAL_IF(result != OK, "Error retrieving buffer size from HAL: %d", result);
    mFrameCount = mBufferSize / mFrameSize;
    ALOGV("%p RecordThread params: mChannelCount=%u, mFormat=%#x, mFrameSize=%lld, "
            "mBufferSize=%lld, mFrameCount=%lld",
            this, mChannelCount, mFormat, (long long)mFrameSize, (long long)mBufferSize,
            (long long)mFrameCount);
    ALOGV("%p RecordThread params: mChannelCount=%u, mFormat=%#x, mFrameSize=%zu, "
            "mBufferSize=%zu, mFrameCount=%zu",
            this, mChannelCount, mFormat, mFrameSize, mBufferSize, mFrameCount);
    // This is the formula for calculating the temporary buffer size.
    // With 7 HAL buffers, we can guarantee ability to down-sample the input by ratio of 6:1 to
    // 1 full output buffer, regardless of the alignment of the available input.
@@ -9018,6 +9019,8 @@ void AudioFlinger::MmapThread::readHalParameters_l()
    LOG_ALWAYS_FATAL_IF(!audio_is_linear_pcm(mFormat), "HAL format %#x is not linear pcm", mFormat);
    result = mHalStream->getFrameSize(&mFrameSize);
    LOG_ALWAYS_FATAL_IF(result != OK, "Error retrieving frame size from HAL: %d", result);
    LOG_ALWAYS_FATAL_IF(mFrameSize <= 0, "Error frame size was %zu but must be greater than zero",
            mFrameSize);
    result = mHalStream->getBufferSize(&mBufferSize);
    LOG_ALWAYS_FATAL_IF(result != OK, "Error retrieving buffer size from HAL: %d", result);
    mFrameCount = mBufferSize / mFrameSize;
+1 −1
Original line number Diff line number Diff line
@@ -593,7 +593,7 @@ status_t AudioPolicyService::startInput(audio_port_handle_t portId)
    }

    // including successes gets very verbose
    // but once we cut over to westworld, log them all.
    // but once we cut over to statsd, log them all.
    if (status != NO_ERROR) {

        static constexpr char kAudioPolicy[] = "audiopolicy";
Loading