Commit a80fee5d authored by Ludovic Fauvet's avatar Ludovic Fauvet Committed by 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: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 1ab9abf3
......@@ -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 )
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment