diff options
author | Andreas Huber <andih@google.com> | 2011-09-26 10:53:29 -0700 |
---|---|---|
committer | Andreas Huber <andih@google.com> | 2011-09-26 10:53:29 -0700 |
commit | dc9bacd838442a524585887e6ea6696836be2eda (patch) | |
tree | 230135b6bc20bff2be5a8292e91c0fac86201039 /media/libstagefright/ACodec.cpp | |
parent | ece731de0c0af30917316d55313f25c56f91960d (diff) | |
download | frameworks_av-dc9bacd838442a524585887e6ea6696836be2eda.zip frameworks_av-dc9bacd838442a524585887e6ea6696836be2eda.tar.gz frameworks_av-dc9bacd838442a524585887e6ea6696836be2eda.tar.bz2 |
Propagate error signalled by the source all the way to the output EOS notification.
Change-Id: I30e959a6d669f09745c59fbdebee08f869511cf7
related-to-bug: 5372901
Diffstat (limited to 'media/libstagefright/ACodec.cpp')
-rw-r--r-- | media/libstagefright/ACodec.cpp | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp index a2d9e59..a3746cd 100644 --- a/media/libstagefright/ACodec.cpp +++ b/media/libstagefright/ACodec.cpp @@ -323,6 +323,7 @@ ACodec::ACodec() mFlushingState = new FlushingState(this); mPortEOS[kPortIndexInput] = mPortEOS[kPortIndexOutput] = false; + mInputEOSResult = OK; changeState(mUninitializedState); } @@ -1347,7 +1348,10 @@ void ACodec::BaseState::onInputBufferFilled(const sp<AMessage> &msg) { case KEEP_BUFFERS: { if (buffer == NULL) { - mCodec->mPortEOS[kPortIndexInput] = true; + if (!mCodec->mPortEOS[kPortIndexInput]) { + mCodec->mPortEOS[kPortIndexInput] = true; + mCodec->mInputEOSResult = err; + } } break; } @@ -1398,8 +1402,14 @@ void ACodec::BaseState::onInputBufferFilled(const sp<AMessage> &msg) { getMoreInputDataIfPossible(); } else if (!mCodec->mPortEOS[kPortIndexInput]) { - LOGV("[%s] Signalling EOS on the input port", - mCodec->mComponentName.c_str()); + if (err != ERROR_END_OF_STREAM) { + LOGV("[%s] Signalling EOS on the input port " + "due to error %d", + mCodec->mComponentName.c_str(), err); + } else { + LOGV("[%s] Signalling EOS on the input port", + mCodec->mComponentName.c_str()); + } LOGV("[%s] calling emptyBuffer %p signalling EOS", mCodec->mComponentName.c_str(), bufferID); @@ -1416,6 +1426,7 @@ void ACodec::BaseState::onInputBufferFilled(const sp<AMessage> &msg) { info->mStatus = BufferInfo::OWNED_BY_COMPONENT; mCodec->mPortEOS[kPortIndexInput] = true; + mCodec->mInputEOSResult = err; } break; @@ -1523,6 +1534,7 @@ bool ACodec::BaseState::onOMXFillBufferDone( if (flags & OMX_BUFFERFLAG_EOS) { sp<AMessage> notify = mCodec->mNotify->dup(); notify->setInt32("what", ACodec::kWhatEOS); + notify->setInt32("err", mCodec->mInputEOSResult); notify->post(); mCodec->mPortEOS[kPortIndexOutput] = true; @@ -1721,6 +1733,8 @@ void ACodec::UninitializedState::onSetup( mCodec->mPortEOS[kPortIndexInput] = mCodec->mPortEOS[kPortIndexOutput] = false; + mCodec->mInputEOSResult = OK; + mCodec->configureCodec(mime.c_str(), msg); sp<RefBase> obj; @@ -2371,6 +2385,8 @@ void ACodec::FlushingState::changeStateIfWeOwnAllBuffers() { mCodec->mPortEOS[kPortIndexInput] = mCodec->mPortEOS[kPortIndexOutput] = false; + mCodec->mInputEOSResult = OK; + mCodec->changeState(mCodec->mExecutingState); } } |