summaryrefslogtreecommitdiffstats
path: root/libao2/ao_oss.c
diff options
context:
space:
mode:
authorarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-12-28 13:45:04 +0000
committerarpi <arpi@b3059339-0415-0410-9bf9-f77b7e298cf2>2002-12-28 13:45:04 +0000
commitbd814ee8795a74ae0710d54c3d5e559401b171b3 (patch)
treeb8ff12b35813c6fdf911d06a50a567045abc890b /libao2/ao_oss.c
parentd3b9403406dfed411b5ac2f5c0675aa9d660c2fa (diff)
downloadmpv-bd814ee8795a74ae0710d54c3d5e559401b171b3.tar.bz2
mpv-bd814ee8795a74ae0710d54c3d5e559401b171b3.tar.xz
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 <pnis@coder.hu> git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@8604 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libao2/ao_oss.c')
-rw-r--r--libao2/ao_oss.c10
1 files 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;
}