Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
* [FFmpeg-devel] [PATCH] avcodec/mediacodecdec: add low-latency decoding
@ 2023-05-22  9:56 xufuji456
  0 siblings, 0 replies; only message in thread
From: xufuji456 @ 2023-05-22  9:56 UTC (permalink / raw)
  To: ffmpeg-devel; +Cc: xufuji456

The low-latency decoding mode has available in Android api 30.
It will keep less buffer internally, and output frame as fast as possible.
See https://developer.android.google.cn/reference/android/media/MediaCodec?hl=en#PARAMETER_KEY_LOW_LATENCY

Signed-off-by: xufuji456 <839789740@qq.com>
---
 libavcodec/mediacodecdec.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/mediacodecdec.c b/libavcodec/mediacodecdec.c
index 21464900d1..5fece6ee5b 100644
--- a/libavcodec/mediacodecdec.c
+++ b/libavcodec/mediacodecdec.c
@@ -394,6 +394,10 @@ static av_cold int mediacodec_decode_init(AVCodecContext *avctx)
     ff_AMediaFormat_setString(format, "mime", codec_mime);
     ff_AMediaFormat_setInt32(format, "width", avctx->width);
     ff_AMediaFormat_setInt32(format, "height", avctx->height);
+    // low-latency mode: available in Android api 30
+    if (avctx->flags & AV_CODEC_FLAG_LOW_DELAY) {
+        ff_AMediaFormat_setInt32(format, "low-latency", 1);
+    }
 
     s->ctx = av_mallocz(sizeof(*s->ctx));
     if (!s->ctx) {
-- 
2.32.0 (Apple Git-132)

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2023-05-22  9:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-22  9:56 [FFmpeg-devel] [PATCH] avcodec/mediacodecdec: add low-latency decoding xufuji456

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git