tizenaudio-sink/source: write or read by calculated period size instead of fixed... 10/259410/6 accepted/tizen/unified/20210614.061633 submit/tizen/20210611.074839
authorSeungbae Shin <seungbae.shin@samsung.com>
Mon, 17 May 2021 08:57:49 +0000 (17:57 +0900)
committerSeungbae Shin <seungbae.shin@samsung.com>
Fri, 11 Jun 2021 04:08:56 +0000 (13:08 +0900)
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

packaging/pulseaudio-modules-tizen.spec
src/module-tizenaudio-sink.c
src/module-tizenaudio-source.c

index d72bf2c..067da12 100644 (file)
@@ -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} \
index c8f1d35..62a12d5 100644 (file)
@@ -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);
index 4ec1330..4beabf5 100644 (file)
@@ -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);
             }