asdfuser pushed a commit to branch master.

commit 3b70c0bc83552a26b89879aed42293de1e00b090
Author: Daniel Willmann <[email protected]>
Date:   Thu Apr 25 17:27:13 2013 +0100

    ecore_audio: Zero copy in pulse output
    
    Using pa_stream_write_begin we can just request a buffer to write into
    This reduces the amount of calloc()/free() and memcpy calls.
    
    Signed-off-by: Daniel Willmann <[email protected]>
---
 src/lib/ecore_audio/ecore_audio_obj_out_pulse.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/lib/ecore_audio/ecore_audio_obj_out_pulse.c 
b/src/lib/ecore_audio/ecore_audio_obj_out_pulse.c
index 4c43d39..bdb193d 100644
--- a/src/lib/ecore_audio/ecore_audio_obj_out_pulse.c
+++ b/src/lib/ecore_audio/ecore_audio_obj_out_pulse.c
@@ -78,16 +78,16 @@ static void _write_cb(pa_stream *stream, size_t len, void 
*data)
 
   void *buf;
   ssize_t bread;
+  size_t wlen = len;
 
-  buf = malloc(len);
+  pa_stream_begin_write(stream, &buf, &wlen);
 
-  eo_do(in, ecore_audio_obj_in_read(buf, len, &bread));
-  pa_stream_write(stream, buf, bread, free, 0, PA_SEEK_RELATIVE);
+  eo_do(in, ecore_audio_obj_in_read(buf, wlen, &bread));
+
+  pa_stream_write(stream, buf, bread, NULL, 0, PA_SEEK_RELATIVE);
   if (bread < (int)len)
     {
       pa_operation_unref(pa_stream_trigger(stream, NULL, NULL));
-      //in->ended = EINA_TRUE;
-      //pa_operation_unref(pa_stream_drain(stream, NULL, NULL));
     }
 }
 

-- 

------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr

Reply via email to