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.rheinha...@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

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

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

Reply via email to