From 4e865a3cfe4c955e0890321a6b488cf661808b63 Mon Sep 17 00:00:00 2001 From: Lajos Molnar Date: Fri, 5 Dec 2014 15:54:51 -0800 Subject: stagefright: preserve output format flags on format change Some flags are only set in configure, and get lost when output format changes. Bug: 17383204 Change-Id: I2011bce70920c4ee46fccc378da3b428f3395c11 --- media/libstagefright/ACodec.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'media/libstagefright/ACodec.cpp') diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp index 1413635..1a9b012 100644 --- a/media/libstagefright/ACodec.cpp +++ b/media/libstagefright/ACodec.cpp @@ -1158,7 +1158,7 @@ status_t ACodec::configureCodec( } sp inputFormat = new AMessage(); - sp outputFormat = new AMessage(); + sp outputFormat = mNotify->dup(); // will use this for kWhatOutputFormatChanged mIsEncoder = encoder; @@ -1543,6 +1543,8 @@ status_t ACodec::configureCodec( err = setMinBufferSize(kPortIndexInput, 8192); // XXX } + mBaseOutputFormat = outputFormat; + CHECK_EQ(getPortFormat(kPortIndexInput, inputFormat), (status_t)OK); CHECK_EQ(getPortFormat(kPortIndexOutput, outputFormat), (status_t)OK); mInputFormat = inputFormat; @@ -3533,7 +3535,7 @@ status_t ACodec::getPortFormat(OMX_U32 portIndex, sp ¬ify) { } void ACodec::sendFormatChange(const sp &reply) { - sp notify = mNotify->dup(); + sp notify = mBaseOutputFormat->dup(); notify->setInt32("what", kWhatOutputFormatChanged); CHECK_EQ(getPortFormat(kPortIndexOutput, notify), (status_t)OK); @@ -4648,6 +4650,7 @@ void ACodec::LoadedState::stateEntered() { mCodec->mRepeatFrameDelayUs = -1ll; mCodec->mInputFormat.clear(); mCodec->mOutputFormat.clear(); + mCodec->mBaseOutputFormat.clear(); if (mCodec->mShutdownInProgress) { bool keepComponentAllocated = mCodec->mKeepComponentAllocated; -- cgit v1.1