]> git.sesse.net Git - vlc/blobdiff - modules/audio_output/hd1000a.cpp
threads: Make sure we don't re-create a thread if the object has already one.
[vlc] / modules / audio_output / hd1000a.cpp
index 5e81ae742647d365cacc65f891306f60320cbd4a..57c5bc2a1f0e27e2acb4583e89bea10330e2f439 100644 (file)
@@ -97,18 +97,14 @@ static int Open( vlc_object_t * p_this )
     p_aout->output.p_sys = p_sys =
         (aout_sys_t *)malloc( sizeof( aout_sys_t ) );
     if( p_aout->output.p_sys == NULL )
-    {
-        msg_Err( p_aout, "out of memory" );
-        return VLC_EGENERIC;
-    }
+        return VLC_ENOMEM;
 
     /* New PCMAudioPlayer */
     p_sys->pPlayer = pPlayer = new PCMAudioPlayer();
     if( p_sys->pPlayer == NULL )
     {
-        msg_Err( p_aout, "out of memory" );
         free( p_sys );
-        return VLC_EGENERIC;
+        return VLC_ENOMEM;
     }
 
     /* Get Buffer Requirements */
@@ -127,10 +123,9 @@ static int Open( vlc_object_t * p_this )
     p_sys->ppBuffers = (void **)malloc( p_sys->nBuffers * sizeof( void * ) );
     if( p_sys->ppBuffers == NULL )
     {
-        msg_Err( p_aout, "out of memory" );
         delete pPlayer;
         free( p_sys );
-        return VLC_EGENERIC;
+        return VLC_ENOMEM;
     }
 
     /* Open PCMAudioPlayer */
@@ -227,7 +222,7 @@ static int Thread( aout_instance_t * p_aout )
     struct aout_sys_t * p_sys = p_aout->output.p_sys;
     PCMAudioPlayer * pPlayer = p_sys->pPlayer;
 
-    while( !p_aout->b_die )
+    while( vlc_object_alive (p_aout) )
     {
         pPlayer->WaitForBuffer();