[FFmpeg-devel] [PATCH 2/2] avcodec/mediacodecdec: add more trace logging of input/output buffers

Aman Gupta ffmpeg at tmm1.net
Tue Mar 6 23:15:56 EET 2018


From: Aman Gupta <aman at tmm1.net>

---
 libavcodec/mediacodec.c           | 1 +
 libavcodec/mediacodecdec_common.c | 4 ++++
 libavcodec/mediacodecdec_common.h | 1 +
 3 files changed, 6 insertions(+)

diff --git a/libavcodec/mediacodec.c b/libavcodec/mediacodec.c
index bf1b7477f1..5cb96d2b65 100644
--- a/libavcodec/mediacodec.c
+++ b/libavcodec/mediacodec.c
@@ -92,6 +92,7 @@ int av_mediacodec_release_buffer(AVMediaCodecBuffer *buffer, int render)
     int released = atomic_fetch_add(&buffer->released, 1);
 
     if (!released && (ctx->delay_flush || buffer->serial == atomic_load(&ctx->serial))) {
+        av_log(ctx->avctx, AV_LOG_TRACE, "Releasing output buffer %zd ts=%"PRId64" render=%d\n", buffer->index, buffer->pts, render);
         return ff_AMediaCodec_releaseOutputBuffer(ctx->codec, buffer->index, render);
     }
 
diff --git a/libavcodec/mediacodecdec_common.c b/libavcodec/mediacodecdec_common.c
index b4f1f6685b..121356c13e 100644
--- a/libavcodec/mediacodecdec_common.c
+++ b/libavcodec/mediacodecdec_common.c
@@ -452,6 +452,7 @@ int ff_mediacodec_dec_init(AVCodecContext *avctx, MediaCodecDecContext *s,
         AV_PIX_FMT_NONE,
     };
 
+    s->avctx = avctx;
     atomic_init(&s->refcount, 1);
     atomic_init(&s->serial, 1);
 
@@ -619,6 +620,9 @@ int ff_mediacodec_dec_send(AVCodecContext *avctx, MediaCodecDecContext *s,
                 av_log(avctx, AV_LOG_ERROR, "Failed to queue input buffer (status = %d)\n", status);
                 return AVERROR_EXTERNAL;
             }
+
+            av_log(avctx, AV_LOG_TRACE, "Queued input buffer %zd"
+                    " size=%zd ts=%" PRIi64 "\n", index, size, pts);
         }
     }
 
diff --git a/libavcodec/mediacodecdec_common.h b/libavcodec/mediacodecdec_common.h
index afb98ffed9..3fd2412a65 100644
--- a/libavcodec/mediacodecdec_common.h
+++ b/libavcodec/mediacodecdec_common.h
@@ -36,6 +36,7 @@
 
 typedef struct MediaCodecDecContext {
 
+    AVCodecContext *avctx;
     atomic_int refcount;
 
     char *codec_name;
-- 
2.14.2



More information about the ffmpeg-devel mailing list