summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJiwon Kim <jwkim0000@gmail.com>2017-03-24 10:34:53 +0900
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2017-03-24 10:34:54 +0900
commit25fcdde3564824087fd23f0380c129f28bd08869 (patch)
tree48e3df5556082d4f2ab11d319bf5aa8b2b3b45c8 /src
parent35a7e7ff1810a29820c9f05fbbd4cb63fb964f16 (diff)
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
Diffstat (limited to 'src')
-rw-r--r--src/lib/ecore_audio/ecore_audio_obj_out_pulse.c7
1 files changed, 5 insertions, 2 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 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)
82 82
83 bread = ecore_audio_obj_in_read(in, buf, wlen); 83 bread = ecore_audio_obj_in_read(in, buf, wlen);
84 84
85 EPA_CALL(pa_stream_write)(stream, buf, bread, NULL, 0, PA_SEEK_RELATIVE); 85 if ((bread < (int)len) && bread)
86 if (bread < (int)len)
87 { 86 {
87 memset((char *)buf + bread, 0, wlen - bread);
88 EPA_CALL(pa_stream_write)(stream, buf, wlen, NULL, 0, PA_SEEK_RELATIVE);
88 EPA_CALL(pa_operation_unref)(EPA_CALL(pa_stream_trigger)(stream, NULL, NULL)); 89 EPA_CALL(pa_operation_unref)(EPA_CALL(pa_stream_trigger)(stream, NULL, NULL));
89 } 90 }
91 else
92 EPA_CALL(pa_stream_write)(stream, buf, bread, NULL, 0, PA_SEEK_RELATIVE);
90} 93}
91 94
92static void _update_samplerate_cb(void *data EINA_UNUSED, const Efl_Event *event) 95static void _update_samplerate_cb(void *data EINA_UNUSED, const Efl_Event *event)