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 656641 - Segfault using ofa element
Segfault using ofa element
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
0.10.22
Other Linux
: Normal major
: 0.10.23
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2011-08-16 10:52 UTC by Christoph Reiter (lazka)
Modified: 2011-08-18 09:12 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
stacktrace (40.81 KB, text/plain)
2011-08-16 10:52 UTC, Christoph Reiter (lazka)
  Details
ofa: warn when no data, instead of trying to use it (1.46 KB, patch)
2011-08-16 17:42 UTC, Vincent Penquerc'h
committed Details | Review
gst-python testcase (827 bytes, text/plain)
2011-08-16 23:11 UTC, Christoph Reiter (lazka)
  Details
silent mp3 (18.47 KB, application/x-gzip)
2011-08-16 23:31 UTC, Christoph Reiter (lazka)
  Details
ofa: cleanup (2.67 KB, patch)
2011-08-17 10:23 UTC, Vincent Penquerc'h
committed Details | Review
ofa: fingerprint creation can fail (1.88 KB, patch)
2011-08-17 10:23 UTC, Vincent Penquerc'h
committed Details | Review
ofa: do not create fingerprint on EOS if record is FALSE (855 bytes, patch)
2011-08-17 10:24 UTC, Vincent Penquerc'h
committed Details | Review

Description Christoph Reiter (lazka) 2011-08-16 10:52:46 UTC
Created attachment 193928 [details]
stacktrace

Pipeline:

playbin -> bin[ tee ->
  -> queue -> ofa -> fakesink
  -> queue -> chromaprint -> fakesink]

Right before the segfault I get:

CRITICAL **: gst_adapter_take_buffer: assertion `nbytes > 0' failed

I can reproduce it somewhat (it sometimes takes a few hundred files) 

Failing line: http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/tree/ext/ofa/gstofa.c#n128

stack trace attached
Comment 1 Christoph Reiter (lazka) 2011-08-16 11:18:55 UTC
Found a file that constantly triggers it for me:

http://hotfile.com/dl/126964934/1804ef5/test_song_656641.mp3.html
Comment 2 Vincent Penquerc'h 2011-08-16 17:42:47 UTC
Worked for me with this file a dozen times or so.
However, the bug is evident, and I could get it with:
gst-launch audiotestsrc num-buffers=0 ! ofa ! fakesink


Though just why no data flowed through in your case is another problem. You may want to enable logs (GST_DEBUG=3 to start with) to see if the pipeline fails to start properly.

In any case, the crash on no data is fixed by...
Comment 3 Vincent Penquerc'h 2011-08-16 17:42:56 UTC
Created attachment 193981 [details] [review]
ofa: warn when no data, instead of trying to use it

Fixes a crash when no data flowed through.
Comment 4 Christoph Reiter (lazka) 2011-08-16 18:26:03 UTC
Thanks for the quick response. You're right, I can't reproduce it with gst-launch either.

I've checked some more files that fail and it seems they all have long silence (for ofa to trigger > 135 sec) at the beginning aka 'hidden' tracks.

I'll try to come up with a minimal python example.
Comment 5 Tim-Philipp Müller 2011-08-16 19:23:27 UTC
Comment on attachment 193981 [details] [review]
ofa: warn when no data, instead of trying to use it

Pushed with a minor change (to avoid gst-indent ping-pong on the endianness line):

commit 5a0a0aac192e732e248d6b15343643d01a297817
Author: Vincent Penquerc'h <vincent.penquerch@collabora.co.uk>
Date:   Tue Aug 16 18:34:59 2011 +0100

    ofa: don't crash when there's no data to create a fingerprint from
    
    Fixes a crash when no data flowed through.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=656641
Comment 6 Christoph Reiter (lazka) 2011-08-16 23:11:30 UTC
Created attachment 193996 [details]
gst-python testcase
Comment 7 Christoph Reiter (lazka) 2011-08-16 23:28:48 UTC
Vincent's patch fixes it for me (see previous attached test case)

But, I would still like to know what triggered it in the case of using an actual file. With my limited knowledge I can't see how the adapter could be empty in such a case.

If it's really a silence problem, I'm going to use cutter to stop the pipeline before a segfault kicks in.
Comment 8 Christoph Reiter (lazka) 2011-08-16 23:31:08 UTC
Created attachment 193998 [details]
silent mp3

A small silent mp3 file which also triggers the error.
Comment 9 Vincent Penquerc'h 2011-08-17 10:23:49 UTC
Created attachment 194019 [details] [review]
ofa: cleanup

Avoid repeating casting to GstAudioFilter when one will do
Use object related logging to make it easier to get just the logs we want
Comment 10 Vincent Penquerc'h 2011-08-17 10:23:56 UTC
Created attachment 194020 [details] [review]
ofa: fingerprint creation can fail

There does not seem to be a way to retrieve information
about why failure occured, unfortunately.
When failure occurs, do not post a NULL fingerprint tag.
Comment 11 Vincent Penquerc'h 2011-08-17 10:24:08 UTC
Created attachment 194021 [details] [review]
ofa: do not create fingerprint on EOS if record is FALSE
Comment 12 Vincent Penquerc'h 2011-08-17 10:29:13 UTC
It seems libofa can fail to create a fingerprint, unfortunately, so I've added code to cater for this.
There's no way to know why it failed, but adding traces to libofa (which needed help to even build here), the failure on the file you sent was an exception (it's c++ code inside) with message "Signal has silence only".
It appears to skip silence first, then fingerprint the remainder.
Comment 13 Christoph Reiter (lazka) 2011-08-17 18:45:15 UTC
Ah, so it failed, did nothing until EOS and then tried again with the now empty buffer.

Thanks for investigating.
Comment 14 Sebastian Dröge (slomo) 2011-08-18 09:12:48 UTC
commit 57ae8c4bf5bd8653f87f62b81a6531f812ee24a6
Author: Vincent Penquerc'h <vincent.penquerch@collabora.co.uk>
Date:   Wed Aug 17 11:02:12 2011 +0100

    ofa: fingerprint creation can fail
    
    There does not seem to be a way to retrieve information
    about why failure occured, unfortunately.
    When failure occurs, do not post a NULL fingerprint tag.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=656641

commit 6ef56f56d7aab9ba006ad7a37e9bc8ea19939568
Author: Vincent Penquerc'h <vincent.penquerch@collabora.co.uk>
Date:   Wed Aug 17 10:55:59 2011 +0100

    ofa: cleanup
    
    Avoid repeating casting to GstAudioFilter when one will do
    Use object related logging to make it easier to get just the logs we want
    
    https://bugzilla.gnome.org/show_bug.cgi?id=656641

commit 683fbaa81ac900c3e87bbd2b4745a341f9c7b07f
Author: Vincent Penquerc'h <vincent.penquerch@collabora.co.uk>
Date:   Wed Aug 17 11:07:54 2011 +0100

    ofa: do not create fingerprint on EOS if record is FALSE
    
    https://bugzilla.gnome.org/show_bug.cgi?id=656641