[vlc-commits] directsound: remove broken notification support

Ludovic Fauvet git at videolan.org
Thu Jul 25 12:05:46 CEST 2013


vlc/vlc-2.1 | branch: master | Ludovic Fauvet <etix at videolan.org> | Wed Jul 24 13:01:00 2013 +0200| [ff8e7cc44fc92dc7d3b5adea2ab3e489554d9491] | committer: Jean-Baptiste Kempf

directsound: remove broken notification support

The original code was non-working because the notication was never
setup correctly and resulted in a DSERR_INVALIDCALL. A proper fix
would look like:

         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 );
             }

But fixing it makes the problem worse since the notification is setup
too late and thus the buffer will replay a full loop of the back
buffer during a drain.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
(cherry picked from commit a80fee5d8db361f8feb817fd650a02a15ca04466)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.1.git/?a=commit;h=ff8e7cc44fc92dc7d3b5adea2ab3e489554d9491
---

 modules/audio_output/directx.c |   24 ++----------------------
 1 file changed, 2 insertions(+), 22 deletions(-)

diff --git a/modules/audio_output/directx.c b/modules/audio_output/directx.c
index 0ab2d40..79bbb90 100644
--- a/modules/audio_output/directx.c
+++ b/modules/audio_output/directx.c
@@ -875,30 +875,10 @@ static void Close(vlc_object_t *obj)
 
 static void Flush ( audio_output_t * aout, bool drain )
 {
-    aout_sys_t *sys = aout->sys;
-    size_t read;
-    if( drain )
-    {
-        if( sys->p_notify )
-        {
-            DSBPOSITIONNOTIFY notif = {.dwOffset = aout->sys->i_write, .hEventNotify = sys->hnotify_evt } ;
-            if( IDirectSoundNotify_SetNotificationPositions( sys->p_notify, 1, &notif ) ==  DS_OK )
-            {
-                WaitForSingleObject( sys->hnotify_evt, INFINITE );
-                IDirectSoundBuffer_Stop( aout->sys->p_dsbuffer );
-            }
-        }
-        else
-        {
-            IDirectSoundBuffer_Stop( aout->sys->p_dsbuffer );
-        }
-    }
-    else
-    {
-        IDirectSoundBuffer_Stop( aout->sys->p_dsbuffer );
+    IDirectSoundBuffer_Stop( aout->sys->p_dsbuffer );
+    if( !drain )
         IDirectSoundBuffer_SetCurrentPosition( aout->sys->p_dsbuffer,
                                                aout->sys->i_write );
-    }
 }
 
 static void Pause( audio_output_t * aout, bool pause, mtime_t date )



More information about the vlc-commits mailing list