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 <d.willmann@samsung.com>
This commit is contained in:
parent
911790b236
commit
3b70c0bc83
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue