GNOME Bugzilla – Bug 792644
aacparse: mishandles very small frames in "raw" stream-format, if passthrough is disabled
Last modified: 2018-01-18 19:10:50 UTC
Raw AAC streams we encounter (in RTMP and FLV) occasionally have very small frames (6 bytes: 27 00 03 20 64 1c). These are smaller than aacparse's default min_frame_size (ADTS_MAX_SIZE = 10). When passthrough is disabled or aacparse has to output ADTS, BaseParse will concatenate these short frames to the following frame before handling them to aacparse, which processes each input buffer as a single frame, producing bad output. Patches follow.
Created attachment 367019 [details] [review] aacparse: When parsing raw input, accept frames of any size Raw AAC streams we encounter (in RTMP and FLV) occasionally have very small frames (6 bytes: 27 00 03 20 64 1c). These are smaller than aacparse's default min_frame_size (ADTS_MAX_SIZE = 10). When passthrough is disabled or aacparse has to output ADTS, BaseParse will concatenate these short frames to the following frame before handling them to aacparse, which processes each input buffer as a single frame, producing bad output. To avoid this problem, set the min_frame_size to 1 when receiving a raw stream.
Created attachment 367020 [details] [review] tests: aacparser: Test that short raw frames don't get concatenated
This looks fine to me. Can be demonstrated also with: gst-launch-1.0 audiotestsrc wave=silence num-buffers=10 ! faac ! audio/mpeg,stream-format=raw ! identity silent=false ! aacparse disable-passthrough=true ! audio/mpeg,stream-format=raw ! fakesink silent=false -v
Thanks! commit 54f312644e5240d10e089cbd65c5e8633c9d1b05 (HEAD -> master) Author: Jan Alexander Steffens (heftig) <jsteffens@make.tv> Date: Thu Jan 18 15:09:04 2018 +0100 tests: aacparser: Test that short raw frames don't get concatenated https://bugzilla.gnome.org/show_bug.cgi?id=792644 commit e273e5f7a6295425fe9749724ff5b95c751842ed Author: Jan Alexander Steffens (heftig) <jsteffens@make.tv> Date: Thu Jan 18 14:23:07 2018 +0100 aacparse: When parsing raw input, accept frames of any size Raw AAC streams might have very small frames, e.g. 6 byte frames when encoding silence. These frames are then smaller than aacparse's default min_frame_size of 10 bytes (ADTS_MAX_SIZE). When passthrough is disabled or aacparse has to output ADTS, GstBaseParse will concatenate these short frames to the following frame before handling them to aacparse, which processes each input buffer as a single frame, producing bad output. To avoid this problem, set the min_frame_size to 1 when receiving a raw stream. https://bugzilla.gnome.org/show_bug.cgi?id=792644