changeset 28654:aa7af4c30429

Move resetting audio_info_t samples, eof and error in ao_sun.c to reset(), avoids duplication code from init() and fixes hangs after seeking.
author reimar
date Sat, 21 Feb 2009 13:37:47 +0000
parents 9d1869f780c0
children 9fcf23aaf13c
files libao2/ao_sun.c
diffstat 1 files changed, 9 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/libao2/ao_sun.c	Sat Feb 21 11:44:10 2009 +0000
+++ b/libao2/ao_sun.c	Sat Feb 21 13:37:47 2009 +0000
@@ -584,14 +584,7 @@
     ao_data.bps = byte_per_sec = bytes_per_sample * ao_data.samplerate;
     ao_data.outburst = byte_per_sec > 100000 ? 16384 : 8192;
 
-    AUDIO_INITINFO(&info);
-    info.play.samples = 0;
-    info.play.eof = 0;
-    info.play.error = 0;
-    ioctl (audio_fd, AUDIO_SETINFO, &info);
-
-    queued_bursts = 0;
-    queued_samples = 0;
+    reset();
 
     return 1;
 }
@@ -608,7 +601,15 @@
 
 // stop playing and empty buffers (for seeking/pause)
 static void reset(void){
+    audio_info_t info;
     flush_audio(audio_fd);
+
+    AUDIO_INITINFO(&info);
+    info.play.samples = 0;
+    info.play.eof = 0;
+    info.play.error = 0;
+    ioctl(audio_fd, AUDIO_SETINFO, &info);
+
     queued_bursts = 0;
     queued_samples = 0;
 }