Merge "CCodec: reduce log amount for render warning" into qt-dev
diff --git a/media/codec2/sfplugin/CCodecBufferChannel.cpp b/media/codec2/sfplugin/CCodecBufferChannel.cpp
index 90265de..715e78b 100644
--- a/media/codec2/sfplugin/CCodecBufferChannel.cpp
+++ b/media/codec2/sfplugin/CCodecBufferChannel.cpp
@@ -533,10 +533,12 @@
     feedInputBufferIfAvailable();
     if (!c2Buffer) {
         if (released) {
-            ALOGD("[%s] The app is calling releaseOutputBuffer() with "
-                  "timestamp or render=true with non-video buffers. Apps should "
-                  "call releaseOutputBuffer() with render=false for those.",
-                  mName);
+            std::call_once(mRenderWarningFlag, [this] {
+                ALOGW("[%s] The app is calling releaseOutputBuffer() with "
+                      "timestamp or render=true with non-video buffers. Apps should "
+                      "call releaseOutputBuffer() with render=false for those.",
+                      mName);
+            });
         }
         return INVALID_OPERATION;
     }
diff --git a/media/codec2/sfplugin/CCodecBufferChannel.h b/media/codec2/sfplugin/CCodecBufferChannel.h
index bc997e6..9aec82d 100644
--- a/media/codec2/sfplugin/CCodecBufferChannel.h
+++ b/media/codec2/sfplugin/CCodecBufferChannel.h
@@ -305,6 +305,7 @@
     Mutexed<ReorderStash> mReorderStash;
 
     std::atomic_bool mInputMetEos;
+    std::once_flag mRenderWarningFlag;
 
     inline bool hasCryptoOrDescrambler() {
         return mCrypto != nullptr || mDescrambler != nullptr;