From bd814ee8795a74ae0710d54c3d5e559401b171b3 Mon Sep 17 00:00:00 2001 From: arpi Date: Sat, 28 Dec 2002 13:45:04 +0000 Subject: [PATCH] ao_oss was not using the channel & format returned by the soundcard for ao_data.bps calcualtion - hence fscked up av sync if soundcard didn't support a number of channels or audio format. patch by Balatoni Denes git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@8604 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libao2/ao_oss.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/libao2/ao_oss.c b/libao2/ao_oss.c index 0fb65c1ca3..f2d5fac1a6 100644 --- a/libao2/ao_oss.c +++ b/libao2/ao_oss.c @@ -126,10 +126,6 @@ static int init(int rate,int channels,int format,int flags){ fcntl(audio_fd, F_SETFD, FD_CLOEXEC); #endif - ao_data.bps=channels; - if(format != AFMT_U8 && format != AFMT_S8) - ao_data.bps*=2; - if(format == AFMT_AC3) { ao_data.samplerate=rate; ioctl (audio_fd, SNDCTL_DSP_SPEED, &ao_data.samplerate); @@ -223,8 +219,12 @@ ac3_retry: #endif } + ao_data.bps=ao_data.channels; + if(ao_data.format != AFMT_U8 && ao_data.format != AFMT_S8) + ao_data.bps*=2; + ao_data.outburst-=ao_data.outburst % ao_data.bps; // round down - ao_data.bps*=rate; + ao_data.bps*=ao_data.samplerate; return 1; }