[FFmpeg-devel] [PATCH 5/5] avcodec/decode: Honour avcodec_send_packet() documentation

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Mon Sep 6 23:29:42 EEST 2021


The documentation of avcodec_send_packet() states that NULL packets
and packets with data == NULL and size == 0 signal EOS.
Yet avcodec_send_packet() actually used the BSF-definition of EOS:
A packet with no data and no side-data is EOS. This commit fixes this.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
A different solution to this mess is to adapt the documentation.
Given the recent extensions to AVPacket I have come to regret that
we allow to signal flushing by anything but a NULL packet.

 libavcodec/decode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/decode.c b/libavcodec/decode.c
index 4def801516..6a4b559c8d 100644
--- a/libavcodec/decode.c
+++ b/libavcodec/decode.c
@@ -587,7 +587,7 @@ int attribute_align_arg avcodec_send_packet(AVCodecContext *avctx, const AVPacke
     if (avpkt && !avpkt->size && avpkt->data)
         return AVERROR(EINVAL);
 
-    if (avpkt && (avpkt->data || avpkt->side_data_elems)) {
+    if (avpkt && (avpkt->data || avpkt->size)) {
         ret = av_packet_ref(avci->buffer_pkt, avpkt);
         if (ret < 0)
             return ret;
-- 
2.30.2



More information about the ffmpeg-devel mailing list