tizenaudio-sink: Print log when snd_pcm_avail() return small value continuously 99/265299/2 submit/tizen/20211015.121039
authorjungsup lee <jungsup4.lee@samsung.com>
Thu, 14 Oct 2021 08:33:19 +0000 (17:33 +0900)
committerjungsup lee <jungsup4.lee@samsung.com>
Thu, 14 Oct 2021 08:39:32 +0000 (17:39 +0900)
[Version] 13.0.78
[Issue Type] Debugging

Change-Id: I982d1ee7cf7a5d0546902aec9f7a498278b4014a

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

index 0130020..88816a2 100644 (file)
@@ -1,6 +1,6 @@
 Name:             pulseaudio-modules-tizen
 Summary:          Pulseaudio modules for Tizen
-Version:          13.0.77
+Version:          13.0.78
 Release:          0
 Group:            Multimedia/Audio
 License:          LGPL-2.1+
index de01053..a941adf 100644 (file)
@@ -76,7 +76,8 @@ PA_MODULE_USAGE(
 /* Sink device consumes that amount of maximum buffer at every request */
 #define DEFAULT_MAX_REQUEST_USEC (PA_USEC_PER_SEC * 0.032)
 
-#define DEVICE_NAME_MAX                     30
+#define DEVICE_NAME_MAX 30
+#define SMALL_AVAIL_LOG_PERIOD 20
 
 #ifdef SUPPORT_AEC
 enum {
@@ -109,6 +110,7 @@ struct userdata {
 
     pa_rtpoll_item *rtpoll_item;
 
+    uint64_t small_avail_count;
     uint64_t write_count;
     pa_hal_interface *hal_interface;
 
@@ -432,10 +434,18 @@ static int process_render(struct userdata *u, pa_usec_t now) {
 #else
             frames_to_write = u->frag_size / frame_size;
 #endif
-            if (frames_to_write > avail)
+            if (frames_to_write > avail) {
+                u->small_avail_count++;
+
+                if ((u->small_avail_count % SMALL_AVAIL_LOG_PERIOD) == 0)
+                    pa_log_error("avail is too small : %u(repeat count : %llu)", avail, u->small_avail_count);
+
                 break;
+            }
         }
 
+        u->small_avail_count = 0;
+
         pa_sink_render_full(u->sink, frames_to_write * frame_size, &chunk);
         p = pa_memblock_acquire(chunk.memblock);