summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/ACodec.cpp
diff options
context:
space:
mode:
authorLajos Molnar <lajos@google.com>2013-11-06 21:04:34 -0800
committerLajos Molnar <lajos@google.com>2013-11-14 13:53:56 -0800
commit4dd0a8a3d66c2853faf2834565b3c5df4f68734d (patch)
tree4cc6ee6dc0c7f72f5ae0facfd84b0342c5f87afe /media/libstagefright/ACodec.cpp
parent4215e6166fca9f87a6e9e848b3dfd4ab0d25c954 (diff)
downloadframeworks_av-4dd0a8a3d66c2853faf2834565b3c5df4f68734d.zip
frameworks_av-4dd0a8a3d66c2853faf2834565b3c5df4f68734d.tar.gz
frameworks_av-4dd0a8a3d66c2853faf2834565b3c5df4f68734d.tar.bz2
WA: Queue extra buffers on output port during reconfig if input EOS-ed
Some codecs may return input buffers before having them processed. This causes a halt if we already signaled an EOS on the input port. For now keep submitting output meta buffers one at a time if the input EOS-ed, but the output not yet. Normally, we submit an output buffer for each input buffer that is with the component (waiting to be processed). Change-Id: I8a1251bfb504f40f1e4085a1e220bf9a4d0b05d9 Signed-off-by: Lajos Molnar <lajos@google.com> Bug: 11433909
Diffstat (limited to 'media/libstagefright/ACodec.cpp')
-rw-r--r--media/libstagefright/ACodec.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/media/libstagefright/ACodec.cpp b/media/libstagefright/ACodec.cpp
index 528fdb9..5d5220f 100644
--- a/media/libstagefright/ACodec.cpp
+++ b/media/libstagefright/ACodec.cpp
@@ -452,6 +452,18 @@ void ACodec::signalRequestIDRFrame() {
(new AMessage(kWhatRequestIDRFrame, id()))->post();
}
+// *** NOTE: THE FOLLOWING WORKAROUND WILL BE REMOVED ***
+// Some codecs may return input buffers before having them processed.
+// This causes a halt if we already signaled an EOS on the input
+// port. For now keep submitting an output buffer if there was an
+// EOS on the input port, but not yet on the output port.
+void ACodec::signalSubmitOutputMetaDataBufferIfEOS_workaround() {
+ if (mPortEOS[kPortIndexInput] && !mPortEOS[kPortIndexOutput] &&
+ mMetaDataBuffersToSubmit > 0) {
+ (new AMessage(kWhatSubmitOutputMetaDataBufferIfEOS, id()))->post();
+ }
+}
+
status_t ACodec::allocateBuffersOnPort(OMX_U32 portIndex) {
CHECK(portIndex == kPortIndexInput || portIndex == kPortIndexOutput);
@@ -4036,6 +4048,9 @@ void ACodec::ExecutingState::submitOutputMetaBuffers() {
break;
}
}
+
+ // *** NOTE: THE FOLLOWING WORKAROUND WILL BE REMOVED ***
+ mCodec->signalSubmitOutputMetaDataBufferIfEOS_workaround();
}
void ACodec::ExecutingState::submitRegularOutputBuffers() {
@@ -4184,6 +4199,19 @@ bool ACodec::ExecutingState::onMessageReceived(const sp<AMessage> &msg) {
break;
}
+ // *** NOTE: THE FOLLOWING WORKAROUND WILL BE REMOVED ***
+ case kWhatSubmitOutputMetaDataBufferIfEOS:
+ {
+ if (mCodec->mPortEOS[kPortIndexInput] &&
+ !mCodec->mPortEOS[kPortIndexOutput]) {
+ status_t err = mCodec->submitOutputMetaDataBuffer();
+ if (err == OK) {
+ mCodec->signalSubmitOutputMetaDataBufferIfEOS_workaround();
+ }
+ }
+ return true;
+ }
+
default:
handled = BaseState::onMessageReceived(msg);
break;