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

Commit d4008dc7 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 9966400 from ec503f69 to udc-release

Change-Id: I7cef6f38270783a4e35cdc93314c49c545e9067b
parents b664c636 ec503f69
Loading
Loading
Loading
Loading
+6 −17
Original line number Diff line number Diff line
@@ -265,14 +265,16 @@ class C2SoftMpeg4Enc::IntfImpl : public SimpleInterface<void>::BaseParams {
                needsUpdate = true;
            }
        }
        // If not found, set to the highest supported level.
        if (!found) {
        // If not found or exceeds max level, set to the highest supported level.
#ifdef MPEG4
        if (!found || me.v.level > LEVEL_MP4V_2) {
            me.set().level = LEVEL_MP4V_2;
        }
#else
        if (!found || (me.v.level != LEVEL_H263_45 && me.v.level > LEVEL_H263_40)) {
            me.set().level = LEVEL_H263_40;
#endif
        }
#endif
        return C2R::Ok();
    }

@@ -288,18 +290,6 @@ class C2SoftMpeg4Enc::IntfImpl : public SimpleInterface<void>::BaseParams {
        return (uint32_t)c2_max(c2_min(period + 0.5, double(UINT32_MAX)), 1.);
    }

    ProfileLevelType getProfileLevel_l() const {
#ifdef MPEG4
        if (mProfileLevel->level == LEVEL_MP4V_0) return SIMPLE_PROFILE_LEVEL0;
        else if (mProfileLevel->level == LEVEL_MP4V_1) return SIMPLE_PROFILE_LEVEL1;
        return SIMPLE_PROFILE_LEVEL2;  // level == LEVEL_MP4V_2
#else
        // library does not export h263 specific levels. No way to map C2 enums to
        // library specific constants. Return max supported level.
        return CORE_PROFILE_LEVEL2;
#endif
    }

   private:
    std::shared_ptr<C2StreamUsageTuning::input> mUsage;
    std::shared_ptr<C2StreamPictureSizeInfo::input> mSize;
@@ -416,7 +406,7 @@ c2_status_t C2SoftMpeg4Enc::initEncParams() {
    mEncParams->encFrameRate[0] = mFrameRate->value + 0.5;
    mEncParams->rcType = VBR_1;
    mEncParams->vbvDelay = VBV_DELAY;
    mEncParams->profile_level = mProfileLevel;
    mEncParams->profile_level = CORE_PROFILE_LEVEL2;
    mEncParams->packetSize = 32;
    mEncParams->rvlcEnable = PV_OFF;
    mEncParams->numLayers = 1;
@@ -457,7 +447,6 @@ c2_status_t C2SoftMpeg4Enc::initEncoder() {
        mSize = mIntf->getSize_l();
        mBitrate = mIntf->getBitrate_l();
        mFrameRate = mIntf->getFrameRate_l();
        mProfileLevel = mIntf->getProfileLevel_l();
    }
    c2_status_t err = initEncParams();
    if (C2_OK != err) {
+0 −1
Original line number Diff line number Diff line
@@ -65,7 +65,6 @@ private:
    std::shared_ptr<C2StreamPictureSizeInfo::input> mSize;
    std::shared_ptr<C2StreamFrameRateInfo::output> mFrameRate;
    std::shared_ptr<C2StreamBitrateInfo::output> mBitrate;
    ProfileLevelType mProfileLevel;

    int64_t  mNumInputFrames;
    MP4EncodingMode mEncodeMode;
+1 −1
Original line number Diff line number Diff line
@@ -193,7 +193,7 @@ status_t AudioMixer::Track::prepareForDownmix()

    // See if we should use our built-in non-effect downmixer.
    if (mMixerInFormat == AUDIO_FORMAT_PCM_FLOAT
            && mMixerChannelMask == AUDIO_CHANNEL_OUT_STEREO
            && ChannelMixBufferProvider::isOutputChannelMaskSupported(mMixerChannelMask)
            && audio_channel_mask_get_representation(channelMask)
                    == AUDIO_CHANNEL_REPRESENTATION_POSITION) {
        mDownmixerBufferProvider.reset(new ChannelMixBufferProvider(channelMask,
+10 −5
Original line number Diff line number Diff line
@@ -373,18 +373,23 @@ ChannelMixBufferProvider::ChannelMixBufferProvider(audio_channel_mask_t inputCha
                audio_bytes_per_sample(format)
                    * audio_channel_count_from_out_mask(outputChannelMask),
                bufferFrameCount)
        , mChannelMix{format == AUDIO_FORMAT_PCM_FLOAT
                ? audio_utils::channels::IChannelMix::create(outputChannelMask) : nullptr}
        , mIsValid{mChannelMix && mChannelMix->setInputChannelMask(inputChannelMask)}
{
    ALOGV("ChannelMixBufferProvider(%p)(%#x, %#x, %#x)",
            this, format, inputChannelMask, outputChannelMask);
    if (outputChannelMask == AUDIO_CHANNEL_OUT_STEREO && format == AUDIO_FORMAT_PCM_FLOAT) {
        mIsValid = mChannelMix.setInputChannelMask(inputChannelMask);
    }
}

void ChannelMixBufferProvider::copyFrames(void *dst, const void *src, size_t frames)
{
    mChannelMix.process(static_cast<const float *>(src), static_cast<float *>(dst),
    if (mIsValid) {
        mChannelMix->process(static_cast<const float *>(src), static_cast<float *>(dst),
                frames, false /* accumulate */);
    } else {
        // Should fall back to a different BufferProvider if not valid.
        ALOGE("%s: Use without being valid!", __func__);
    }
}

ReformatBufferProvider::ReformatBufferProvider(int32_t channelCount,
+7 −2
Original line number Diff line number Diff line
@@ -142,9 +142,14 @@ public:

    bool isValid() const { return mIsValid; }

    static bool isOutputChannelMaskSupported(audio_channel_mask_t outputChannelMask) {
        return audio_utils::channels::IChannelMix::isOutputChannelMaskSupported(
                outputChannelMask);
    }

protected:
    audio_utils::channels::ChannelMix<AUDIO_CHANNEL_OUT_STEREO> mChannelMix;
    bool mIsValid = false;
    const std::shared_ptr<audio_utils::channels::IChannelMix> mChannelMix;
    const bool mIsValid;
};

// RemixBufferProvider derives from CopyBufferProvider to perform an
Loading