From: Seungbae Shin Date: Mon, 17 May 2021 08:57:49 +0000 (+0900) Subject: tizenaudio-sink/source: write or read by calculated period size instead of fixed... X-Git-Tag: submit/tizen/20210611.074839^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1fe59e21c6c8f5aac919b7e08dba449ad4ffb503;p=platform%2Fcore%2Fmultimedia%2Fpulseaudio-modules-tizen.git tizenaudio-sink/source: write or read by calculated period size instead of fixed time. As this code is workaround code for supporting various hw model such as qualcomm board, will be refactored soon by using parameters given at loading time. In addition, use _hal_sysconfdir instead of _sysconfdir macro in spec [Version] 13.0.65 [Issue Type] Bring-up Change-Id: I96fef562cd7af2a67d3bed90b5db9f4def3edad4 --- diff --git a/packaging/pulseaudio-modules-tizen.spec b/packaging/pulseaudio-modules-tizen.spec index d72bf2c..067da12 100644 --- a/packaging/pulseaudio-modules-tizen.spec +++ b/packaging/pulseaudio-modules-tizen.spec @@ -1,6 +1,6 @@ Name: pulseaudio-modules-tizen Summary: Pulseaudio modules for Tizen -Version: 13.0.64 +Version: 13.0.65 Release: 0 Group: Multimedia/Audio License: LGPL-2.1+ @@ -40,7 +40,10 @@ PulseAudio module-acm-sink for sending PCM data to ACM core. %setup -q %build -export CFLAGS="%{optflags} -fno-strict-aliasing -D__TIZEN__ -DSYSCONFDIR=\\\"%{_sysconfdir}\\\" " +export CFLAGS="%{optflags} -fno-strict-aliasing -D__TIZEN__ -DSYSCONFDIR=\\\"%{_hal_sysconfdir}\\\" " +%if "%{tizen_profile_name}" != "tv" + export CFLAGS+=" -DTIZEN_TV"; +%endif export LD_AS_NEEDED=0 %reconfigure --prefix=%{_prefix} \ diff --git a/src/module-tizenaudio-sink.c b/src/module-tizenaudio-sink.c index c8f1d35..62a12d5 100644 --- a/src/module-tizenaudio-sink.c +++ b/src/module-tizenaudio-sink.c @@ -419,11 +419,19 @@ static int process_render(struct userdata *u, pa_usec_t now) { if (u->first) { pa_log_debug("Fill initial buffer"); +#ifdef TIZEN_TV frames_to_write = pa_usec_to_bytes(u->block_usec, &u->sink->sample_spec) / frame_size; +#else + frames_to_write = u->frag_size / frame_size; +#endif u->timestamp = u->timestamp_written = now; } else { +#ifdef TIZEN_TV /* Write pcm every 10ms */ frames_to_write = pa_usec_to_bytes((10 * PA_USEC_PER_MSEC), &u->sink->sample_spec) / frame_size; +#else + frames_to_write = (u->frag_size / u->nfrags); +#endif if (frames_to_write > avail) break; } @@ -480,14 +488,22 @@ static void thread_func(void *userdata) { goto fail; if (work_done == 0) { +#ifdef TIZEN_TV pa_rtpoll_set_timer_relative(u->rtpoll, (10 * PA_USEC_PER_MSEC)); +#else + pa_rtpoll_set_timer_relative(u->rtpoll, (20 * PA_USEC_PER_MSEC)); +#endif } else { if (u->first) { pa_log_info("Starting playback."); pa_hal_interface_pcm_start(u->hal_interface, u->pcm_handle); u->first = false; } +#ifdef TIZEN_TV pa_rtpoll_set_timer_relative(u->rtpoll, (10 * PA_USEC_PER_MSEC)); +#else + pa_rtpoll_set_timer_relative(u->rtpoll, (20 * PA_USEC_PER_MSEC)); +#endif } } else { pa_rtpoll_set_timer_disabled(u->rtpoll); diff --git a/src/module-tizenaudio-source.c b/src/module-tizenaudio-source.c index 4ec1330..4beabf5 100644 --- a/src/module-tizenaudio-source.c +++ b/src/module-tizenaudio-source.c @@ -365,9 +365,13 @@ static int process_render(struct userdata *u, pa_usec_t now) { break; } +#ifdef TIZEN_TV frames_to_read = pa_usec_to_bytes(u->block_usec, &u->source->sample_spec) / frame_size; - chunk.length = pa_usec_to_bytes(u->block_usec, &u->source->sample_spec); +#else + frames_to_read = (u->frag_size / u->nfrags); + chunk.length = frames_to_read * frame_size; +#endif chunk.memblock = pa_memblock_new(u->core->mempool, chunk.length); if (frames_to_read > (size_t)avail) @@ -431,7 +435,11 @@ static void thread_func(void *userdata) { goto fail; if (work_done == 0) { +#ifdef TIZEN_TV pa_rtpoll_set_timer_relative(u->rtpoll, (10 * PA_USEC_PER_MSEC)); +#else + pa_rtpoll_set_timer_relative(u->rtpoll, (20 * PA_USEC_PER_MSEC)); +#endif } else { pa_rtpoll_set_timer_absolute(u->rtpoll, u->timestamp); }