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

Commit 8db6cd31 authored by Lajos Molnar's avatar Lajos Molnar Committed by android-build-merger
Browse files

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

am: 5048de32

* commit '5048de32':
  stagefright: ACodec: read output port format on first frame
parents ca38806d 5048de32
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -253,6 +253,9 @@ private:
    sp<AMessage> mConfigFormat;
    sp<AMessage> mConfigFormat;
    sp<AMessage> mInputFormat;
    sp<AMessage> mInputFormat;
    sp<AMessage> mOutputFormat;
    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;
    sp<AMessage> mBaseOutputFormat;


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


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


void ACodec::onOutputFormatChanged() {
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();
    mOutputFormat = mBaseOutputFormat->dup();


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


            if (mCodec->mOutputFormat != mCodec->mLastOutputFormat && rangeLength > 0) {
            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->addKeyFormatChangesToRenderBufferNotification(reply);
                mCodec->sendFormatChange();
                mCodec->sendFormatChange();
            }
            }