From: Jiwon Kim Date: Fri, 24 Mar 2017 01:34:53 +0000 (+0900) Subject: ecore audio: Fix loss of last stream X-Git-Tag: upstream/1.20.0~1672 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=25fcdde3564824087fd23f0380c129f28bd08869;p=platform%2Fupstream%2Fefl.git ecore audio: Fix loss of last stream Summary: pa_stream's write callback requires to size of stream data using 'len' parameter. This size depend on pulse audio's internal status and not consistent. When a efl read audio's last stream, length of read('bread') is less than write callback's 'len' parameter. If the gap between 'len' and 'bread' is small, last stream is played fortunately. Otherwise, the last stream is discarded. (It is doubtful about pa_stream's pre-buffering.) To prevent it, push silent stream which is amount of deficient length. @fix T5281 Reviewers: raster Reviewed By: raster Subscribers: cedric, jpeg, woohyun Maniphest Tasks: T5281 Differential Revision: https://phab.enlightenment.org/D4726 --- 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 73f9c72..2916de4 100644 --- a/src/lib/ecore_audio/ecore_audio_obj_out_pulse.c +++ b/src/lib/ecore_audio/ecore_audio_obj_out_pulse.c @@ -82,11 +82,14 @@ static void _write_cb(pa_stream *stream, size_t len, void *data) bread = ecore_audio_obj_in_read(in, buf, wlen); - EPA_CALL(pa_stream_write)(stream, buf, bread, NULL, 0, PA_SEEK_RELATIVE); - if (bread < (int)len) + if ((bread < (int)len) && bread) { + memset((char *)buf + bread, 0, wlen - bread); + EPA_CALL(pa_stream_write)(stream, buf, wlen, NULL, 0, PA_SEEK_RELATIVE); EPA_CALL(pa_operation_unref)(EPA_CALL(pa_stream_trigger)(stream, NULL, NULL)); } + else + EPA_CALL(pa_stream_write)(stream, buf, bread, NULL, 0, PA_SEEK_RELATIVE); } static void _update_samplerate_cb(void *data EINA_UNUSED, const Efl_Event *event)