Loading include/media/stagefright/ACodec.h +3 −0 Original line number Original line Diff line number Diff line Loading @@ -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 Loading media/libstagefright/ACodec.cpp +6 −1 Original line number Original line Diff line number Diff line Loading @@ -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(); Loading Loading @@ -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) { Loading Loading @@ -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(); } } Loading Loading
include/media/stagefright/ACodec.h +3 −0 Original line number Original line Diff line number Diff line Loading @@ -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 Loading
media/libstagefright/ACodec.cpp +6 −1 Original line number Original line Diff line number Diff line Loading @@ -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(); Loading Loading @@ -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) { Loading Loading @@ -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(); } } Loading