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

Commit 5048de32 authored by Lajos Molnar's avatar Lajos Molnar Committed by Android (Google) Code Review
Browse files

Merge "stagefright: ACodec: read output port format on first frame" into nyc-dev

parents 14cbc370 697aedf6
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -253,6 +253,9 @@ private:
    sp<AMessage> mConfigFormat;
    sp<AMessage> mInputFormat;
    sp<AMessage> mOutputFormat;

    // Initial output format + configuration params that is reused as the base for all subsequent
    // format updates. This will equal to mOutputFormat until the first actual frame is received.
    sp<AMessage> mBaseOutputFormat;

    FrameRenderTracker mRenderTracker; // render information for buffers rendered by ACodec
+6 −1
Original line number Diff line number Diff line
@@ -2257,6 +2257,7 @@ status_t ACodec::configureCodec(
        err = setOperatingRate(rateFloat, video);
    }

    // NOTE: both mBaseOutputFormat and mOutputFormat are outputFormat to signal first frame.
    mBaseOutputFormat = outputFormat;
    // trigger a kWhatOutputFormatChanged msg on first buffer
    mLastOutputFormat.clear();
@@ -5029,7 +5030,7 @@ void ACodec::onDataSpaceChanged(android_dataspace dataSpace, const ColorAspects
}

void ACodec::onOutputFormatChanged() {
    // store new output format
    // store new output format, at the same time mark that this is no longer the first frame
    mOutputFormat = mBaseOutputFormat->dup();

    if (getPortFormat(kPortIndexOutput, mOutputFormat) != OK) {
@@ -5812,6 +5813,10 @@ bool ACodec::BaseState::onOMXFillBufferDone(
                new AMessage(kWhatOutputBufferDrained, mCodec);

            if (mCodec->mOutputFormat != mCodec->mLastOutputFormat && rangeLength > 0) {
                // pretend that output format has changed on the first frame (we used to do this)
                if (mCodec->mBaseOutputFormat == mCodec->mOutputFormat) {
                    mCodec->onOutputFormatChanged();
                }
                mCodec->addKeyFormatChangesToRenderBufferNotification(reply);
                mCodec->sendFormatChange();
            }