Open antlarr opened 7 years ago
Wow! That’s a pretty crazy problem. Perhaps what’s most maddening is that it only occurs inside of the pyacoustid setup. Has it really been impossible to reproduce while just invoking audioread directly?
GStreamer can be extraordinarily difficult to debug. Usually, however, the right place to start is by putting it into its verbose logging mode, which can be done via environment variables. Those (very long) logs can help pin down the difference between a run that works and one that doesn’t, which is the first step to diagnosing a race condition.
I have a flac file that causes acoustid to freeze when doing:
If I press Ctrl-C, I get the following backtrace:
Btw, the file plays perfectly fine with ffplay, mpv, mplayer... Also, I tried reading the audio blocks with simple audioread code like:
and that seems to work fine.
What makes me think that it's an audioread issue and not an acoustid issue is that in audioread's gstdec.py, if I put
return None
as the first line of get_loop_thread, it doesn't freeze (works normally).I've tried to debug a bit the problem and noticed that acoustid has a _fingerprint_file_audioread function defined as:
If I add
time.sleep(0.00000000000001)
at the end of thewith
block (just after the fingerprint call), sometimes it works as expected, and if I usetime.sleep(0.1)
instead, it seems to "fix it" and doesn't freeze anymore, so it seems to be some kind of race condition.After some more debugging I found out that the exact line where it's freezing is in the call to
self.pipeline.set_state(Gst.State.NULL)
insideGstAudioFile.close
but I'm not sure how to continue from there since I don't have much experience with gstreamer.I'm using audioread 2.1.5, gstreamer 1.12.3 and pyacoustid 1.1.5 with chromaprint 1.4.2 . I also tried with gstreamer 1.12.2 and audioread 2.1.4.
Btw, another solution I found was to do
ffmpeg -i 01.flac output.flac
. The resulting file is processed correctly and never freezes.