GNOME Bugzilla – Bug 612971
[alsasink] reset() doesn't unblock write()
Last modified: 2010-03-18 13:11:22 UTC
Version: 0.12.7 Overview: After I start rhythmbox and play any file (mp3, ogg, m4a, flac) the file will play for 0-2 seconds, then cease. If I press the next track button, or double-click another file, rhythmbox fades to gray and stays like that until I kill it. Steps to Reproduce: 1. Play any file. Build Date & Platform: Rhythmbox 0.12.7 on Ubuntu 9.10 Karmic x64 Additional Information: I had the same bug with Songbird 1.4.3 which has a workaround of passing the SB_GST_NO_SYSTEM environment variable to songbird at startup. (That has something to do with Songbird not playing well with gstreamer-ugly.) SB_GST_NO_SYSTEM=1 /usr/bin/songbird I am experiencing a very similar bug with Banshee. https://bugzilla.gnome.org/show_bug.cgi?id=612756 Distribution: Ubuntu 9.10 (karmic) Gnome Release: 2.28.1 2009-11-03 (Ubuntu) BugBuddy Version: 2.28.0
Created attachment 156210 [details] Rhythmbox stack trace
If you're seeing the same bug with three different GStreamer applications, it's pretty safe to assume it's a GStreamer bug.
here paste de trace (gdb) thread apply all bt
+ Trace 220972
Thread 1 (Thread 0x7ffff7fb77d0 (LWP 30253))
Looks like a problem in alsasink's _reset() function. It takes the alsa sink lock before doing anything but the same lock is also hold by the _write() function. _write() could in theory loop forever while holding the lock. It might be possible to release the lock after every iteration instead.
But that's only the hanging when switching to the next track it seems. Would be interesting to know why it stops at first. Could you run rhythmbox with GST_DEBUG=alsa*:5 , get it to hang again and attach the output here?
Created attachment 156279 [details] output of $ GST_DEBUG=alsa*:5 rhythmbox This generated a lot of output to the terminal. Thousands of lines per second. I think I caught the highlights. Playback is choppy, but now it usually doesn't quit after just a few seconds. I hope this helps, let me know if I can give you anything else.
Created attachment 156298 [details] [review] alsasink: Exit write loop if _reset() is called
(In reply to comment #7) > Created an attachment (id=156298) [details] [review] > alsasink: Exit write loop if _reset() is called This should fix the hanging after switching to the next track. Can you confirm this? The other, first problem, seems to be a bug in the pulseaudio alsa module or something. For some reason it reports that the resource is temporary unavailable after some time and then nothing works anymore.
I'd be happy to test this patch, but I'll need some help. I don't know where to begin.
You could download http://gstreamer.freedesktop.org/src/gst-plugins-base/gst-plugins-base-0.10.28.tar.gz , uncompress it ( tar xfz ), apply the patch in the newly created directory ( patch -Np1 < file ), call ./configure && make and copy the ext/alsa/.libs/libgstalsa.so file to /usr/lib/gstreamer-0.10 Which distribution are you using btw? If you're using Ubuntu karmic you should update your gstreamer packages from https://launchpad.net/~gstreamer-developers/+archive/ppa first.
I am using Karmic, so I added the gstreamer-developers ppa and updated. There was a new kernel in the update manager, so I restarted. After the restart, rhythmbox and banshee sound great and I can't reproduce the bug. When I run:$ GST_DEBUG=alsa*:5 rhythmbox I get a lot of this: 0:03:25.762074648 4978 0x7f390800b270 DEBUG alsa gstalsasink.c:886:gst_alsasink_write:<alsasink2> written 441 frames out of 441 0:03:25.762087755 4978 0x7f390800b270 LOG alsa gstalsasink.c:871:gst_alsasink_write:<alsasink2> received audio samples buffer of 1764 bytes 0:03:25.802165770 4978 0x7f390800b270 DEBUG alsa gstalsasink.c:886:gst_alsasink_write:<alsasink2> written -11 frames out of 441 0:03:25.802209360 4978 0x7f390800b270 DEBUG alsa gstalsasink.c:888:gst_alsasink_write:<alsasink2> Write error: Resource temporarily unavailable 0:03:25.812469680 4978 0x7f390800b270 DEBUG alsa gstalsasink.c:886:gst_alsasink_write:<alsasink2> written 441 frames out of 441 0:03:25.812494004 4978 0x7f390800b270 LOG alsa gstalsasink.c:871:gst_alsasink_write:<alsasink2> received audio samples buffer of 1764 bytes 0:03:25.812511579 4978 0x7f390800b270 DEBUG alsa gstalsasink.c:886:gst_alsasink_write:<alsasink2> written 441 frames out of 441 0:03:25.812524323 4978 0x7f390800b270 LOG alsa gstalsasink.c:871:gst_alsasink_write:<alsasink2> received audio samples buffer of 1764 bytes 0:03:25.812540254 4978 0x7f390800b270 DEBUG alsa gstalsasink.c:886:gst_alsasink_write:<alsasink2> written 441 frames out of 441 0:03:25.812552783 4978 0x7f390800b270 LOG alsa gstalsasink.c:871:gst_alsasink_write:<alsasink2> received audio samples buffer of 1764 bytes 0:03:25.812567905 4978 0x7f390800b270 DEBUG alsa gstalsasink.c:886:gst_alsasink_write:<alsasink2> written 441 frames out of 441 0:03:25.812580284 4978 0x7f390800b270 LOG alsa gstalsasink.c:871:gst_alsasink_write:<alsasink2> received audio samples buffer of 1764 bytes 0:03:25.812596745 4978 0x7f390800b270 DEBUG alsa gstalsasink.c:886:gst_alsasink_write:<alsasink2> written 441 frames out of 441 0:03:25.812609438 4978 0x7f390800b270 LOG alsa gstalsasink.c:871:gst_alsasink_write:<alsasink2> received audio samples buffer of 1764 bytes 0:03:25.852685186 4978 0x7f390800b270 DEBUG alsa gstalsasink.c:886:gst_alsasink_write:<alsasink2> written -11 frames out of 441 0:03:25.852726884 4978 0x7f390800b270 DEBUG alsa gstalsasink.c:888:gst_alsasink_write:<alsasink2> Write error: Resource temporarily unavailable 0:03:25.866386089 4978 0x7f390800b270 DEBUG alsa gstalsasink.c:886:gst_alsasink_write:<alsasink2> written 441 frames out of 441 Should I still go ahead and test that patch?
No, it's all fine then I guess. Please file a bug against the pulseaudio alsa module for the "Resource temporarily unavailable" errors though, that should really be fixed :)