Merge "Add format change check rule" into main am: 718ccb5ef7
Original change: https://android-review.googlesource.com/c/platform/frameworks/av/+/2711853
Change-Id: I0ecc51454d6df690fe69c69f249437a0555586ae
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/media/codec2/sfplugin/CCodecBufferChannel.cpp b/media/codec2/sfplugin/CCodecBufferChannel.cpp
index 51082d1..e785b64 100644
--- a/media/codec2/sfplugin/CCodecBufferChannel.cpp
+++ b/media/codec2/sfplugin/CCodecBufferChannel.cpp
@@ -2147,8 +2147,15 @@
if (notifyClient && !buffer && !flags) {
if (mTunneled && drop && outputFormat) {
- ALOGV("[%s] onWorkDone: Keep tunneled, drop frame with format change (%lld)",
- mName, work->input.ordinal.frameIndex.peekull());
+ if (mOutputFormat != outputFormat) {
+ ALOGV("[%s] onWorkDone: Keep tunneled, drop frame with format change (%lld)",
+ mName, work->input.ordinal.frameIndex.peekull());
+ mOutputFormat = outputFormat;
+ } else {
+ ALOGV("[%s] onWorkDone: Not reporting output buffer without format change (%lld)",
+ mName, work->input.ordinal.frameIndex.peekull());
+ notifyClient = false;
+ }
} else {
ALOGV("[%s] onWorkDone: Not reporting output buffer (%lld)",
mName, work->input.ordinal.frameIndex.peekull());
diff --git a/media/codec2/sfplugin/CCodecBufferChannel.h b/media/codec2/sfplugin/CCodecBufferChannel.h
index 2d87aa9..64661ee 100644
--- a/media/codec2/sfplugin/CCodecBufferChannel.h
+++ b/media/codec2/sfplugin/CCodecBufferChannel.h
@@ -302,6 +302,7 @@
std::shared_ptr<C2BlockPool> mInputAllocator;
QueueSync mQueueSync;
std::vector<std::unique_ptr<C2Param>> mParamsToBeSet;
+ sp<AMessage> mOutputFormat;
struct Input {
Input();