RELAND CCodec: don't drop metadata for output with flag FLAG_DROP_FRAME.
Limit scope to tunneled playback to minimize risk
Bug: 199668436
Test: TBD
Change-Id: I15e6df7b33cad605c9ace6bc25a6ae324d843e9f
diff --git a/media/codec2/sfplugin/CCodecBufferChannel.cpp b/media/codec2/sfplugin/CCodecBufferChannel.cpp
index cdd9275..ba3c9ca 100644
--- a/media/codec2/sfplugin/CCodecBufferChannel.cpp
+++ b/media/codec2/sfplugin/CCodecBufferChannel.cpp
@@ -1358,6 +1358,12 @@
}
}
}
+
+ int32_t tunneled = 0;
+ if (!outputFormat->findInt32("android._tunneled", &tunneled)) {
+ tunneled = 0;
+ }
+ mTunneled = (tunneled != 0);
}
// Set up pipeline control. This has to be done after mInputBuffers and
@@ -1853,10 +1859,21 @@
}
}
+ bool drop = false;
+ if (worklet->output.flags & C2FrameData::FLAG_DROP_FRAME) {
+ ALOGV("[%s] onWorkDone: drop buffer but keep metadata", mName);
+ drop = true;
+ }
+
if (notifyClient && !buffer && !flags) {
- ALOGV("[%s] onWorkDone: Not reporting output buffer (%lld)",
- mName, work->input.ordinal.frameIndex.peekull());
- notifyClient = false;
+ if (mTunneled && drop && outputFormat) {
+ ALOGV("[%s] onWorkDone: Keep tunneled, drop frame with format change (%lld)",
+ mName, work->input.ordinal.frameIndex.peekull());
+ } else {
+ ALOGV("[%s] onWorkDone: Not reporting output buffer (%lld)",
+ mName, work->input.ordinal.frameIndex.peekull());
+ notifyClient = false;
+ }
}
if (buffer) {