diff mbox series

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

Message ID AM7PR03MB66602533C61BB9A56C21F6FD8FD29@AM7PR03MB6660.eurprd03.prod.outlook.com
State New
Headers show
Series [FFmpeg-devel,1/5] configure: Remove null_bsf dependency
Related show

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished
andriy/make_ppc success Make finished
andriy/make_fate_ppc success Make fate finished

Commit Message

Andreas Rheinhardt Sept. 6, 2021, 8:29 p.m. UTC
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@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 mbox series

Patch

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;