changeset 8603:30bef3c97b8b

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>
author arpi
date Sat, 28 Dec 2002 13:45:04 +0000
parents 36d5c7137876
children 41a1e5dbb552
files libao2/ao_oss.c
diffstat 1 files changed, 5 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/libao2/ao_oss.c	Sat Dec 28 13:42:24 2002 +0000
+++ b/libao2/ao_oss.c	Sat Dec 28 13:45:04 2002 +0000
@@ -126,10 +126,6 @@
   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 @@
 #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;
 }