PR #24425 opened by Zhao Zhili (quink)
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24425
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24425.patch

# Summary of changes

053585bc91b made rendering an already released buffer return
AVERROR(ENOENT), but left the function description saying that
subsequent calls have no effect. It also omitted the API change entry.


<!--
If this PR requires new FATE test samples, attach them to the PR and
list their target paths below (relative to the fate-suite root).

Attached filenames must match the sample's filename:

```fate-samples
# e.g. vorbis/new-sample.ogg
```
-->



>From 903325e279b67156c3aa1f06ec5cb2378d9d004d Mon Sep 17 00:00:00 2001
From: Zhao Zhili <[email protected]>
Date: Wed, 9 Sep 2026 10:58:02 +0800
Subject: [PATCH] avcodec/mediacodec: document the ENOENT return of buffer
 release

053585bc91b made rendering an already released buffer return
AVERROR(ENOENT), but left the function description saying that
subsequent calls have no effect. It also omitted the API change entry.
---
 doc/APIchanges          |  5 +++++
 libavcodec/mediacodec.h | 14 ++++++--------
 2 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 2f6a3fc08e..9c057b6510 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -5,6 +5,11 @@ API changes, most recent first:
 2026-09-xx - xxxxxxxxxx - lavu 61.7.100 - samplefmt.h
   Add AV_SAMPLE_FMT_DSD.
 
+2026-09-08 - 053585bc91b - lavc 63.11.101 - mediacodec.h
+  av_mediacodec_release_buffer() and av_mediacodec_render_buffer_at_time()
+  now return AVERROR(ENOENT) when trying to render a buffer that was already
+  released or invalidated by a codec flush.
+
 2026-09-01 - xxxxxxxxxx - lavc 63.10.100 - avcodec.h
   Add AVCodecContext.skip_pred.
 
diff --git a/libavcodec/mediacodec.h b/libavcodec/mediacodec.h
index 98b85be853..5382302a4c 100644
--- a/libavcodec/mediacodec.h
+++ b/libavcodec/mediacodec.h
@@ -75,15 +75,14 @@ typedef struct MediaCodecBuffer AVMediaCodecBuffer;
 /**
  * Release a MediaCodec buffer and render it to the surface that is associated
  * with the decoder. This function should only be called once on a given
- * buffer, once released the underlying buffer returns to the codec, thus
- * subsequent calls to this function will have no effect.
+ * buffer: once released, the underlying buffer returns to the codec and the
+ * caller no longer owns it.
  *
  * @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.
- * AVERROR(ENOENT) is returned when trying to render a buffer that has already
- * been released.
+ * @return 0 on success, < 0 otherwise. AVERROR(ENOENT) if render is nonzero
+ * and the buffer was already released or invalidated by a codec flush.
  */
 int av_mediacodec_release_buffer(AVMediaCodecBuffer *buffer, int render);
 
@@ -96,9 +95,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.
+ * @return 0 on success, < 0 otherwise. AVERROR(ENOENT) if the buffer was
+ * already released or invalidated by a codec flush.
  *
  * [0]: 
https://developer.android.com/reference/android/media/MediaCodec#releaseOutputBuffer(int,%20long)
  */
-- 
2.52.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to