[MPlayer-dev-eng] [RFC] hack around desync on OSS pause
Reimar Döffinger
Reimar.Doeffinger at stud.uni-karlsruhe.de
Sat Apr 28 23:39:12 CEST 2007
Hello,
what do you think about attached patch? It fixes the massive desync that
happens esp. when doing lots of frame stepping with -ao oss.
It is a bit hackish though, and in difference to alsa it will still loose some
sound during pause and not play any sound while framestepping.
Greetings,
Reimar Döffinger
-------------- next part --------------
Index: libao2/ao_oss.c
===================================================================
--- libao2/ao_oss.c (revision 23155)
+++ libao2/ao_oss.c (working copy)
@@ -147,6 +147,7 @@
static char *dsp=PATH_DEV_DSP;
static audio_buf_info zz;
static int audio_fd=-1;
+static int prepause_space;
static const char *oss_mixer_device = PATH_DEV_MIXER;
static int oss_mixer_channel = SOUND_MIXER_PCM;
@@ -448,13 +449,21 @@
// stop playing, keep buffers (for pause)
static void audio_pause(void)
{
+ prepause_space = get_space();
uninit(1);
}
// resume playing, after audio_pause()
static void audio_resume(void)
{
+ int fillcnt;
reset();
+ fillcnt = get_space() - prepause_space;
+ if (fillcnt > 0) {
+ void *silence = calloc(fillcnt, 1);
+ play(silence, fillcnt, 0);
+ free(silence);
+ }
}
More information about the MPlayer-dev-eng
mailing list