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 774129 - 'gst_buffer_is_writable' assertion in aacparse
'gst_buffer_is_writable' assertion in aacparse
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
1.10.0
Other All
: Normal major
: 1.11.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-11-09 07:01 UTC by Vinod Kesti
Modified: 2016-11-15 13:10 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch to resolve 'gst_buffer_is_writable' assertion in aacparse (924 bytes, patch)
2016-11-09 07:01 UTC, Vinod Kesti
needs-work Details | Review
assertion while converting ADTS stream to RAW (1.61 KB, patch)
2016-11-15 11:32 UTC, Vinod Kesti
committed Details | Review

Description Vinod Kesti 2016-11-09 07:01:58 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..
Comment 1 Sebastian Dröge (slomo) 2016-11-09 07:31:50 UTC
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
Comment 2 Vinod Kesti 2016-11-15 11:32:54 UTC
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
Comment 3 Sebastian Dröge (slomo) 2016-11-15 13:10:29 UTC
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