[vlc-devel] commit: Remove "out of memory" message (Jean-Paul Saman )

git version control git at videolan.org
Sat May 17 19:41:02 CEST 2008


vlc | branch: master | Jean-Paul Saman <jpsaman at videolan.org> | Sat May 17 11:34:59 2008 +0200| [453ff82acfa8ec4fb717fe71b094199d8659a1f5]

Remove "out of memory" message

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

 modules/packetizer/h264.c |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/modules/packetizer/h264.c b/modules/packetizer/h264.c
index cc233ce..727fce0 100644
--- a/modules/packetizer/h264.c
+++ b/modules/packetizer/h264.c
@@ -174,8 +174,7 @@ static int Open( vlc_object_t *p_this )
     /* Allocate the memory needed to store the decoder's structure */
     if( ( p_dec->p_sys = p_sys = malloc( sizeof(decoder_sys_t) ) ) == NULL )
     {
-        msg_Err( p_dec, "out of memory" );
-        return VLC_EGENERIC;
+        return VLC_ENOMEM;
     }
     p_sys->i_state = STATE_NOSYNC;
     p_sys->i_offset = 0;
@@ -260,16 +259,19 @@ static int Open( vlc_object_t *p_this )
                  p_sys->i_avcC_length_size, i_sps, i_pps );
 
         /* FIXME: FFMPEG isn't happy at all if you leave this */
-        if( p_dec->fmt_out.i_extra ) free( p_dec->fmt_out.p_extra );
-        p_dec->fmt_out.i_extra = 0; p_dec->fmt_out.p_extra = NULL;
+        if( p_dec->fmt_out.i_extra > 0 ) free( p_dec->fmt_out.p_extra );
+        p_dec->fmt_out.i_extra = 0;
+        p_dec->fmt_out.p_extra = NULL;
 
         /* Set the new extradata */
         p_dec->fmt_out.i_extra = p_sys->p_pps->i_buffer + p_sys->p_sps->i_buffer;
-        p_dec->fmt_out.p_extra = (uint8_t*)malloc( p_dec->fmt_out.i_extra );
+        p_dec->fmt_out.p_extra = malloc( p_dec->fmt_out.i_extra );
         if( p_dec->fmt_out.p_extra )
         {
-            memcpy( (uint8_t*)p_dec->fmt_out.p_extra, p_sys->p_sps->p_buffer, p_sys->p_sps->i_buffer);
-            memcpy( (uint8_t*)p_dec->fmt_out.p_extra+p_sys->p_sps->i_buffer, p_sys->p_pps->p_buffer, p_sys->p_pps->i_buffer);
+            memcpy( (uint8_t*)p_dec->fmt_out.p_extra,
+                    p_sys->p_sps->p_buffer, p_sys->p_sps->i_buffer);
+            memcpy( (uint8_t*)p_dec->fmt_out.p_extra+p_sys->p_sps->i_buffer,
+                    p_sys->p_pps->p_buffer, p_sys->p_pps->i_buffer);
             p_sys->b_header = true;
         }
         else p_dec->fmt_out.i_extra = 0;




More information about the vlc-devel mailing list