This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit 2e6d5dbdc270e58427a59b844cbbaa0269ae8a9d Author: James Almer <[email protected]> AuthorDate: Fri Jun 26 10:23:55 2026 -0300 Commit: James Almer <[email protected]> CommitDate: Mon Jun 29 12:38:12 2026 -0300 avformat/movenc: drain buffered EAC3 packets handle_eac3() will buffer a packet if it doesn't reach the desired num_blocks value, but if it was the last one to be passed to the muxer, it will never be written. Fix this by writing it during mov_write_trailer(). Signed-off-by: James Almer <[email protected]> --- libavformat/movenc.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/libavformat/movenc.c b/libavformat/movenc.c index 6012b16d67..48914de5e8 100644 --- a/libavformat/movenc.c +++ b/libavformat/movenc.c @@ -382,6 +382,7 @@ static int mov_write_amr_tag(AVIOContext *pb, MOVTrack *track) struct eac3_info { AVPacket *pkt; + uint8_t eof; uint8_t ec3_done; uint8_t num_blocks; @@ -478,6 +479,12 @@ static int handle_eac3(MOVMuxContext *mov, AVPacket *pkt, MOVTrack *track) if (!info->pkt && !(info->pkt = av_packet_alloc())) return AVERROR(ENOMEM); + if (info->eof) { + av_assert1(!info->pkt->size); + ret = pkt->size; + goto end; + } + if ((ret = avpriv_ac3_parse_header(&hdr, pkt->data, pkt->size)) < 0) { if (ret == AVERROR(ENOMEM)) goto end; @@ -9030,6 +9037,24 @@ static int mov_write_trailer(AVFormatContext *s) } } + //Also check for a buffered EAC3 packet + for (i = 0; i < mov->nb_tracks; i++) { + MOVTrack *trk = &mov->tracks[i]; + if (trk->par->codec_id != AV_CODEC_ID_EAC3) + continue; + struct eac3_info *info = trk->eac3_priv; + if (!info || !info->pkt || !info->pkt->size) + continue; + + av_packet_move_ref(mov->pkt, info->pkt); + info->eof = 1; + res = mov_write_single_packet(s, mov->pkt); + if (res < 0) + return res; + + av_packet_unref(mov->pkt); + } + // Check if we have any tracks that require squashing. // In that case, we'll have to write the packet here. if ((res = mov_write_squashed_packets(s)) < 0) _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
