summaryrefslogtreecommitdiffstats
path: root/libao2/ao_pulse.c
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2009-02-19 14:00:33 +0000
committerreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2009-02-19 14:00:33 +0000
commit0927ebeef7c4d3ff97ca9acf0763e8e01636b226 (patch)
tree88eabd7654097c0c2c1e90004cee9d21b4862731 /libao2/ao_pulse.c
parentd86e498088d9fb049d85b24be2fe1327b4cb4163 (diff)
downloadmpv-0927ebeef7c4d3ff97ca9acf0763e8e01636b226.tar.bz2
mpv-0927ebeef7c4d3ff97ca9acf0763e8e01636b226.tar.xz
Work around a PulseAudio bug that causes MPlayer to hang after unpausing.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28668 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libao2/ao_pulse.c')
-rw-r--r--libao2/ao_pulse.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/libao2/ao_pulse.c b/libao2/ao_pulse.c
index 827dab92db..d6974f85e0 100644
--- a/libao2/ao_pulse.c
+++ b/libao2/ao_pulse.c
@@ -52,6 +52,8 @@ static struct pa_threaded_mainloop *mainloop;
/** A temporary variable to store the current volume */
static pa_cvolume volume;
+static int broken_pause;
+
LIBAO_EXTERN(pulse)
#define GENERIC_ERR_MSG(ctx, str) \
@@ -138,6 +140,7 @@ static int init(int rate_hz, int channels, int format, int flags) {
char *devarg = NULL;
char *host = NULL;
char *sink = NULL;
+ char *version = pa_get_library_version();
if (ao_subdevice) {
devarg = strdup(ao_subdevice);
@@ -146,6 +149,17 @@ static int init(int rate_hz, int channels, int format, int flags) {
if (devarg[0]) host = devarg;
}
+ broken_pause = 0;
+ // not sure which versions are affected, assume 0.9.1*
+ // known bad: 0.9.14, 0.9.13
+ // known good: 0.9.9, 0.9.10
+ // to test: pause, wait ca. 5 seconds framestep and see if MPlayer hangs somewhen
+ if (strncmp(version, "0.9.1", 5) == 0 && strncmp(version, "0.9.10", 6) != 0) {
+ mp_msg(MSGT_AO, MSGL_WARN, "[pulse] working around probably broken pause functionality,\n"
+ " see http://www.pulseaudio.org/ticket/440\n");
+ broken_pause = 1;
+ }
+
ss.channels = channels;
ss.rate = rate_hz;
@@ -288,6 +302,10 @@ static void audio_pause(void) {
/** Resume the audio stream by uncorking it on the server */
static void audio_resume(void) {
+ // without this, certain versions will cause an infinite hang because
+ // pa_stream_writable_size returns 0 always.
+ // Note that this workaround causes A-V desync after pause
+ if (broken_pause) reset();
cork(0);
}