setDequeueTimeout on the output surface
This prevents allocation from blocking in Codec2 components and CCodec.
Test: make cts -j123 && cts-tradefed run cts-dev -m \
CtsMediaTestCases --compatibility:module-arg \
CtsMediaTestCases:include-annotation:\
android.platform.test.annotations.RequiresDevice
Bug: 120466624
Change-Id: Iea31dab23131a5aebb4b73112dbac8246e155b22
(cherry picked from commit cb11f199516ae29cdc7897075ec8774d5c02f0a5)
diff --git a/media/sfplugin/CCodecBufferChannel.cpp b/media/sfplugin/CCodecBufferChannel.cpp
index 90a04d1..383ae4d 100644
--- a/media/sfplugin/CCodecBufferChannel.cpp
+++ b/media/sfplugin/CCodecBufferChannel.cpp
@@ -283,6 +283,10 @@
// This can fit 4K RGBA frame, and most likely client won't need more than this.
const static size_t kMaxLinearBufferSize = 3840 * 2160 * 4;
+// N.B. This is for not changing buffer dropping logic in IGBP other than making
+// it Non-blocking. Do not change this value.
+const static size_t kDequeueTimeoutNs = 0;
+
/**
* Simple local buffer pool backed by std::vector.
*/
@@ -2740,6 +2744,7 @@
if (newSurface) {
newSurface->setScalingMode(NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW);
newSurface->setMaxDequeuedBufferCount(kMinOutputBufferArraySize + kMinInputBufferArraySize);
+ newSurface->setDequeueTimeout(kDequeueTimeoutNs);
producer = newSurface->getIGraphicBufferProducer();
producer->setGenerationNumber(generation);
} else {