From 7be3e8694b2a4d2ab0b9c9af38100734ca14f149 Mon Sep 17 00:00:00 2001 From: reimar Date: Thu, 19 Jul 2007 19:15:59 +0000 Subject: [PATCH] Somewhat hackish fix for A-V desync with ao_oss and frame stepping: send 0-samples according to the amount of data lost during pause. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@23829 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libao2/ao_oss.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libao2/ao_oss.c b/libao2/ao_oss.c index 35fcfd6e6c..b9939de8b7 100644 --- a/libao2/ao_oss.c +++ b/libao2/ao_oss.c @@ -147,6 +147,7 @@ static int oss2format(int format) 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 @@ static void reset(void){ // 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); + } }