summaryrefslogtreecommitdiffstats
path: root/libao2
diff options
context:
space:
mode:
authorUoti Urpala <uau@glyph.nonexistent.invalid>2009-02-21 17:39:30 +0200
committerUoti Urpala <uau@glyph.nonexistent.invalid>2009-02-21 17:39:30 +0200
commitebb541c6553af10203b2c2f5bcead6118a44f5be (patch)
tree3d98d89722d6784891b5da91555f22f76cdc92cf /libao2
parente46317a1db077a7f92ea5db7bb76e6cc899f1a64 (diff)
parenta9abd00be4bfb498e1ba4e0ebc02c828a1a3db07 (diff)
downloadmpv-ebb541c6553af10203b2c2f5bcead6118a44f5be.tar.bz2
mpv-ebb541c6553af10203b2c2f5bcead6118a44f5be.tar.xz
Merge svn changes up to r28690
Diffstat (limited to 'libao2')
-rw-r--r--libao2/ao_pulse.c18
-rw-r--r--libao2/ao_sun.c17
2 files changed, 27 insertions, 8 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);
}
diff --git a/libao2/ao_sun.c b/libao2/ao_sun.c
index ebe17c7926..cae2287f6c 100644
--- a/libao2/ao_sun.c
+++ b/libao2/ao_sun.c
@@ -584,14 +584,7 @@ static int init(int rate,int channels,int format,int flags){
ao_data.bps = byte_per_sec = bytes_per_sample * ao_data.samplerate;
ao_data.outburst = byte_per_sec > 100000 ? 16384 : 8192;
- AUDIO_INITINFO(&info);
- info.play.samples = 0;
- info.play.eof = 0;
- info.play.error = 0;
- ioctl (audio_fd, AUDIO_SETINFO, &info);
-
- queued_bursts = 0;
- queued_samples = 0;
+ reset();
return 1;
}
@@ -608,7 +601,15 @@ static void uninit(int immed){
// stop playing and empty buffers (for seeking/pause)
static void reset(void){
+ audio_info_t info;
flush_audio(audio_fd);
+
+ AUDIO_INITINFO(&info);
+ info.play.samples = 0;
+ info.play.eof = 0;
+ info.play.error = 0;
+ ioctl(audio_fd, AUDIO_SETINFO, &info);
+
queued_bursts = 0;
queued_samples = 0;
}