diff options
author | Andy McFadden <fadden@android.com> | 2013-03-05 14:31:02 -0800 |
---|---|---|
committer | Andy McFadden <fadden@android.com> | 2013-03-05 16:29:55 -0800 |
commit | ba6218eae3dbcf3f962b3561b26374a214dbf5e2 (patch) | |
tree | 4b7922c6822c116b67123022fa48489a23724fe7 /media/libstagefright/ACodec.cpp | |
parent | a7a5917a064710edea9cfacc8eda44532150e852 (diff) | |
download | frameworks_av-ba6218eae3dbcf3f962b3561b26374a214dbf5e2.zip frameworks_av-ba6218eae3dbcf3f962b3561b26374a214dbf5e2.tar.gz frameworks_av-ba6218eae3dbcf3f962b3561b26374a214dbf5e2.tar.bz2 |
Correct MediaCodec + Surface behavior
Assorted tweaks:
- Allow signalEndOfInputStream() before ACodec is in Executing
state (added message to two more states).
- Return an error if signalEndOfInputStream() is called a second
time on the same stream.
- Require AndroidOpaque color format in createInputSurface().
- Disallow dequeueInputBuffer() after an input surface has been
created (boolean flag in MediaCodec tracks it).
- Discard input surface when encoder is re-configure()ed (drop
OMXNodeInstance's ref when we go back to Loaded).
Bug 7991062
Change-Id: Iff30f3036e14eb5a2f6536910dcf11aba33031ee
Diffstat (limited to 'media/libstagefright/ACodec.cpp')
-rw-r--r-- | media/libstagefright/ACodec.cpp | 39 |
1 files changed, 24 insertions, 15 deletions
diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp index 59fc45e..1a2eeb1 100644 --- a/media/libstagefright/ACodec.cpp +++ b/media/libstagefright/ACodec.cpp @@ -241,9 +241,6 @@ struct ACodec::ExecutingState : public ACodec::BaseState { // to fill with data. void resume(); - // Send EOS on input stream. - void onSignalEndOfInputStream(); - // Returns true iff input and output buffers are in play. bool active() const { return mActive; } @@ -3413,6 +3410,12 @@ bool ACodec::LoadedToIdleState::onMessageReceived(const sp<AMessage> &msg) { return true; } + case kWhatSignalEndOfInputStream: + { + mCodec->onSignalEndOfInputStream(); + return true; + } + default: return BaseState::onMessageReceived(msg); } @@ -3458,6 +3461,12 @@ bool ACodec::IdleToExecutingState::onMessageReceived(const sp<AMessage> &msg) { return true; } + case kWhatSignalEndOfInputStream: + { + mCodec->onSignalEndOfInputStream(); + return true; + } + default: return BaseState::onMessageReceived(msg); } @@ -3538,17 +3547,6 @@ void ACodec::ExecutingState::resume() { mActive = true; } -void ACodec::ExecutingState::onSignalEndOfInputStream() { - sp<AMessage> notify = mCodec->mNotify->dup(); - notify->setInt32("what", ACodec::kWhatSignaledInputEOS); - - status_t err = mCodec->mOMX->signalEndOfInputStream(mCodec->mNode); - if (err != OK) { - notify->setInt32("err", err); - } - notify->post(); -} - void ACodec::ExecutingState::stateEntered() { ALOGV("[%s] Now Executing", mCodec->mComponentName.c_str()); @@ -3640,7 +3638,7 @@ bool ACodec::ExecutingState::onMessageReceived(const sp<AMessage> &msg) { case ACodec::kWhatSignalEndOfInputStream: { - onSignalEndOfInputStream(); + mCodec->onSignalEndOfInputStream(); handled = true; break; } @@ -3678,6 +3676,17 @@ status_t ACodec::setParameters(const sp<AMessage> ¶ms) { return OK; } +void ACodec::onSignalEndOfInputStream() { + sp<AMessage> notify = mNotify->dup(); + notify->setInt32("what", ACodec::kWhatSignaledInputEOS); + + status_t err = mOMX->signalEndOfInputStream(mNode); + if (err != OK) { + notify->setInt32("err", err); + } + notify->post(); +} + bool ACodec::ExecutingState::onOMXEvent( OMX_EVENTTYPE event, OMX_U32 data1, OMX_U32 data2) { switch (event) { |