[FFmpeg-trac] #10849(avformat:new): demux_decode example fails to decode audio that ffmpeg can decode

FFmpeg trac at avcodec.org
Thu Feb 8 19:46:04 EET 2024


#10849: demux_decode example fails to decode audio that ffmpeg can decode
--------------------------------------+------------------------------------
             Reporter:  Andrew Wason  |                    Owner:  (none)
                 Type:  defect        |                   Status:  new
             Priority:  normal        |                Component:  avformat
              Version:  git-master    |               Resolution:
             Keywords:                |               Blocked By:
             Blocking:                |  Reproduced by developer:  0
Analyzed by developer:  0             |
--------------------------------------+------------------------------------
Comment (by Andrew Wason):

 It appears that `libavformat/nutdec.c` is returning the 0 size AVPacket

 I added some logging
 {{{
 diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c
 index afa27b827c..69ccbb49cc 100644
 --- a/libavformat/nutdec.c
 +++ b/libavformat/nutdec.c
 @@ -1146,6 +1146,9 @@ static int decode_frame(NUTContext *nut, AVPacket
 *pkt, int frame_code)
          pkt->flags |= AV_PKT_FLAG_KEY;
      pkt->pts = pts;

 +    if (pkt->data && pkt->size == 0)
 +        av_log(s, AV_LOG_WARNING, "Zero length packet in nut
 decode_frame\n");
 +
      return 0;
  fail:
      av_packet_unref(pkt);
 }}}
 And when it returns the 0 size packet, nut `decode_frame` had allocated it
 earlier with:
 {{{
 ret = av_new_packet(pkt, size + nut->header_len[header_idx])
 }}}
 {{{
 (lldb) p size + nut->header_len[header_idx]
 (int) 0
 }}}

 So either this is a nut demuxer issue, or the nut muxer created a broken
 file. Or should `av_new_packet` not set `data` if `size` is 0?
-- 
Ticket URL: <https://trac.ffmpeg.org/ticket/10849#comment:3>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list