GNOME Bugzilla – Bug 774129
'gst_buffer_is_writable' assertion in aacparse
Last modified: 2016-11-15 13:10:51 UTC
Created attachment 339363 [details] [review] Patch to resolve 'gst_buffer_is_writable' assertion in aacparse When accparse is using read only input buffer. Assertion is dumped. gst-launch-1.0 audiotestsrc name=src \ src.! voaacenc ! audio/mpeg,framed=true,stream-format=adts ! tee name=split \ split.! queue ! aacparse ! audio/mpeg,stream-format=adts ! fakesink \ split.! queue ! aacparse ! audio/mpeg,stream-format=raw ! fakesink --gst-debug=3 -v GStreamer-CRITICAL **: gst_buffer_resize_range: assertion 'gst_buffer_is_writable (buffer)' failed GStreamer-CRITICAL **: gst_buffer_resize_range: assertion 'gst_buffer_is_writable (buffer)' failed GStreamer-CRITICAL **: gst_buffer_resize_range: assertion 'gst_buffer_is_writable (buffer)' failed GStreamer-CRITICAL **: gst_buffer_resize_range: assertion 'gst_buffer_is_writable (buffer)' failed GStreamer-CRITICAL **: gst_buffer_resize_range: assertion 'gst_buffer_is_writable (buffer)' failed GStreamer-CRITICAL **: gst_buffer_resize_range: assertion 'gst_buffer_is_writable (buffer)' failed GStreamer-CRITICAL **: gst_buffer_resize_range: assertion 'gst_buffer_is_writable (buffer)' failed GStreamer-CRITICAL **: gst_buffer_resize_range: assertion 'gst_buffer_is_writable (buffer)' failed GStreamer-CRITICAL **: gst_buffer_resize_range: assertion 'gst_buffer_is_writable (buffer)' failed On further digging into the code found the aacprase is trying to resize the buffer without checking write permission. Issue is resolved by changing buffer permission using gst_buffer_make_writable Function. /* As a special case, we can remove the ADTS framing and output raw AAC. */ if (aacparse->header_type == DSPAAC_HEADER_ADTS && aacparse->output_header_type == DSPAAC_HEADER_NONE) { guint header_size; GstMapInfo map; frame->buffer = gst_buffer_make_writable( frame->buffer); ... ... } I used gst-plugins-master for testing..
Review of attachment 339363 [details] [review]: Please write a more clear commit message in the format: elementname: short one-line summary what is fixed [empty line] Long description about what is fixed, when it happened, and how it was fixed. https://bugzilla.gnome.org/... ::: gst/audioparsers/gstaacparse.c @@ +1453,3 @@ guint header_size; GstMapInfo map; + frame->buffer = gst_buffer_make_writable (frame->buffer); This should be stored in frame->out_buffer instead, and frame->buffer should be set to NULL
Created attachment 339919 [details] [review] assertion while converting ADTS stream to RAW Hi Sebastian, I have made correction as per your review comments. I have validated functionality for different conversions. It seems to be working. Regards, Vinod
commit f1726c7088c9022ac0eda6f5f25a248528969239 Author: Vinod Kesti <vinodkesti@yahoo.com> Date: Tue Nov 15 16:52:39 2016 +0530 aacparse: assertion while converting ADTS stream to RAW aacparse resizes input buffer while converting ADTS stream to RAW, During buffer resize buffer write permission is not checked. This throws gst_buffer_is_writable assertion and leads to AV sync issue some times. It is corrected by making buffer writeable using gst_buffer_make_writable https://bugzilla.gnome.org/show_bug.cgi?id=774129