[vlc-commits] udp: don't realloc in receiving, just set i_buffer

Ilkka Ollakka git at videolan.org
Tue Sep 30 20:40:44 CEST 2014


vlc | branch: master | Ilkka Ollakka <ileoo at videolan.org> | Sun Sep 28 10:54:23 2014 +0300| [7fff679f1494dbc7475a6010d45bd335f959c912] | committer: Ilkka Ollakka

udp: don't realloc in receiving, just set i_buffer

Similar than rtp input does, doing realloc from 64k->1.5k would
usually mean extra malloc+memcpy per packet.

Also don't pass buffer onward if we don't receive any useful stuff (-1)

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

 modules/access/udp.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/modules/access/udp.c b/modules/access/udp.c
index 3c18cb8..6917ee4 100644
--- a/modules/access/udp.c
+++ b/modules/access/udp.c
@@ -264,10 +264,10 @@ static void* ThreadRead( void *data )
             if( errno == EINTR )
                 break;
             continue;
+        } else {
+            pkt->i_buffer = len;
+            block_FifoPut( sys->fifo, pkt );
         }
-
-        pkt = block_Realloc( pkt, 0, len );
-        block_FifoPut( sys->fifo, pkt );
     }
 
     block_FifoWake( sys->fifo );



More information about the vlc-commits mailing list