This is an automated email from the git hooks/post-receive script.
Git pushed a commit to branch master
in repository ffmpeg.
The following commit(s) were added to refs/heads/master by this push:
new 053585bc91 avcodec/mediacodec: return error when buffer is released a
second time
053585bc91 is described below
commit 053585bc91b6c1add179e828ee484a90c06a791a
Author: sfan5 <[email protected]>
AuthorDate: Mon Sep 7 21:28:04 2026 +0200
Commit: Kacper Michajłow <[email protected]>
CommitDate: Tue Sep 8 23:17:55 2026 +0000
avcodec/mediacodec: return error when buffer is released a second time
If the caller does any further processing (e.g. with AImageReader), it's
very important
to know if he can expect the frame to actually arrive at the surface or not.
This provides a clearly detectable error in case the buffer was released
multiple times
*or* the codec was flushed in the meantime.
---
libavcodec/mediacodec.c | 4 +++-
libavcodec/mediacodec.h | 6 +++++-
libavcodec/version.h | 2 +-
3 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/libavcodec/mediacodec.c b/libavcodec/mediacodec.c
index 33bde8112e..2701f35ef0 100644
--- a/libavcodec/mediacodec.c
+++ b/libavcodec/mediacodec.c
@@ -96,6 +96,8 @@ int av_mediacodec_release_buffer(AVMediaCodecBuffer *buffer,
int render)
"Releasing output buffer %zd (%p) ts=%"PRId64" with render=%d
[%d pending]\n",
buffer->index, buffer, buffer->pts, render,
atomic_load(&ctx->hw_buffer_count));
return ff_AMediaCodec_releaseOutputBuffer(ctx->codec, buffer->index,
render);
+ } else if (render) {
+ return AVERROR(ENOENT);
}
return 0;
@@ -114,7 +116,7 @@ int av_mediacodec_render_buffer_at_time(AVMediaCodecBuffer
*buffer, int64_t time
return ff_AMediaCodec_releaseOutputBufferAtTime(ctx->codec,
buffer->index, time);
}
- return 0;
+ return AVERROR(ENOENT);
}
#else
diff --git a/libavcodec/mediacodec.h b/libavcodec/mediacodec.h
index 4e9b56a618..98b85be853 100644
--- a/libavcodec/mediacodec.h
+++ b/libavcodec/mediacodec.h
@@ -81,7 +81,9 @@ typedef struct MediaCodecBuffer AVMediaCodecBuffer;
* @param buffer the buffer to render
* @param render 1 to release and render the buffer to the surface or 0 to
* discard the buffer
- * @return 0 on success, < 0 otherwise
+ * @return 0 on success, < 0 otherwise.
+ * AVERROR(ENOENT) is returned when trying to render a buffer that has already
+ * been released.
*/
int av_mediacodec_release_buffer(AVMediaCodecBuffer *buffer, int render);
@@ -95,6 +97,8 @@ int av_mediacodec_release_buffer(AVMediaCodecBuffer *buffer,
int render);
* @param buffer the buffer to render
* @param time timestamp in nanoseconds of when to render the buffer
* @return 0 on success, < 0 otherwise
+ * AVERROR(ENOENT) is returned when trying to render a buffer that has already
+ * been released.
*
* [0]:
https://developer.android.com/reference/android/media/MediaCodec#releaseOutputBuffer(int,%20long)
*/
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 8b53586be1..6d4d7ca018 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -30,7 +30,7 @@
#include "version_major.h"
#define LIBAVCODEC_VERSION_MINOR 11
-#define LIBAVCODEC_VERSION_MICRO 100
+#define LIBAVCODEC_VERSION_MICRO 101
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \
--
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]