From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH 3/6] avformat/matroskaenc: Split updating CodecPrivate from writing it
Date: Tue, 21 Jun 2022 23:45:43 +0200
Message-ID: <DB6PR0101MB22140D0FE4C6F3B24F03B7C38FB39@DB6PR0101MB2214.eurprd01.prod.exchangelabs.com> (raw)
In-Reply-To: <20220621152248.GH396728@pb2>
Michael Niedermayer:
> On Tue, Jun 21, 2022 at 04:34:15AM +0200, Andreas Rheinhardt wrote:
>> Up until now, updating extradata was very ad-hoc: The amount of
>> space reserved for extradata was not recorded when writing the
>> header; instead the AAC code simply presumed that it was enough.
>> This commit changes this by recording how much space is available.
>>
>> This brings with it that the code for writing of and reserving space
>> for the CodecPrivate and for updating it diverges. They are therefore
>> split; this allows to put other common tasks like seeking to
>> right offset as well as writing padding (in case the new extradata did
>> not fill the whole reserved space) to this common function.
>>
>> The code for filling up the reserved space is smarter than the code
>> it replaces; therefore it is no longer necessary to reserve more
>> than necessary just to be sure that one can add an EBML Void element
>> (whose minimum size is two) lateron. This is the reason for the change
>> to the aac-autobsf-adtstoasc test.
>>
>> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
>> ---
>> libavformat/matroskaenc.c | 120 ++++++++++++++++++---------
>> tests/ref/fate/aac-autobsf-adtstoasc | 4 +-
>> 2 files changed, 84 insertions(+), 40 deletions(-)
>
> triggers assert in fate
>
> ffmpeg/ffmpeg -nostdin -i fate-suite//audiomatch/tones_afconvert_16000_mono_aac_lc.m4a -f segment -segment_time 1 -map 0 -flags +bitexact -codec copy -segment_format_options live=1 -segment_list ffmpeg/tests/data/adts-to-mkv.m3u8 -y ffmpeg/tests/data/adts-to-mkv-%03d.mkv
>
> Metadata:
> major_brand : M4A
> minor_version : 0
> compatible_brands: M4A mp42isom
> creation_time : 2024-12-23T09:22:20.000000Z
> iTunSMPB : 00000000 00000840 000002C0 0000000000007D00 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
> Duration: 00:00:02.18, start: 0.132000, bitrate: 35 kb/s
> Stream #0:0[0x1](eng): Audio: aac (LC) (mp4a / 0x6134706D), 16000 Hz, mono, fltp, 20 kb/s (default)
> Metadata:
> creation_time : 2024-12-23T09:22:20.000000Z
> vendor_id : [0][0][0][0]
> [segment @ 0x562c56aa3f40] Opening 'ffmpeg/tests/data/adts-to-mkv-000.mkv' for writing
> Assertion codecpriv_size < max_payload_size failed at libavformat/matroskaenc.c:1239
> Aborted (core dumped)
>
Thanks for this. An earlier version stored the complete amount of bytes
reserved in the header including the bytes reserved for header and
length fields, whereas this version only stores the bytes necessary for
the payload and leaves the details of how much bytes to actually write
to mkv_put_codecprivate(). When I changed this, I forgot to correctly
update the assert (it is now of course entirely normal for
codecpriv_size and max_payload_size to coincide, so it should be a <=
instead of <) and it seems I also only ran the final version with an
assert-level 0 build only; earlier versions were checked with
--assert-level=2. How embarrassing.
Anyway, thanks for testing.
- Andreas
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
next prev parent reply other threads:[~2022-06-21 21:46 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-21 2:30 [FFmpeg-devel] [PATCH 1/6] avformat/matroskaenc: Split assembling " Andreas Rheinhardt
2022-06-21 2:34 ` [FFmpeg-devel] [PATCH 2/6] avformat/matroskaenc: Avoid swapping codecpar->extradata temporarily Andreas Rheinhardt
2022-06-21 2:34 ` [FFmpeg-devel] [PATCH 3/6] avformat/matroskaenc: Split updating CodecPrivate from writing it Andreas Rheinhardt
2022-06-21 15:22 ` Michael Niedermayer
2022-06-21 21:45 ` Andreas Rheinhardt [this message]
2022-06-21 2:34 ` [FFmpeg-devel] [PATCH 4/6] avcodec/av1: Add upper bound for the size of a sane sequence header Andreas Rheinhardt
2022-06-21 2:34 ` [FFmpeg-devel] [PATCH 5/6] avformat/matroskaenc: Improve handling of AV1 extradata Andreas Rheinhardt
2022-06-21 2:34 ` [FFmpeg-devel] [PATCH 6/6] avformat/matroskaenc: Fix outdated comment Andreas Rheinhardt
2022-06-21 3:22 ` [FFmpeg-devel] [PATCH 7/7] avformat/matroskaenc: Reuse dynamic buffer Andreas Rheinhardt
2022-06-24 9:50 ` [FFmpeg-devel] [PATCH 1/6] avformat/matroskaenc: Split assembling CodecPrivate from writing it Andreas Rheinhardt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=DB6PR0101MB22140D0FE4C6F3B24F03B7C38FB39@DB6PR0101MB2214.eurprd01.prod.exchangelabs.com \
--to=andreas.rheinhardt@outlook.com \
--cc=ffmpeg-devel@ffmpeg.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git