CCodec: reduce log amount for render warning
Bug: 124096926
Test: builds
Change-Id: I7fd7bd0da8e32793f87c0c8278c208d1b4d5bbb2
diff --git a/media/codec2/sfplugin/CCodecBufferChannel.cpp b/media/codec2/sfplugin/CCodecBufferChannel.cpp
index d1fa920..1b21df1 100644
--- a/media/codec2/sfplugin/CCodecBufferChannel.cpp
+++ b/media/codec2/sfplugin/CCodecBufferChannel.cpp
@@ -1917,10 +1917,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 1ea29b4..964121e 100644
--- a/media/codec2/sfplugin/CCodecBufferChannel.h
+++ b/media/codec2/sfplugin/CCodecBufferChannel.h
@@ -311,6 +311,7 @@
Mutexed<ReorderStash> mReorderStash;
std::atomic_bool mInputMetEos;
+ std::once_flag mRenderWarningFlag;
inline bool hasCryptoOrDescrambler() {
return mCrypto != nullptr || mDescrambler != nullptr;