GNOME Bugzilla – Bug 610413
pulsesink: blocks in open() if audio device is in use
Last modified: 2018-11-03 14:41:06 UTC
When e.g. the flash plugin is hogging the audio device, trying to play a movie in totem or with gst-launch-0.10 playbin2 will just preroll and hang before starting to play, because pulseaudio seems to be blocking in the open() call or whatever, waiting for the plugin to release the device. Instead, pulsesink should post the appropriate RESOURCE BUSY error and get on with things (so that autoaudiosink can skip to the next audiosink and try that, like alsasink in this case). Totem just hanging at the first frame without any explanation at all is not very nice.
Still a problem: $ gst-launch-1.0 audiotestsrc ! alsasink device=hw:1 & $ gst-launch-1.0 audiotestsrc ! pulsesink (nothing happens after 'Setting pipeline to PLAYING ...') ... starts outputing audio as soon as you kill the first process..
It's blocking in the first call to _commit, waiting for a signal that never comes. Best way out seems to be a timer when committing, and error if we can't finish the commit within a second or other appropriate time span. I don't see a _timed_wait version in pulse though, so it'd have to be another thread doing timer handling and calling _signal, which is a bit ugly.
Not the first call, actually. A few calls happen, some audio is queued, but never flushed.
I've got something that works, and errors out after a timeout. However, I've ust realized that since this happens after commit (and thus, in PAUSED or PLAYING), this can't be used for autoplugging, since I think that requires failing on NULL->READY ?
Created attachment 330271 [details] [review] add a watchdog to detect hangs waiting for free space Here it is anyway.
-- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/issues/23.