[vlc-commits] libmpgatofixed32: return ENOMEM instead -1 and VLC_SUCCESS instead of 0, also set pf_audio_filter after everything is ready

Ilkka Ollakka git at videolan.org
Mon Apr 15 15:50:00 CEST 2013


vlc | branch: master | Ilkka Ollakka <ileoo at videolan.org> | Wed Mar 20 11:28:09 2013 +0200| [22217a34cd6e848cb86ef91df92e85f794ca05b3] | committer: Ilkka Ollakka

libmpgatofixed32: return ENOMEM instead -1 and VLC_SUCCESS instead of 0, also set pf_audio_filter after everything is ready

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

 modules/audio_filter/converter/mpgatofixed32.c |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/modules/audio_filter/converter/mpgatofixed32.c b/modules/audio_filter/converter/mpgatofixed32.c
index 6e6bece..70a4a6a 100644
--- a/modules/audio_filter/converter/mpgatofixed32.c
+++ b/modules/audio_filter/converter/mpgatofixed32.c
@@ -167,10 +167,9 @@ static int OpenFilter( vlc_object_t *p_this )
     /* Allocate the memory needed to store the module's structure */
     p_sys = p_filter->p_sys = malloc( sizeof(filter_sys_t) );
     if( p_sys == NULL )
-        return -1;
+        return VLC_ENOMEM;
     p_sys->i_reject_count = 0;
 
-    p_filter->pf_audio_filter = Convert;
 
     /* Initialize libmad */
     mad_stream_init( &p_sys->mad_stream );
@@ -183,7 +182,9 @@ static int OpenFilter( vlc_object_t *p_this )
              (char *)&p_filter->fmt_out.audio.i_format,
              p_filter->fmt_out.audio.i_bitspersample );
 
-    return 0;
+    p_filter->pf_audio_filter = Convert;
+
+    return VLC_SUCCESS;
 }
 
 /*****************************************************************************
@@ -214,7 +215,7 @@ static block_t *Convert( filter_t *p_filter, block_t *p_block )
         p_filter->fmt_out.audio.i_channels / 8;
 
     block_t *p_out = block_Alloc( i_out_size );
-    if( !p_out )
+    if( unlikely( !p_out ) )
     {
         msg_Warn( p_filter, "can't get output buffer" );
         block_Release( p_block );



More information about the vlc-commits mailing list