After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 792644 - aacparse: mishandles very small frames in "raw" stream-format, if passthrough is disabled
aacparse: mishandles very small frames in "raw" stream-format, if passthrough...
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
1.12.4
Other All
: Normal normal
: 1.12.5
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2018-01-18 14:11 UTC by Jan Alexander Steffens (heftig)
Modified: 2018-01-18 19:10 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
aacparse: When parsing raw input, accept frames of any size (1.99 KB, patch)
2018-01-18 14:49 UTC, Jan Alexander Steffens (heftig)
committed Details | Review
tests: aacparser: Test that short raw frames don't get concatenated (2.91 KB, patch)
2018-01-18 14:49 UTC, Jan Alexander Steffens (heftig)
committed Details | Review

Description Jan Alexander Steffens (heftig) 2018-01-18 14:11:33 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.
Comment 1 Jan Alexander Steffens (heftig) 2018-01-18 14:49:30 UTC
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.
Comment 2 Jan Alexander Steffens (heftig) 2018-01-18 14:49:35 UTC
Created attachment 367020 [details] [review]
tests: aacparser: Test that short raw frames don't get concatenated
Comment 3 Tim-Philipp Müller 2018-01-18 18:55:13 UTC
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
Comment 4 Tim-Philipp Müller 2018-01-18 19:10:15 UTC
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