[xiph-commits] r3155 - liboggplay/trunk/plugin/audio

laser13 at svn.annodex.net laser13 at svn.annodex.net
Tue Jul 3 00:16:38 PDT 2007


Author: laser13
Date: 2007-07-03 00:16:37 -0700 (Tue, 03 Jul 2007)
New Revision: 3155

Modified:
   liboggplay/trunk/plugin/audio/sydney_audio_waveapi.c
Log:
Fixed audio shutdown problem on Win32. Audio device in paused state has to be reset before all blocks are released.

Modified: liboggplay/trunk/plugin/audio/sydney_audio_waveapi.c
===================================================================
--- liboggplay/trunk/plugin/audio/sydney_audio_waveapi.c	2007-07-02 22:53:38 UTC (rev 3154)
+++ liboggplay/trunk/plugin/audio/sydney_audio_waveapi.c	2007-07-03 07:16:37 UTC (rev 3155)
@@ -416,32 +416,34 @@
  */
 int closeAudio(sa_stream_t * s) {
   int status, i;
+  
+  // reseting audio device and flushing buffers
+  status = waveOutReset(s->hWaveOut);    
+  HANDLE_WAVE_ERROR(status, "resetting audio device");
 
   /* FIX ME: should the loop below have a timeout option? */
-   
   /* wait for all blocks to complete */
+  printf("[audio] waiting fot all audio block to be freed\n");
   while(s->waveFreeBlockCount < BLOCK_COUNT)
 	  Sleep(10);
 
   /* unprepare any blocks that are still prepared */
+  printf("[audio] unpreparing audio blocks\n");
   for(i = 0; i < s->waveFreeBlockCount; i++) {
     if(s->waveBlocks[i].dwFlags & WHDR_PREPARED) {
 	    status = waveOutUnprepareHeader(s->hWaveOut, &(s->waveBlocks[i]), sizeof(WAVEHDR));
       HANDLE_WAVE_ERROR(status, "closing audio device");
     }
-  }  
+  }    
 
-  // reseting audio device and flushing buffers
-  // status = waveOutReset(s->hWaveOut);    
-  // HANDLE_WAVE_ERROR(status, "resetting audio device");
-
-  freeBlocks(s->waveBlocks);
+  freeBlocks(s->waveBlocks);  
   status = waveOutClose(s->hWaveOut);    
   HANDLE_WAVE_ERROR(status, "closing audio device");
 
   DeleteCriticalSection(&(s->waveCriticalSection));
   CloseHandle(s->callbackEvent);
-
+  printf("[audio] callback destroyed\n");
+  
   return SA_SUCCESS;
 }
 /**



More information about the commits mailing list