Merge "codec2: Avoid sending input done event for incomplete work"
diff --git a/media/codec2/sfplugin/CCodec.cpp b/media/codec2/sfplugin/CCodec.cpp
index 592ff31..e812be2 100644
--- a/media/codec2/sfplugin/CCodec.cpp
+++ b/media/codec2/sfplugin/CCodec.cpp
@@ -2264,7 +2264,12 @@
}
}
if (config->mInputSurface) {
- config->mInputSurface->onInputBufferDone(work->input.ordinal.frameIndex);
+ if (work->worklets.empty()
+ || !work->worklets.back()
+ || (work->worklets.back()->output.flags
+ & C2FrameData::FLAG_INCOMPLETE) == 0) {
+ config->mInputSurface->onInputBufferDone(work->input.ordinal.frameIndex);
+ }
}
if (initDataWatcher.hasChanged()) {
initData = initDataWatcher.update();