[vlc-devel] [PATCH 1/4] directsound: fix position notification

Ludovic Fauvet etix at videolan.org
Sat Jul 20 01:50:49 CEST 2013


Setting up a notification requires the playback to be stopped first or else
SetNotificationPositions will fail with DSERR_INVALIDCALL.
---
 modules/audio_output/directx.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/modules/audio_output/directx.c b/modules/audio_output/directx.c
index 32cdf84..6a39785 100644
--- a/modules/audio_output/directx.c
+++ b/modules/audio_output/directx.c
@@ -880,9 +880,11 @@ static void Flush ( audio_output_t * aout, bool drain )
     {
         if( sys->p_notify )
         {
+            IDirectSoundBuffer_Stop( aout->sys->p_dsbuffer );
             DSBPOSITIONNOTIFY notif = {.dwOffset = aout->sys->i_write, .hEventNotify = sys->hnotify_evt } ;
             if( IDirectSoundNotify_SetNotificationPositions( sys->p_notify, 1, &notif ) ==  DS_OK )
             {
+                IDirectSoundBuffer_Play( aout->sys->p_dsbuffer, 0, 0, DSBPLAY_LOOPING );
                 WaitForSingleObject( sys->hnotify_evt, INFINITE );
                 IDirectSoundBuffer_Stop( aout->sys->p_dsbuffer );
             }
-- 
1.8.3.3




More information about the vlc-devel mailing list